selection: add selection_extend()

This function extends an existing selection in the following way:

If the extension point is *before* the upper boundary of the current
selection, extend the selection upwards.

If the extension point is *after* the bottom boundary of the current
selection, extend the selection downwards.

If the extension point is *inside* the current selection, shrink the
selection such that the new size is maximized. This means we move the
*closest* start/end point from in the current selection.
This commit is contained in:
Daniel Eklöf 2020-04-04 11:59:15 +02:00
parent 2344f153d9
commit aa01521ff6
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 172 additions and 14 deletions

View file

@ -14,6 +14,7 @@ void selection_start(
void selection_update(struct terminal *term, int col, int row);
void selection_finalize(struct terminal *term, uint32_t serial);
void selection_cancel(struct terminal *term);
void selection_extend(struct terminal *term, int col, int row, uint32_t serial);
bool selection_on_row_in_view(const struct terminal *term, int row_no);