nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] [PATCH] Implement incremental search


From: Marco Diego Aurélio Mesquita
Subject: Re: [Nano-devel] [PATCH] Implement incremental search
Date: Sat, 10 Feb 2018 12:25:24 -0200

On Fri, Feb 9, 2018 at 4:44 PM, Benno Schulenberg <address@hidden> wrote:
>
> The patch seems to work well.  Except for these things.
>
> 1) Run src/nano +1 NEWS, and type: ^W M-I unco <Enter> <Down>.
> The cursor should stay in the same column, but it jumps back
> to the left edge.
>
> 2) Run src/nano +1 NEWS, and type: ^W M-I but <Enter> ^W but
> The incremental search finds the occurrence at the cursor;
> I don't find that useful.  Gedit and Emacs work like that,
> but Vim doesn't.  I prefer the behavior of Vim in this case.
>
> 3) Run src/nano +1 NEWS and type: ^W but M-W <Enter>
> The M-W highlights the first occurrence after the starting
> position, the <Enter> jumps to the second occurrence.  The
> latter is unexpected, because normally, when something is
> highlighted, during incremental search, pressing <Enter>
> leaves the cursor at that place.  I think <Enter> should
> always leave the cursor at the highlighted spot.
>
> The upcoming patch corrects those three things, besides
> changing some other stuff.
>
> Op 08-02-18 om 03:49 schreef Marco Diego Aurélio Mesquita:
>>
>> +       bool didfind, was_full_circle = came_full_circle;
>
>
> Can you give an example where it is necessary that came_full_circle
> is restored to its previous value?
>

No I can't. This is a global var and I was just been cautious to not change it.


>> +       if (ISSET(USE_REGEXP))
>> +               regexp_cleanup();
>
>
> Is it not enough that the regex is cleaned up when the user
> exits from the search prompt?
>

I don't know. This was the result of my first fix regarding regexes.
It worked and I didn't tought about it anymore.


>> +               /* Handle some cases where we have to search again. */
>> +               if(ISSET(INCREMENTAL_SEARCH) && (func == case_sens_void ||
>> +
>> func == backwards_void ||
>> +
>> func == regexp_void    ||
>> +
>> func == inc_search_void)) {
>> +                       search_text(answer, SEARCH_FROM_START);
>> +               }
>
>
> Still not looking good.  A reworking patch (on top of yours)
> is coming up.
>
>> +       /* Unmark highlighted text. */
>> +       if (didfind && ISSET(INCREMENTAL_SEARCH))
>> +               highlight(FALSE, 0);
>
>
> A strange place to do this -- in go_looking().
>

This is probably just a leftover from previous iterations.


I tested your patch and could not run into any problem. So, if you
want, I suggest you to apply it.

A patch with both changes integrated and rebased to current master is attached.

Thank you.

Attachment: 0001-Implement-incremental-search.patch
Description: Text Data


reply via email to

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