From 8cc8b08dfce79a7b6aa407f7910f044b3481ccd3 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 11 Jun 2014 18:34:35 +0000 Subject: [PATCH] Removing a superfluous switch statement. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4958 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 1 + src/nano.c | 58 ++++++++++++++++++++++++------------------------------ 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7cc43237..4f7698b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ next cut. These two changes together fix Savannah bug #42326. * src/nano.c (do_input): Always accept mouse events, also when just looking for Unjustify. This fixes Savannah bug #42322. + * src/nano.c (do_input): Remove a superfluous switch statement. 2014-06-10 Benno Schulenberg * src/browser.c, src/files.c, src/nano.c src/prompt.c, src/winio.c: diff --git a/src/nano.c b/src/nano.c index 704c61e1..4e9ce8b5 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1667,54 +1667,48 @@ int do_input(bool *meta_key, bool *func_key, bool allow_funcs) } if (have_shortcut) { - switch (input) { - /* Handle the normal edit-window shortcuts. */ - default: - /* If the function associated with this shortcut is - * cutting or copying text, indicate this. */ - if (s->scfunc == do_cut_text_void + /* If the function associated with this shortcut is + * cutting or copying text, remember this. */ + if (s->scfunc == do_cut_text_void #ifndef NANO_TINY - || s->scfunc == do_copy_text || s->scfunc == - do_cut_till_end + || s->scfunc == do_copy_text || s->scfunc == do_cut_till_end #endif - ) - cut_copy = TRUE; + ) + cut_copy = TRUE; - if (s->scfunc != 0) { - const subnfunc *f = sctofunc((sc *) s); - if (ISSET(VIEW_MODE) && f && !f->viewok) - print_view_warning(); - else { + if (s->scfunc != 0) { + const subnfunc *f = sctofunc((sc *) s); + if (ISSET(VIEW_MODE) && f && !f->viewok) + print_view_warning(); + else { #ifndef NANO_TINY - if (s->scfunc == do_toggle_void) - do_toggle(s->toggle); - else + if (s->scfunc == do_toggle_void) + do_toggle(s->toggle); + else #endif - { - s->scfunc(); + { + /* Execute the function of the shortcut. */ + s->scfunc(); #ifndef DISABLE_COLOR - if (f && !f->viewok && openfile->syntax != NULL - && openfile->syntax->nmultis > 0) { - reset_multis(openfile->current, FALSE); - } + if (f && !f->viewok && openfile->syntax != NULL + && openfile->syntax->nmultis > 0) + reset_multis(openfile->current, FALSE); #endif - if (edit_refresh_needed) { + if (edit_refresh_needed) { #ifdef DEBUG - fprintf(stderr, "running edit_refresh() as edit_refresh_needed is true\n"); + fprintf(stderr, "running edit_refresh() as edit_refresh_needed is true\n"); #endif - edit_refresh(); - edit_refresh_needed = FALSE; - } - } + edit_refresh(); + edit_refresh_needed = FALSE; } } - break; + } } } } /* If we aren't cutting or copying text, blow away the text in the - * cutbuffer. */ + * cutbuffer upon the next cutting action. */ if (!cut_copy) cutbuffer_reset(); -- 2.39.5