patchGNU nano - Patches: patch #9465, tweaks: fix missing parentheses...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #9465: tweaks: fix missing parentheses around ISSET macro

Submitter:  David Lawrence Ramsey <dolorous>
Submitted:  Sun 15 Oct 2017 07:41:22 PM UTC
   
 
Priority:  3 - Low Status:  Done
Privacy:  Public Assigned to:  dolorous
Open/Closed:  Closed Release:  None

Thu 19 Oct 2017 07:40:42 PM UTC, comment #5: 

Last version of the patch has been pushed, f8c75c43.  Thanks.

Benno Schulenberg <bens>
Group administrator
Tue 17 Oct 2017 11:22:17 PM UTC, comment #4: 

Further addendum: the attached patch should be better.

(After some more thought, since ^W file browser search always goes forward with no way to toggle that, M-W file browser "search again" should always go forward as well.  This means that there should be no changes to the file browser, or anywhere outside search.c, so this version contains the minimal changes required.)

(file #42187)

David Lawrence Ramsey <dolorous>
Group Member
Mon 16 Oct 2017 08:19:26 PM UTC, comment #3: 

Addendum: would the patch to do what you want be something like the attached (which also works for file browser searches)?  It's against git 58ecc03.

(file #42172)

David Lawrence Ramsey <dolorous>
Group Member
Mon 16 Oct 2017 07:49:46 PM UTC, comment #2: 

No problem.

So, if I understand you correctly, you'd change things so that:

1. Alt-Up always searches backwards.

2. Alt-Down always searches forwards.

3. Meta-W always searches in whatever direction the previous search was in (which is forwards if there is no last search).

If that's what you mean, that sounds good to me, since "Search Again" doesn't imply a direction anyway, and the new way is clearer.

David Lawrence Ramsey <dolorous>
Group Member
Mon 16 Oct 2017 06:02:15 PM UTC, comment #1: 

Thanks for noticing this.

However... I think those ifs have become superfluous.  Because I think the user would use either M-W (searchagain) or Alt+Up/Alt+Down (findprevious/findnext), or self-made bindings for the latter.  They will either have a mindset that toggles the search direction and then uses M-W always, or they don't want to remember any state and use findprev/findnext always.  In either case it is okay that do_findprevious() and do_findnext() do not remember and restore the setting of BACKWARDS_SEARCH -- they can just set it to what is needed and be done with it, just like do_search_forward() and do_search_backward().  And even if there are users that mix the usage of Alt+Up/Alt+Down with M-W, I don't think its strange that M-W goes in the same direction as the last used Alt+Up/Down keys.  Yes, it will be a change in behavior from since findprevious and findnext were made, but... I think it will be better: no funky state: M-W will always search in the direction that was last used.  What do you think?

Benno Schulenberg <bens>
Group administrator
Sun 15 Oct 2017 07:41:22 PM UTC, original submission:  

do_findprevious() and do_findnext() both contain the if statement

if ISSET(BACKWARDS_SEARCH)

While this does work, because the ISSET macro is defined to be surrounded by parentheses anyway, it will break if the definition changes to not do so.

Furthermore, this means that searching for "if (ISSET(" will find all if statements containing the ISSET macro except for these two, which I think is more of a problem (even if the change is effectively cosmetic).

The attached patch, against git 501d05c, changes these to

if (ISSET(BACKWARDS_SEARCH))

to match the rest of the code.

David Lawrence Ramsey <dolorous>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by dolorous (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-11-19 bens Open/ClosedOpen Closed
    2017-10-19 bens StatusNone Done
        Assigned toNone dolorous
    2017-10-17 dolorous Attached File- Added 0001-search-make-Search-Again-always-use-the-previous-sea.patch, #42187
    2017-10-16 dolorous Attached File- Added 0001-search-make-Search-Again-always-use-the-previous-sea.patch, #42172
    2017-10-16 bens Priority5 - Normal 3 - Low
    2017-10-15 dolorous Attached File- Added 0001-tweaks-fix-missing-parentheses-around-ISSET-macro.patch, #42161

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code