mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-09 08:21:01 -04:00
selection: extending a selection is now interactive
That is, a selection extension can be resized just like an ordinary extension.
This commit is contained in:
parent
50bd51c4d4
commit
7127a0a6c3
3 changed files with 12 additions and 10 deletions
|
|
@ -37,13 +37,15 @@
|
||||||
outside it.
|
outside it.
|
||||||
* Scrollback search to focus match, that requires a viewport change,
|
* Scrollback search to focus match, that requires a viewport change,
|
||||||
roughly in the center of the screen.
|
roughly in the center of the screen.
|
||||||
|
* Extending a selection with the right mouse button now works while
|
||||||
|
dragging the mouse.
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
### Removed
|
### Removed
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
* Crash in scrollback search
|
* Crash in scrollback search.
|
||||||
* Crash when a **pipe-visible** or **pipe-scrollback** command
|
* Crash when a **pipe-visible** or **pipe-scrollback** command
|
||||||
contained an unclosed quote
|
contained an unclosed quote
|
||||||
(https://codeberg.org/dnkl/foot/issues/49).
|
(https://codeberg.org/dnkl/foot/issues/49).
|
||||||
|
|
|
||||||
2
input.c
2
input.c
|
|
@ -1171,7 +1171,7 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
|
||||||
if (col < 0 || row < 0 || col >= term->cols || row >= term->rows)
|
if (col < 0 || row < 0 || col >= term->cols || row >= term->rows)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool update_selection = seat->mouse.button == BTN_LEFT;
|
bool update_selection = seat->mouse.button == BTN_LEFT || seat->mouse.button == BTN_RIGHT;
|
||||||
bool update_selection_early = term->selection.end.row == -1;
|
bool update_selection_early = term->selection.end.row == -1;
|
||||||
|
|
||||||
if (update_selection && update_selection_early)
|
if (update_selection && update_selection_early)
|
||||||
|
|
|
||||||
16
selection.c
16
selection.c
|
|
@ -372,8 +372,8 @@ selection_extend_normal(struct terminal *term, int col, int row, uint32_t serial
|
||||||
|
|
||||||
if (row < start->row || (row == start->row && col < start->col)) {
|
if (row < start->row || (row == start->row && col < start->col)) {
|
||||||
/* Extend selection to start *before* current start */
|
/* Extend selection to start *before* current start */
|
||||||
new_start = (struct coord){col, row};
|
new_start = *end;
|
||||||
new_end = *end;
|
new_end = (struct coord){col, row};
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (row > end->row || (row == end->row && col > end->col)) {
|
else if (row > end->row || (row == end->row && col > end->col)) {
|
||||||
|
|
@ -391,8 +391,8 @@ selection_extend_normal(struct terminal *term, int col, int row, uint32_t serial
|
||||||
abs(linear - (end->row * term->cols + end->col)))
|
abs(linear - (end->row * term->cols + end->col)))
|
||||||
{
|
{
|
||||||
/* Move start point */
|
/* Move start point */
|
||||||
new_start = (struct coord){col, row};
|
new_start = *end;
|
||||||
new_end = *end;
|
new_end = (struct coord){col, row};
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
@ -440,13 +440,13 @@ selection_extend_block(struct terminal *term, int col, int row, uint32_t serial)
|
||||||
/* Move one of the top corners */
|
/* Move one of the top corners */
|
||||||
|
|
||||||
if (abs(col - top_left.col) < abs(col - top_right.col)) {
|
if (abs(col - top_left.col) < abs(col - top_right.col)) {
|
||||||
new_start = (struct coord){col, row};
|
new_start = bottom_right;
|
||||||
new_end = bottom_right;
|
new_end = (struct coord){col, row};
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
new_start = (struct coord){col, row};
|
new_start = bottom_left;
|
||||||
new_end = bottom_left;
|
new_end = (struct coord){col, row};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue