From 1d06455ca562cb14f3b569d3e93905b7fe9ac805 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 13 Jun 2014 12:19:44 +0000 Subject: [PATCH] Letting a click on titlebar or statusbar not break a series of ^Ks. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4961 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/nano.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa0faa20..f3caf368 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2014-06-13 Benno Schulenberg * src/nano.c (do_input): Repositioning the cursor with the mouse (result == 0) should break a series of ^Ks. + * src/nano.c (do_mouse): Clicking on the titlebar or the statusbar + should not break a series of ^Ks, thus result must not be zero. 2014-06-11 Benno Schulenberg * src/winio.c (get_mouseinput): Produce the correct return value for diff --git a/src/nano.c b/src/nano.c index 7e9b59b0..11948b70 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1737,8 +1737,12 @@ int do_mouse(void) int mouse_x, mouse_y; int retval = get_mouseinput(&mouse_x, &mouse_y, TRUE); + if (retval != 0) + /* The click is wrong or already handled. */ + return retval; + /* We can click on the edit window to move the cursor. */ - if (retval == 0 && wmouse_trafo(edit, &mouse_y, &mouse_x, FALSE)) { + if (wmouse_trafo(edit, &mouse_y, &mouse_x, FALSE)) { bool sameline; /* Did they click on the line with the cursor? If they * clicked on the cursor, we set the mark. */ @@ -1812,9 +1816,13 @@ int do_mouse(void) #endif edit_redraw(current_save, pww_save); + + /* The click influenced the cursor. */ + return 0; } - return retval; + /* The click was elsewhere, ignore it. */ + return 2; } #endif /* !DISABLE_MOUSE */ -- 2.39.5