mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-25 22:29:42 +03:00
mouse: do not offset the shortcuts by 'margin' when using --linenumbers
The bottom window (the prompt bar and the shortcuts) does not shift its position when line numbers are active, so mouse clicks in this window should be not be compensated for the line-numbers margin. This fixes https://savannah.gnu.org/bugs/?59749. Indirectly-reported-by: ObeliX <ObeliX-@gmx.de> Bug existed since version 2.7.0, since line numbers were introduced.
This commit is contained in:
parent
d1c412d200
commit
265bdd94f1
@ -1488,14 +1488,16 @@ char *get_verbatim_kbinput(WINDOW *win, size_t *count)
|
||||
int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
|
||||
{
|
||||
MEVENT mevent;
|
||||
bool in_bottomwin;
|
||||
bool in_editwin, in_bottomwin;
|
||||
|
||||
/* First, get the actual mouse event. */
|
||||
if (getmouse(&mevent) == ERR)
|
||||
return -1;
|
||||
|
||||
in_editwin = wenclose(edit, mevent.y, mevent.x);
|
||||
|
||||
/* Save the screen coordinates where the mouse event took place. */
|
||||
*mouse_x = mevent.x - margin;
|
||||
*mouse_x = mevent.x - (in_editwin ? margin : 0);
|
||||
*mouse_y = mevent.y;
|
||||
|
||||
in_bottomwin = wenclose(bottomwin, *mouse_y, *mouse_x);
|
||||
@ -1521,7 +1523,7 @@ int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
|
||||
/* Clicks on the status bar are handled elsewhere, so
|
||||
* restore the untranslated mouse-event coordinates. */
|
||||
if (*mouse_y == 0) {
|
||||
*mouse_x = mevent.x - margin;
|
||||
*mouse_x = mevent.x;
|
||||
*mouse_y = mevent.y;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user