nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit f4d1ef1c4e9adc89891594de54218dd63e43b1d1
parent dd157f149421e57b635e50d7fc7480b1c3988a0f
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed, 21 Mar 2018 11:40:15 +0100

tweaks: remove unneeded settings and unsettings of MULTIBUFFER

In the preceding commit, open_buffer() was changed so that it gets
told whether to load into a new buffer or not, so it is no longer
needed to convey this information through a flag.

Diffstat:
Msrc/help.c | 1-
Msrc/nano.c | 21+++++++--------------
Msrc/text.c | 1-
3 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/src/help.c b/src/help.c @@ -142,7 +142,6 @@ void do_help(void) UNSET(WHITESPACE_DISPLAY); UNSET(NOREAD_MODE); - SET(MULTIBUFFER); #ifdef ENABLE_LINENUMBERS UNSET(LINE_NUMBERS); diff --git a/src/nano.c b/src/nano.c @@ -42,6 +42,12 @@ #include <sys/vt.h> #endif +#ifdef ENABLE_MULTIBUFFER +#define read_them_all TRUE +#else +#define read_them_all FALSE +#endif + #ifdef ENABLE_MOUSE static int oldinterval = -1; /* Used to store the user's original mouse click interval. */ @@ -1943,11 +1949,6 @@ int main(int argc, char **argv) bool forced_wrapping = FALSE; /* Should long lines be automatically hard wrapped? */ #endif -#ifdef ENABLE_MULTIBUFFER - bool is_multibuffer; - /* The actual value of the multibuffer option, restored after - * we've loaded all files given on the command line. */ -#endif const struct option long_options[] = { {"boldtext", 0, NULL, 'D'}, #ifdef ENABLE_MULTIBUFFER @@ -2595,13 +2596,8 @@ int main(int argc, char **argv) fprintf(stderr, "Main: open file\n"); #endif -#ifdef ENABLE_MULTIBUFFER - is_multibuffer = ISSET(MULTIBUFFER); - SET(MULTIBUFFER); -#endif - /* Read the files mentioned on the command line into new buffers. */ - while (optind < argc && (!openfile || ISSET(MULTIBUFFER))) { + while (optind < argc && (!openfile || read_them_all)) { ssize_t givenline = 0, givencol = 0; /* If there's a +LINE[,COLUMN] argument here, eat it up. */ @@ -2642,9 +2638,6 @@ int main(int argc, char **argv) #ifdef ENABLE_MULTIBUFFER else openfile = openfile->next; - - if (!is_multibuffer) - UNSET(MULTIBUFFER); #endif #ifdef DEBUG diff --git a/src/text.c b/src/text.c @@ -3225,7 +3225,6 @@ void do_linter(void) statusbar(_("Cancelled")); goto free_lints_and_return; } else if (i == 1) { - SET(MULTIBUFFER); open_buffer(curlint->filename, TRUE); } else { char *dontwantfile = mallocstrcpy(NULL, curlint->filename);