tweaks: put all the movement functions together

And order them from smallest stride to biggest stride.
This commit is contained in:
Benno Schulenberg 2016-07-01 12:41:35 +02:00
parent aeab800490
commit 8b636de1d3
2 changed files with 26 additions and 26 deletions

View File

@ -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;

View File

@ -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) {