Without this, the initial cell will always be selected, regardless of
how the selection is moved to the left or right.
With this patch, the initial cell will only be selected while the
selection is being made in the original direction. Changing direction
of the selection moves the start point to next/previous character.
The default is still to inverse the regular foreground/background
colors.
If the user sets *both* of the new options, selection-foreground and
selection-background, those colors will *always* be used for selected
cells, instead of inverting the regular foreground/background colors.
If the match was somewhere near the scrollback beginning, and if the
entire scrollback hadn't yet been filled, we ended up trying to move
the viewport past the beginning of the scrollback, which we then
adjusted in the wrong direction, causing the viewport to not move at
all.
Besides being a bad user experience, since the new match wasn't
visible, foot would also crash if you manually scrolled up to the
match.
While refactoring this code, the check for LMB or RMB got changed to
LMB or "any button".
This fixes that.
It also adds a boolean 'cursor_is_on_grid', which should make the code
easier to read and understand.
Don't send mouse button escapes to a mouse grabbing client when the
cursor is outside the grid (i.e. when it is inside the margins).
Also don't do *any* kind of selection when the cursor is outside the
grid. Previously, we only checked this for selection_start(), but
e.g. double clicking would run selection_extend(), or
selection_mark_word() etc.
Previously, the selection was only updated when the mouse cursor was
inside the grid. This makes it difficult to e.g. do large selections
fast, since you often end up moving the cursor outside the grid, or
outside the terminal window even.
Now, we update the selection regardless of *where* the cursor is. This
is done by bounding the row/col we pass to 'selection_update()' to the
grid, while still setting the seat's row/col to -1 when the cursor is
outside the grid, to ensure the xcursor etc are set correctly.
Care must also be taken to *not* pass any motion events to a mouse
grabbing client, when the cursor is outside the grid.
Closes#70.
This fixes an issue where the col/row were incorrectly set to 0
instead of -1, when the mouse cursor was inside the grid margins.
This resulted in e.g. the mouse cursor having the wrong shape, and
foot incorrectly handling mouse events as if they were inside the
grid.