nano-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] show active TAB-setting in state flags in titlebar and minib


From: Benno Schulenberg
Subject: Re: [PATCH] show active TAB-setting in state flags in titlebar and minibar
Date: Fri, 8 Jan 2021 19:32:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Op 08-01-2021 om 01:12 schreef ObeliX:
> patch 0001: display TAB-setting in state flags
> patch 0002: patch 0001 + code optimizations in minibar()

Huh?  Normally when having a 0001 and a 0002 patch, the 0002 patch
gets applied after 0001 is applied.  Never fold mere code fiddlings
into a functional change.

> the minibar optimizations do not change any functionality or the layout.
> aside from minor changes regarding variables scope, early bail out and
> if-nesting, the main goal was to improve readability or more exactly to
> allow an easier understanding of minibars layout concept.
> the hard-coded numbers obscure the layout calculation of the different
> info fields and make it really hard to figure out which and how numbers
> must be adjusted, when modifications to fields are made

I know that the minibar code is a bit of mess, but it's not even released
yet, there are probably going to be some changes later on.  And, there are
two patches waiting to be merged tomorrow, for the zero-width codes.

> Subject: [PATCH] added: show active TAB-setting in state flags
> 
>  FLAG  TAB-key inserts
>  ----- ---------------
>  none  \t
>   's'  spaces according 'tabstospaces'
>   'g'  'tabgives'-string from syntax file
> 
> - TAB-mode toggle is deactivated when 'tabgives' is active

This latter thing should be a separate patch: it is not needed to add the
tab flag to the state flags.

> - minibar also displays new state flags

Of course; no need to mention that.


>  void show_states_at(WINDOW *window)
>  {
> -     waddstr(window, ISSET(AUTOINDENT) ? "I" : " ");
> -     waddstr(window, openfile->mark ? "M" : " ");
> -     waddstr(window, ISSET(BREAK_LONG_LINES) ? "L" : " ");
> -     waddstr(window, recording ? "R" : " ");
> -     waddstr(window, ISSET(SOFTWRAP) ? "S" : " ");
> +     char state[] = FLAG_STRING;                       // IsMLRS
> +
> +     const char CLR = ' ';
> +
> +     [...]

Ouch...

When providing a patch to add or change something, make the *minimum*
amount of changes needed to achieve what you want.  Do *not* change
anything that does not need to be changed.

After I have accepted the change, then you can propose a patch to
improve the code.  (Although it is unlikely to be accepted.)

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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