From 8b636de1d3f3d797f38990a59cfd5456dde5d122 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 1 Jul 2016 12:41:35 +0200 Subject: [PATCH] tweaks: put all the movement functions together And order them from smallest stride to biggest stride. --- src/browser.c | 40 ++++++++++++++++++++-------------------- src/help.c | 12 ++++++------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/browser.c b/src/browser.c index 1d962abc..371b87cd 100644 --- a/src/browser.c +++ b/src/browser.c @@ -211,6 +211,26 @@ char *do_browser(char *path) } else if (func == do_research) { /* Search for another filename. */ do_fileresearch(); + } else if (func == do_left) { + if (selected > 0) + selected--; + } else if (func == do_right) { + if (selected < filelist_len - 1) + selected++; +#ifndef NANO_TINY + } else if (func == do_prev_word_void) { + selected -= (selected % width); + } else if (func == do_next_word_void) { + selected += width - 1 - (selected % width); + if (selected >= filelist_len) + selected = filelist_len - 1; +#endif + } else if (func == do_up_void) { + if (selected >= width) + selected -= width; + } else if (func == do_down_void) { + if (selected + width <= filelist_len - 1) + selected += width; } else if (func == do_page_up) { if (selected < width) selected = 0; @@ -281,26 +301,6 @@ char *do_browser(char *path) /* Try opening and reading the specified directory. */ goto read_directory_contents; - } else if (func == do_up_void) { - if (selected >= width) - selected -= width; - } else if (func == do_down_void) { - if (selected + width <= filelist_len - 1) - selected += width; -#ifndef NANO_TINY - } else if (func == do_prev_word_void) { - selected -= (selected % width); - } else if (func == do_next_word_void) { - selected += width - 1 - (selected % width); - if (selected >= filelist_len) - selected = filelist_len - 1; -#endif - } else if (func == do_left) { - if (selected > 0) - selected--; - } else if (func == do_right) { - if (selected < filelist_len - 1) - selected++; } else if (func == do_enter) { struct stat st; diff --git a/src/help.c b/src/help.c index 2837c822..93f2502e 100644 --- a/src/help.c +++ b/src/help.c @@ -141,6 +141,12 @@ void do_help(void) if (func == total_refresh) { total_redraw(); + } else if (func == do_up_void) { + if (line > 0) + line--; + } else if (func == do_down_void) { + if (line + (editwinrows - 1) < last_line) + line++; } else if (func == do_page_up) { if (line > editwinrows - 2) line -= editwinrows - 2; @@ -149,12 +155,6 @@ void do_help(void) } else if (func == do_page_down) { if (line + (editwinrows - 1) < last_line) line += editwinrows - 2; - } else if (func == do_up_void) { - if (line > 0) - line--; - } else if (func == do_down_void) { - if (line + (editwinrows - 1) < last_line) - line++; } else if (func == do_first_line) { line = 0; } else if (func == do_last_line) {