Letting a toggle not break a series of ^Ks.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4962 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2014-06-13 12:28:33 +00:00
parent 1d06455ca5
commit 3af22aad8d
2 changed files with 10 additions and 8 deletions

View File

@ -3,6 +3,7 @@
(result == 0) should break a series of ^Ks. (result == 0) should break a series of ^Ks.
* src/nano.c (do_mouse): Clicking on the titlebar or the statusbar * 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. should not break a series of ^Ks, thus result must not be zero.
* src/nano.c (do_input): A toggle should not break a series of ^Ks.
2014-06-11 Benno Schulenberg <bensberg@justemail.net> 2014-06-11 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (get_mouseinput): Produce the correct return value for * src/winio.c (get_mouseinput): Produce the correct return value for

View File

@ -1577,8 +1577,8 @@ int do_input(bool *meta_key, bool *func_key, bool allow_funcs)
/* The input buffer. */ /* The input buffer. */
static size_t kbinput_len = 0; static size_t kbinput_len = 0;
/* The length of the input buffer. */ /* The length of the input buffer. */
bool cut_copy = FALSE; bool preserve = FALSE;
/* Are we cutting or copying text? */ /* Preserve the contents of the cutbuffer? */
const sc *s; const sc *s;
bool have_shortcut; bool have_shortcut;
@ -1678,7 +1678,7 @@ int do_input(bool *meta_key, bool *func_key, bool allow_funcs)
|| s->scfunc == do_copy_text || s->scfunc == do_cut_till_end || s->scfunc == do_copy_text || s->scfunc == do_cut_till_end
#endif #endif
) )
cut_copy = TRUE; preserve = TRUE;
if (s->scfunc != 0) { if (s->scfunc != 0) {
const subnfunc *f = sctofunc((sc *) s); const subnfunc *f = sctofunc((sc *) s);
@ -1686,9 +1686,10 @@ int do_input(bool *meta_key, bool *func_key, bool allow_funcs)
print_view_warning(); print_view_warning();
else { else {
#ifndef NANO_TINY #ifndef NANO_TINY
if (s->scfunc == do_toggle_void) if (s->scfunc == do_toggle_void) {
do_toggle(s->toggle); do_toggle(s->toggle);
else preserve = TRUE;
} else
#endif #endif
{ {
/* Execute the function of the shortcut. */ /* Execute the function of the shortcut. */
@ -1711,9 +1712,9 @@ int do_input(bool *meta_key, bool *func_key, bool allow_funcs)
} }
} }
/* If we aren't cutting or copying text, blow away the text in the /* If we aren't cutting or copying text, and the key wasn't a toggle,
* cutbuffer upon the next cutting action. */ * blow away the text in the cutbuffer upon the next cutting action. */
if (!cut_copy) if (!preserve)
cutbuffer_reset(); cutbuffer_reset();
return input; return input;