commit 96e4fec31cc92fad6a8415223fb836a58a1e7913
parent 208146f2f285f08154bfa0db80b31be7109f1a99
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 19 Dec 2020 16:40:21 +0100
tweaks: use a boolean instead of an enumeration of two values
Diffstat:
4 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/src/definitions.h b/src/definitions.h
@@ -258,10 +258,6 @@ typedef enum {
} kind_of_writing_type;
typedef enum {
- SOFTMARK, HARDMARK
-} mark_type;
-
-typedef enum {
CENTERING, FLOWING, STATIONARY
} update_type;
@@ -547,8 +543,8 @@ typedef struct openfilestruct {
/* The line in the file where the mark is set; NULL if not set. */
size_t mark_x;
/* The mark's x position in the above line. */
- mark_type kind_of_mark;
- /* Whether it is a soft (with Shift) or a hard mark. */
+ bool softmark;
+ /* Whether a marked region was made by holding Shift. */
format_type fmt;
/* The file's format -- Unix or DOS or Mac. */
char *lock_filename;
diff --git a/src/files.c b/src/files.c
@@ -81,6 +81,7 @@ void make_new_buffer(void)
#endif
#ifndef NANO_TINY
openfile->mark = NULL;
+ openfile->softmark = FALSE;
openfile->fmt = NIX_FILE;
diff --git a/src/nano.c b/src/nano.c
@@ -1528,7 +1528,7 @@ void process_a_keystroke(void)
print_view_warning();
else {
#ifndef NANO_TINY
- if (openfile->mark && openfile->kind_of_mark == SOFTMARK) {
+ if (openfile->mark && openfile->softmark) {
openfile->mark = NULL;
refresh_needed = TRUE;
}
@@ -1602,7 +1602,7 @@ void process_a_keystroke(void)
if (shift_held && !openfile->mark) {
openfile->mark = openfile->current;
openfile->mark_x = openfile->current_x;
- openfile->kind_of_mark = SOFTMARK;
+ openfile->softmark = TRUE;
}
#endif
@@ -1614,7 +1614,7 @@ void process_a_keystroke(void)
* discard a soft mark. And when the marked region covers a
* different set of lines, reset the "last line too" flag. */
if (openfile->mark) {
- if (!shift_held && openfile->kind_of_mark == SOFTMARK &&
+ if (!shift_held && openfile->softmark &&
(openfile->current != was_current ||
openfile->current_x != was_x ||
wanted_to_move(shortcut->func))) {
diff --git a/src/text.c b/src/text.c
@@ -50,8 +50,8 @@ void do_mark(void)
if (!openfile->mark) {
openfile->mark = openfile->current;
openfile->mark_x = openfile->current_x;
+ openfile->softmark = FALSE;
statusbar(_("Mark Set"));
- openfile->kind_of_mark = HARDMARK;
} else {
openfile->mark = NULL;
statusbar(_("Mark Unset"));