Commit 99a649dd authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

Avoiding an "Unknown Command" on every cursor-positioning mouse click.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4968 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent ca9abd82
Showing with 10 additions and 9 deletions
+10 -9
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
* configure.ac: For the sake of statically linked systems, make sure * configure.ac: For the sake of statically linked systems, make sure
the compiler also links against libz, which is used by libmagic. the compiler also links against libz, which is used by libmagic.
This fixes Savannah bug #38378, reported by Alan Hourihane. This fixes Savannah bug #38378, reported by Alan Hourihane.
* src/nano.c (do_mouse, do_input): Don't bother returning zero when
the cursor moved, just reset the cutbuffer directly. This avoids an
"Unknown Command" message on every cursor-positioning mouse click.
2014-06-14 Mark Majeres <mark@engine12.com> 2014-06-14 Mark Majeres <mark@engine12.com>
* src/nano.h, src/text.c (undo_cut, update_undo): When undoing a * src/nano.h, src/text.c (undo_cut, update_undo): When undoing a
......
...@@ -1584,14 +1584,12 @@ int do_input(bool *meta_key, bool *func_key, bool allow_funcs) ...@@ -1584,14 +1584,12 @@ int do_input(bool *meta_key, bool *func_key, bool allow_funcs)
#ifndef DISABLE_MOUSE #ifndef DISABLE_MOUSE
if (*func_key && input == KEY_MOUSE) { if (*func_key && input == KEY_MOUSE) {
/* We received a mouse click. */ /* We received a mouse click. */
int result = do_mouse(); if (do_mouse() == 1)
if (result == 1)
/* The click was on a shortcut -- read in the character /* The click was on a shortcut -- read in the character
* that it was converted into. */ * that it was converted into. */
input = get_kbinput(edit, meta_key, func_key); input = get_kbinput(edit, meta_key, func_key);
else if (result != 0) else
/* The click was invalid -- get out. */ /* The click was invalid or has been handled -- get out. */
return ERR; return ERR;
} }
#endif #endif
...@@ -1810,15 +1808,15 @@ int do_mouse(void) ...@@ -1810,15 +1808,15 @@ int do_mouse(void)
* the line. */ * the line. */
if (sameline && openfile->current_x == current_x_save) if (sameline && openfile->current_x == current_x_save)
do_mark(); do_mark();
else
#endif #endif
/* The cursor moved; clean the cutbuffer on the next cut. */
cutbuffer_reset();
edit_redraw(current_save, pww_save); edit_redraw(current_save, pww_save);
/* The click influenced the cursor. */
return 0;
} }
/* The click was elsewhere, ignore it. */ /* No more handling is needed. */
return 2; return 2;
} }
#endif /* !DISABLE_MOUSE */ #endif /* !DISABLE_MOUSE */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment