commit 21ffa883f76c5850e2a54929467dff980f1d9ab1
parent 98ec41b4fa5be1ba5ec257b5afeafeb62821d26e
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 31 Aug 2017 22:14:06 +0200
tweaks: use mnemonic constants instead of TRUE and FALSE
And use these constants in another context too.
Diffstat:
5 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -639,16 +639,16 @@ void switch_to_adjacent_buffer(bool to_next)
#endif
}
-/* Switch to the previous entry in the openfile filebuffer. */
+/* Switch to the previous entry in the list of open files. */
void switch_to_prev_buffer(void)
{
- switch_to_adjacent_buffer(FALSE);
+ switch_to_adjacent_buffer(BACKWARD);
}
-/* Switch to the next entry in the openfile filebuffer. */
+/* Switch to the next entry in the list of open files. */
void switch_to_next_buffer(void)
{
- switch_to_adjacent_buffer(TRUE);
+ switch_to_adjacent_buffer(FORWARD);
}
/* Delete an entry from the circular list of open files, and switch to the
diff --git a/src/move.c b/src/move.c
@@ -502,7 +502,7 @@ void do_up(bool scroll_only)
set_proper_index_and_pww(&leftedge, target_column, FALSE);
if (scroll_only)
- edit_scroll(UPWARD, 1);
+ edit_scroll(BACKWARD, 1);
edit_redraw(was_current, FLOWING);
@@ -526,7 +526,7 @@ void do_down(bool scroll_only)
set_proper_index_and_pww(&leftedge, target_column, TRUE);
if (scroll_only)
- edit_scroll(DOWNWARD, 1);
+ edit_scroll(FORWARD, 1);
edit_redraw(was_current, FLOWING);
diff --git a/src/nano.h b/src/nano.h
@@ -132,6 +132,9 @@
#define DISABLE_WRAPJUSTIFY 1
#endif
+#define BACKWARD FALSE
+#define FORWARD TRUE
+
/* Enumeration types. */
typedef enum {
NIX_FILE, DOS_FILE, MAC_FILE
@@ -150,10 +153,6 @@ typedef enum {
} mark_type;
typedef enum {
- UPWARD, DOWNWARD
-} scroll_dir;
-
-typedef enum {
CENTERING, FLOWING, STATIONARY
} update_type;
diff --git a/src/proto.h b/src/proto.h
@@ -663,7 +663,7 @@ bool line_needs_update(const size_t old_column, const size_t new_column);
int go_back_chunks(int nrows, filestruct **line, size_t *leftedge);
int go_forward_chunks(int nrows, filestruct **line, size_t *leftedge);
bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge);
-void edit_scroll(scroll_dir direction, int nrows);
+void edit_scroll(bool direction, int nrows);
#ifndef NANO_TINY
size_t get_softwrap_breakpoint(const char *text, size_t leftedge,
bool *end_of_line);
diff --git a/src/winio.c b/src/winio.c
@@ -2902,7 +2902,7 @@ bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge)
/* Scroll the edit window in the given direction and the given number of rows,
* and draw new lines on the blank lines left after the scrolling. */
-void edit_scroll(scroll_dir direction, int nrows)
+void edit_scroll(bool direction, int nrows)
{
filestruct *line;
size_t leftedge;
@@ -2912,7 +2912,7 @@ void edit_scroll(scroll_dir direction, int nrows)
/* Move the top line of the edit window the requested number of rows up or
* down, and reduce the number of rows with the amount we couldn't move. */
- if (direction == UPWARD)
+ if (direction == BACKWARD)
nrows -= go_back_chunks(nrows, &openfile->edittop, &openfile->firstcolumn);
else
nrows -= go_forward_chunks(nrows, &openfile->edittop, &openfile->firstcolumn);
@@ -2935,7 +2935,7 @@ void edit_scroll(scroll_dir direction, int nrows)
/* Scroll the text of the edit window a number of rows up or down. */
scrollok(edit, TRUE);
- wscrl(edit, (direction == UPWARD) ? -nrows : nrows);
+ wscrl(edit, (direction == BACKWARD) ? -nrows : nrows);
scrollok(edit, FALSE);
/* Part 2: nrows is now the number of rows in the scrolled region of the
@@ -2951,7 +2951,7 @@ void edit_scroll(scroll_dir direction, int nrows)
leftedge = openfile->firstcolumn;
/* If we scrolled forward, move down to the start of the blank region. */
- if (direction == DOWNWARD)
+ if (direction == FORWARD)
go_forward_chunks(editwinrows - nrows, &line, &leftedge);
#ifndef NANO_TINY