Entry: Fix Shift-click → extend/truncate selection
authorDaniel Boles <dboles.src@gmail.com>
Sat, 5 Aug 2017 22:48:29 +0000 (23:48 +0100)
committerDaniel Boles <dboles@src.gnome.org>
Wed, 30 Aug 2017 17:25:00 +0000 (18:25 +0100)
commit12d96f27d340ef40a75c6278fbdd9d5a846497de
tree4bdb6ce867d28711ac702f37a07e49f73c23ded0
parent81d6f8d81c78cba652800c67e47decb34bb7e997
Entry: Fix Shift-click → extend/truncate selection

Since the move from button-press to gesture events, Shift-clicking did
not work to start a selection (from none) or truncate an existing one.

This was due to the code being copy-pasted around and some logic being
broken in the process. This makes both of those work as they should, by
shuffling it again so the end result is the same as before. Highlights:

(1) ::button-press if extending due to a single press would call
set_positions(tmp_pos, tmp_pos), which is what made the Shift+click to
create a selection work. That was lost. Add it back to make that work.

(2) ::button-press in the “Truncate current selection” branch would not
execute all the stuff around “extend_to_left”, as that was the else
case. So, set extend_selection = FALSE so we skip over that later on.

(3) BUT! This Truncate case never fired because it was in the else
branch of if (in_selection())! Of course, it must be in the true branch.

(4) The IM context was not reset if the Shift-click occurred within an
existing selection, only if it did not. In ::button-press this was the
first thing done if extending a selection, regardless. Make it so again.

https://bugzilla.gnome.org/show_bug.cgi?id=780750
gtk/gtkentry.c