Fix click to move cursor in fish multiline text
Thanks to @ridiculousfish, see: https://github.com/kovidgoyal/kitty/issues/3948#issuecomment-930458949
This commit is contained in:
parent
9ab5a03f53
commit
ea186ac48d
@ -1469,12 +1469,19 @@ screen_fake_move_cursor_to_position(Screen *self, index_type x, index_type y) {
|
||||
|
||||
for (unsigned y = start->y, x = start->x; y <= end->y; y++) {
|
||||
unsigned x_limit = y == end->y ? end->x : self->columns;
|
||||
bool found_non_empty_cell = false;
|
||||
while (x < x_limit) {
|
||||
unsigned int w = linebuf_char_width_at(self->linebuf, x, y);
|
||||
if (w == 0) {
|
||||
count += 1;
|
||||
// we only stop counting the cells in the line at an empty cell
|
||||
// if at least one non-empty cell is found. zsh uses empty cells
|
||||
// between the end of the text ad the right prompt. fish uses empty
|
||||
// cells at the start of a line when editing multiline text
|
||||
if (!found_non_empty_cell) { x++; continue; }
|
||||
break;
|
||||
}
|
||||
found_non_empty_cell = true;
|
||||
x += w;
|
||||
count += 1; // zsh requires a single arrow press to move fast dualwidth chars
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user