tweaks: use mnemonic constants instead of TRUE and FALSE

And use these constants in another context too.
master
Benno Schulenberg 2017-08-31 22:14:06 +02:00
parent 98ec41b4fa
commit 21ffa883f7
5 changed files with 14 additions and 15 deletions

View File

@ -639,16 +639,16 @@ void switch_to_adjacent_buffer(bool to_next)
#endif #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) 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) 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 /* Delete an entry from the circular list of open files, and switch to the

View File

@ -502,7 +502,7 @@ void do_up(bool scroll_only)
set_proper_index_and_pww(&leftedge, target_column, FALSE); set_proper_index_and_pww(&leftedge, target_column, FALSE);
if (scroll_only) if (scroll_only)
edit_scroll(UPWARD, 1); edit_scroll(BACKWARD, 1);
edit_redraw(was_current, FLOWING); edit_redraw(was_current, FLOWING);
@ -526,7 +526,7 @@ void do_down(bool scroll_only)
set_proper_index_and_pww(&leftedge, target_column, TRUE); set_proper_index_and_pww(&leftedge, target_column, TRUE);
if (scroll_only) if (scroll_only)
edit_scroll(DOWNWARD, 1); edit_scroll(FORWARD, 1);
edit_redraw(was_current, FLOWING); edit_redraw(was_current, FLOWING);

View File

@ -132,6 +132,9 @@
#define DISABLE_WRAPJUSTIFY 1 #define DISABLE_WRAPJUSTIFY 1
#endif #endif
#define BACKWARD FALSE
#define FORWARD TRUE
/* Enumeration types. */ /* Enumeration types. */
typedef enum { typedef enum {
NIX_FILE, DOS_FILE, MAC_FILE NIX_FILE, DOS_FILE, MAC_FILE
@ -149,10 +152,6 @@ typedef enum {
SOFTMARK, HARDMARK SOFTMARK, HARDMARK
} mark_type; } mark_type;
typedef enum {
UPWARD, DOWNWARD
} scroll_dir;
typedef enum { typedef enum {
CENTERING, FLOWING, STATIONARY CENTERING, FLOWING, STATIONARY
} update_type; } update_type;

View File

@ -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_back_chunks(int nrows, filestruct **line, size_t *leftedge);
int go_forward_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); 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 #ifndef NANO_TINY
size_t get_softwrap_breakpoint(const char *text, size_t leftedge, size_t get_softwrap_breakpoint(const char *text, size_t leftedge,
bool *end_of_line); bool *end_of_line);

View File

@ -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, /* 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. */ * 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; filestruct *line;
size_t leftedge; 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 /* 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. */ * 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); nrows -= go_back_chunks(nrows, &openfile->edittop, &openfile->firstcolumn);
else else
nrows -= go_forward_chunks(nrows, &openfile->edittop, &openfile->firstcolumn); 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. */ /* Scroll the text of the edit window a number of rows up or down. */
scrollok(edit, TRUE); scrollok(edit, TRUE);
wscrl(edit, (direction == UPWARD) ? -nrows : nrows); wscrl(edit, (direction == BACKWARD) ? -nrows : nrows);
scrollok(edit, FALSE); scrollok(edit, FALSE);
/* Part 2: nrows is now the number of rows in the scrolled region of the /* 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; leftedge = openfile->firstcolumn;
/* If we scrolled forward, move down to the start of the blank region. */ /* 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); go_forward_chunks(editwinrows - nrows, &line, &leftedge);
#ifndef NANO_TINY #ifndef NANO_TINY