+ if(nav==NAV_LEFT)
+ {
+ if(edit_pos>0)
+ set_edit_position(edit_pos-1, select);
+ }
+ else if(nav==NAV_RIGHT)
+ {
+ if(edit_pos<text.size())
+ set_edit_position(edit_pos+1, select);
+ }
+ else if(nav==NAV_DOWN)
+ {
+ unsigned row, col;
+ text.offset_to_coords(edit_pos, row, col);
+ set_edit_position(text.coords_to_offset(row+1, col), select);
+ }
+ else if(nav==NAV_UP)
+ {
+ unsigned row, col;
+ text.offset_to_coords(edit_pos, row, col);
+ set_edit_position((row>0 ? text.coords_to_offset(row-1, col) : 0), select);
+ }
+}
+
+void Entry::set_edit_position(unsigned ep, bool select)
+{
+ if(select && !selection_active)
+ selection_pos = edit_pos;
+ selection_active = select;
+
+ edit_pos = ep;
+ check_view_range();
+ rebuild();
+}
+
+void Entry::erase_selection()
+{
+ if(!selection_active)