Skip to content

Commit fa003f8

Browse files
committed
Fix #2431
1 parent 12f37bc commit fa003f8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

kitty/mouse.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ cell_for_pos(Window *w, unsigned int *x, unsigned int *y, bool *in_left_half_of_
137137
Screen *screen = w->render_data.screen;
138138
if (!screen) return false;
139139
unsigned int qx = 0, qy = 0;
140-
bool in_left_half = false;
140+
bool in_left_half = true;
141141
double mouse_x = global_state.callback_os_window->mouse_x;
142142
double mouse_y = global_state.callback_os_window->mouse_y;
143143
double left = window_left(w, os_window), top = window_top(w, os_window), right = window_right(w, os_window), bottom = window_bottom(w, os_window);
@@ -147,8 +147,10 @@ cell_for_pos(Window *w, unsigned int *x, unsigned int *y, bool *in_left_half_of_
147147
}
148148
w->mouse_pos.x = mouse_x - left; w->mouse_pos.y = mouse_y - top;
149149
if (mouse_x < left || mouse_y < top || mouse_x > right || mouse_y > bottom) return false;
150-
if (mouse_x >= g->right) qx = screen->columns - 1;
151-
else if (mouse_x >= g->left) {
150+
if (mouse_x >= g->right) {
151+
qx = screen->columns - 1;
152+
in_left_half = false;
153+
} else if (mouse_x >= g->left) {
152154
double xval = (double)(mouse_x - g->left) / os_window->fonts_data->cell_width;
153155
double fxval = floor(xval);
154156
qx = (unsigned int)fxval;

0 commit comments

Comments
 (0)