tweaks: use a boolean instead of an enumeration of two values
parent
208146f2f2
commit
96e4fec31c
|
@ -257,10 +257,6 @@ typedef enum {
|
||||||
OVERWRITE, APPEND, PREPEND
|
OVERWRITE, APPEND, PREPEND
|
||||||
} kind_of_writing_type;
|
} kind_of_writing_type;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
SOFTMARK, HARDMARK
|
|
||||||
} mark_type;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CENTERING, FLOWING, STATIONARY
|
CENTERING, FLOWING, STATIONARY
|
||||||
} update_type;
|
} update_type;
|
||||||
|
@ -547,8 +543,8 @@ typedef struct openfilestruct {
|
||||||
/* The line in the file where the mark is set; NULL if not set. */
|
/* The line in the file where the mark is set; NULL if not set. */
|
||||||
size_t mark_x;
|
size_t mark_x;
|
||||||
/* The mark's x position in the above line. */
|
/* The mark's x position in the above line. */
|
||||||
mark_type kind_of_mark;
|
bool softmark;
|
||||||
/* Whether it is a soft (with Shift) or a hard mark. */
|
/* Whether a marked region was made by holding Shift. */
|
||||||
format_type fmt;
|
format_type fmt;
|
||||||
/* The file's format -- Unix or DOS or Mac. */
|
/* The file's format -- Unix or DOS or Mac. */
|
||||||
char *lock_filename;
|
char *lock_filename;
|
||||||
|
|
|
@ -81,6 +81,7 @@ void make_new_buffer(void)
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
openfile->mark = NULL;
|
openfile->mark = NULL;
|
||||||
|
openfile->softmark = FALSE;
|
||||||
|
|
||||||
openfile->fmt = NIX_FILE;
|
openfile->fmt = NIX_FILE;
|
||||||
|
|
||||||
|
|
|
@ -1528,7 +1528,7 @@ void process_a_keystroke(void)
|
||||||
print_view_warning();
|
print_view_warning();
|
||||||
else {
|
else {
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (openfile->mark && openfile->kind_of_mark == SOFTMARK) {
|
if (openfile->mark && openfile->softmark) {
|
||||||
openfile->mark = NULL;
|
openfile->mark = NULL;
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1602,7 +1602,7 @@ void process_a_keystroke(void)
|
||||||
if (shift_held && !openfile->mark) {
|
if (shift_held && !openfile->mark) {
|
||||||
openfile->mark = openfile->current;
|
openfile->mark = openfile->current;
|
||||||
openfile->mark_x = openfile->current_x;
|
openfile->mark_x = openfile->current_x;
|
||||||
openfile->kind_of_mark = SOFTMARK;
|
openfile->softmark = TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1614,7 +1614,7 @@ void process_a_keystroke(void)
|
||||||
* discard a soft mark. And when the marked region covers a
|
* discard a soft mark. And when the marked region covers a
|
||||||
* different set of lines, reset the "last line too" flag. */
|
* different set of lines, reset the "last line too" flag. */
|
||||||
if (openfile->mark) {
|
if (openfile->mark) {
|
||||||
if (!shift_held && openfile->kind_of_mark == SOFTMARK &&
|
if (!shift_held && openfile->softmark &&
|
||||||
(openfile->current != was_current ||
|
(openfile->current != was_current ||
|
||||||
openfile->current_x != was_x ||
|
openfile->current_x != was_x ||
|
||||||
wanted_to_move(shortcut->func))) {
|
wanted_to_move(shortcut->func))) {
|
||||||
|
|
|
@ -50,8 +50,8 @@ void do_mark(void)
|
||||||
if (!openfile->mark) {
|
if (!openfile->mark) {
|
||||||
openfile->mark = openfile->current;
|
openfile->mark = openfile->current;
|
||||||
openfile->mark_x = openfile->current_x;
|
openfile->mark_x = openfile->current_x;
|
||||||
|
openfile->softmark = FALSE;
|
||||||
statusbar(_("Mark Set"));
|
statusbar(_("Mark Set"));
|
||||||
openfile->kind_of_mark = HARDMARK;
|
|
||||||
} else {
|
} else {
|
||||||
openfile->mark = NULL;
|
openfile->mark = NULL;
|
||||||
statusbar(_("Mark Unset"));
|
statusbar(_("Mark Unset"));
|
||||||
|
|
Loading…
Reference in New Issue