nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] options: add --minibar and -_ to activate the basic stat


From: pepa65
Subject: Re: [PATCH 2/2] options: add --minibar and -_ to activate the basic state-information bar
Date: Sun, 16 Aug 2020 16:29:22 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Sorry for the noise... It occurred to me that the patches have to be
applied in order, which worked.

Peter


On 16/08/2020 16.03, Benno Schulenberg wrote:
> ---
>  src/definitions.h |  5 ++---
>  src/nano.c        | 13 +++++++++----
>  src/rcfile.c      |  1 +
>  3 files changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/src/definitions.h b/src/definitions.h
> index d3a3c4d7..8b2f431f 100644
> --- a/src/definitions.h
> +++ b/src/definitions.h
> @@ -124,8 +124,6 @@
>  #define ENABLED_WRAPORJUSTIFY  1
>  #endif
>  
> -#define MINIBAR  TRUE
> -
>  #define BACKWARD  FALSE
>  #define FORWARD  TRUE
>  
> @@ -546,7 +544,8 @@ enum
>       JUMPY_SCROLLING,
>       EMPTY_LINE,
>       INDICATOR,
> -     BOOKSTYLE
> +     BOOKSTYLE,
> +     MINIBAR
>  };
>  
>  /* Flags for the menus in which a given function should be present. */
> diff --git a/src/nano.c b/src/nano.c
> index 7645a490..43c3c088 100644
> --- a/src/nano.c
> +++ b/src/nano.c
> @@ -416,7 +416,7 @@ void window_init(void)
>               int toprows = (!ISSET(EMPTY_LINE) ? 1 : (LINES < 6) ? 1 : 2);
>               int bottomrows = (ISSET(NO_HELP) ? 1 : (LINES < 5) ? 1 : 3);
>  
> -             if (MINIBAR)
> +             if (ISSET(MINIBAR) && COLS > 48)
>                       toprows = 0;
>  
>               editwinrows = LINES - toprows - bottomrows;
> @@ -582,6 +582,7 @@ void usage(void)
>  #endif
>  #ifndef NANO_TINY
>       print_opt("-Z", "--zap", N_("Let Bsp and Del erase a marked region"));
> +     print_opt("-_", "--minibar", N_("Show bar at bottom with some state 
> info"));
>       print_opt("-a", "--atblanks", N_("When soft-wrapping, do it at 
> whitespace"));
>  #endif
>  #ifdef ENABLE_WRAPPING
> @@ -1118,7 +1119,7 @@ void do_toggle(int flag)
>       if (flag == NO_HELP || flag == NO_SYNTAX)
>               enabled = !enabled;
>  
> -     if (!MINIBAR || flag == SMART_HOME || flag == CUT_FROM_CURSOR ||
> +     if (!ISSET(MINIBAR) || flag == SMART_HOME || flag == CUT_FROM_CURSOR ||
>                               flag == TABS_TO_SPACES || flag == USE_MOUSE || 
> flag == SUSPENDABLE)
>               statusline(HUSH, "%s %s", _(flagtostr(flag)),
>                                               enabled ? _("enabled") : 
> _("disabled"));
> @@ -1759,6 +1760,7 @@ int main(int argc, char **argv)
>               {"wordbounds", 0, NULL, 'W'},
>               {"wordchars", 1, NULL, 'X'},
>               {"zap", 0, NULL, 'Z'},
> +             {"minibar", 0, NULL, '_'},
>               {"atblanks", 0, NULL, 'a'},
>               {"autoindent", 0, NULL, 'i'},
>               {"cutfromcursor", 0, NULL, 'k'},
> @@ -1820,7 +1822,7 @@ int main(int argc, char **argv)
>       if (*(tail(argv[0])) == 'r')
>               SET(RESTRICTED);
>  
> -     while ((optchr = getopt_long(argc, argv, 
> "ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Z"
> +     while ((optchr = getopt_long(argc, argv, 
> "ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Z_"
>                               "abcdef:ghijklmno:pqr:s:tuvwxyz$", 
> long_options, NULL)) != -1) {
>               switch (optchr) {
>  #ifndef NANO_TINY
> @@ -1941,6 +1943,9 @@ int main(int argc, char **argv)
>                       case 'Z':
>                               SET(LET_THEM_ZAP);
>                               break;
> +                     case '_':
> +                             SET(MINIBAR);
> +                             break;
>                       case 'a':
>                               SET(AT_BLANKS);
>                               break;
> @@ -2495,7 +2500,7 @@ int main(int argc, char **argv)
>               if (currmenu != MMAIN)
>                       bottombars(MMAIN);
>  
> -             if (MINIBAR && lastmessage == VACUUM)
> +             if (ISSET(MINIBAR) && COLS > 48 && lastmessage == VACUUM)
>                       minibar();
>               else
>               /* Update the displayed current cursor position only when there
> diff --git a/src/rcfile.c b/src/rcfile.c
> index d848f4d0..f34af57a 100644
> --- a/src/rcfile.c
> +++ b/src/rcfile.c
> @@ -109,6 +109,7 @@ static const rcoption rcopts[] = {
>       {"indicator", INDICATOR},
>       {"locking", LOCKING},
>       {"matchbrackets", 0},
> +     {"minibar", MINIBAR},
>       {"noconvert", NO_CONVERT},
>       {"showcursor", SHOW_CURSOR},
>       {"smarthome", SMART_HOME},
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]