void Entry::adjust_edit_position_for_change(unsigned pos, int change)
{
unsigned old_edit_pos = edit_pos;
+ unsigned old_select_pos = selection_pos;
if(change>0)
{
if(edit_pos!=old_edit_pos)
signal_edit_position_changed.emit(edit_pos);
+ if(selection_active && (edit_pos!=old_edit_pos || selection_pos!=old_select_pos))
+ {
+ unsigned start, end;
+ if(get_selection(start, end))
+ signal_selection_changed.emit(start, end);
+ }
}
void Entry::set_edit_position(unsigned ep, bool select)
{
+ bool selection_was_active = selection_active;
if(select && !selection_active)
selection_pos = edit_pos;
selection_active = select;
edit_pos = min(ep, text.size());
if(edit_pos!=old_edit_pos)
+ {
signal_edit_position_changed.emit(edit_pos);
+ unsigned start, end;
+ if(get_selection(start, end))
+ signal_selection_changed.emit(start, end);
+ else if(selection_was_active)
+ signal_selection_changed.emit(edit_pos, edit_pos);
+ }
if(multiline)
check_view_range();
sigc::signal<void, unsigned> signal_edit_position_changed;
sigc::signal<void, unsigned> signal_scroll_position_changed;
+ sigc::signal<void, unsigned, unsigned> signal_selection_changed;
sigc::signal<void, const std::string &> signal_text_changed;
// Deprecated