From 6ff22e702048654f2df686fe95cea2e1cc449401 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Wed, 19 Jul 2006 00:14:52 +0000 Subject: [PATCH] rename the values of the scroll_dir enum to UP_DIR and DOWN_DIR, since UP is defined as a termcap value in Tru64's curses.h, which breaks compilation git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3793 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 5 +++++ src/move.c | 8 ++++---- src/nano.h | 2 +- src/winio.c | 29 +++++++++++++++-------------- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64de46ed..d38b3271 100644 --- a/ChangeLog +++ b/ChangeLog @@ -36,6 +36,11 @@ CVS code - to parse_kbinput(), get_escape_seq_kbinput(), parse_escape_seq_kbinput(), get_shortcut(), and get_toggle(). (DLR) + - Rename the values of the scroll_dir enum to UP_DIR and + DOWN_DIR, since UP is defined as a termcap value in Tru64's + curses.h, which breaks compilation. Changes to do_page_up(), + do_page_down(), do_up(), do_down(), nano.h, and edit_scroll(). + (DLR, found by Daniel Richard G.) - browser.c: do_browser() - Refactor the mouse support, modeling it after do_mouse() for diff --git a/src/move.c b/src/move.c index 3e44adb9..45b95338 100644 --- a/src/move.c +++ b/src/move.c @@ -85,7 +85,7 @@ void do_page_up(void) openfile->placewewant); /* Scroll the edit window up a page. */ - edit_scroll(UP, editwinrows - 2); + edit_scroll(UP_DIR, editwinrows - 2); } /* Move down one page. */ @@ -121,7 +121,7 @@ void do_page_down(void) openfile->placewewant); /* Scroll the edit window down a page. */ - edit_scroll(DOWN, editwinrows - 2); + edit_scroll(DOWN_DIR, editwinrows - 2); } #ifndef DISABLE_JUSTIFY @@ -507,7 +507,7 @@ void do_up( || scroll_only #endif ) - edit_scroll(UP, + edit_scroll(UP_DIR, #ifndef NANO_TINY (ISSET(SMOOTH_SCROLL) || scroll_only) ? 1 : #endif @@ -573,7 +573,7 @@ void do_down( || scroll_only #endif ) - edit_scroll(DOWN, + edit_scroll(DOWN_DIR, #ifndef NANO_TINY (ISSET(SMOOTH_SCROLL) || scroll_only) ? 1 : #endif diff --git a/src/nano.h b/src/nano.h index bbf870b7..b541897a 100644 --- a/src/nano.h +++ b/src/nano.h @@ -158,7 +158,7 @@ typedef enum { } append_type; typedef enum { - UP, DOWN + UP_DIR, DOWN_DIR } scroll_dir; typedef enum { diff --git a/src/winio.c b/src/winio.c index 1cab1506..cdcd6ab4 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2700,10 +2700,10 @@ bool need_vertical_update(size_t old_pww) /* Scroll the edit window in the given direction and the given number * of lines, and draw new lines on the blank lines left after the - * scrolling. direction is the direction to scroll, either UP or DOWN, - * and nlines is the number of lines to scroll. We change edittop, and - * assume that current and current_x are up to date. We also assume - * that scrollok(edit) is FALSE. */ + * scrolling. direction is the direction to scroll, either UP_DIR or + * DOWN_DIR, and nlines is the number of lines to scroll. We change + * edittop, and assume that current and current_x are up to date. We + * also assume that scrollok(edit) is FALSE. */ void edit_scroll(scroll_dir direction, ssize_t nlines) { bool do_redraw = need_vertical_update(0); @@ -2721,7 +2721,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines) * value of direction) nlines lines, or as many lines as we can if * there are fewer than nlines lines available. */ for (i = nlines; i > 0; i--) { - if (direction == UP) { + if (direction == UP_DIR) { if (openfile->edittop == openfile->fileage) break; openfile->edittop = openfile->edittop->prev; @@ -2749,7 +2749,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines) /* Scroll the text of the edit window up or down nlines lines, * depending on the value of direction. */ scrollok(edit, TRUE); - wscrl(edit, (direction == UP) ? -nlines : nlines); + wscrl(edit, (direction == UP_DIR) ? -nlines : nlines); scrollok(edit, FALSE); /* Part 2: nlines is the number of lines in the scrolled region of @@ -2757,9 +2757,10 @@ void edit_scroll(scroll_dir direction, ssize_t nlines) /* If the top or bottom line of the file is now visible in the edit * window, we need to draw the entire edit window. */ - if ((direction == UP && openfile->edittop == openfile->fileage) || - (direction == DOWN && openfile->edittop->lineno + editwinrows - - 1 >= openfile->filebot->lineno)) + if ((direction == UP_DIR && openfile->edittop == + openfile->fileage) || (direction == DOWN_DIR && + openfile->edittop->lineno + editwinrows - 1 >= + openfile->filebot->lineno)) nlines = editwinrows; /* If the scrolled region contains only one line, and the line @@ -2778,7 +2779,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines) /* If we scrolled down, move down to the line before the scrolled * region. */ - if (direction == DOWN) { + if (direction == DOWN_DIR) { for (i = editwinrows - nlines; i > 0 && foo != NULL; i--) foo = foo->next; } @@ -2789,8 +2790,8 @@ void edit_scroll(scroll_dir direction, ssize_t nlines) * blank, so we don't need to draw it unless the mark is on or we're * not on the first page. */ for (i = nlines; i > 0 && foo != NULL; i--) { - if ((i == nlines && direction == DOWN) || (i == 1 && - direction == UP)) { + if ((i == nlines && direction == DOWN_DIR) || (i == 1 && + direction == UP_DIR)) { if (do_redraw) update_line(foo, (foo == openfile->current) ? openfile->current_x : 0); @@ -2866,9 +2867,9 @@ void edit_redraw(const filestruct *old_current, size_t old_pww) /* Scroll the edit window up or down until edittop is in range * of current. */ if (nlines < 0) - edit_scroll(UP, -nlines); + edit_scroll(UP_DIR, -nlines); else - edit_scroll(DOWN, nlines); + edit_scroll(DOWN_DIR, nlines); #ifndef NANO_TINY /* If the mark is on, update all the lines between the old first -- 2.39.5