Handle multiline cursor movement in zsh when clicking
This commit is contained in:
parent
2715947830
commit
fab7cfb113
@ -1362,12 +1362,16 @@ screen_fake_move_cursor_to_position(Screen *self, index_type x, index_type y) {
|
|||||||
SelectionBoundary *start, *end; int key;
|
SelectionBoundary *start, *end; int key;
|
||||||
if (a.y < b.y || (a.y == b.y && a.x < b.x)) { start = &a; end = &b; key = GLFW_FKEY_LEFT; }
|
if (a.y < b.y || (a.y == b.y && a.x < b.x)) { start = &a; end = &b; key = GLFW_FKEY_LEFT; }
|
||||||
else { start = &b; end = &a; key = GLFW_FKEY_RIGHT; }
|
else { start = &b; end = &a; key = GLFW_FKEY_RIGHT; }
|
||||||
unsigned count = 0;
|
unsigned int count = 0;
|
||||||
|
|
||||||
for (unsigned y = start->y, x = start->x; y <= end->y; y++) {
|
for (unsigned y = start->y, x = start->x; y <= end->y; y++) {
|
||||||
unsigned x_limit = y == end->y ? end->x : self->columns;
|
unsigned x_limit = y == end->y ? end->x : self->columns;
|
||||||
while (x < x_limit) {
|
while (x < x_limit) {
|
||||||
unsigned w = MAX(1u, linebuf_char_width_at(self->linebuf, x, y));
|
unsigned int w = linebuf_char_width_at(self->linebuf, x, y);
|
||||||
|
if (w == 0) {
|
||||||
|
count += 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
x += w;
|
x += w;
|
||||||
count += w;
|
count += w;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user