[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] [PATCH] Implement incremental search
From: |
Brand Huntsman |
Subject: |
Re: [Nano-devel] [PATCH] Implement incremental search |
Date: |
Tue, 13 Feb 2018 17:30:32 -0700 |
On Tue, 13 Feb 2018 19:38:26 +0100
Benno Schulenberg <address@hidden> wrote:
> > On the " ", nano leaves "but" in the
> > same instance of "redistribution" highlighted, despite the fact
> > that "but " doesn't occur anywhere in the file (not expected, in
> > that the previous match is still highlighted).
>
> This is what I wanted. Vim jumps back to where to search started when
> you type something that cannot be found -- this is logically correct,
> but I don't like the jump without any other feedback that the search
> failed. Emacs leaves the last found thing highlighted as it was when
> you type something that cannot be found, just like nano now does with
> the patch, but it changes the prompt from "I-search" to "Failing
> I-search", and highlights the character(s) in the answer that cannot
> be matched, and beeps.
Leaving the last match highlighted is no different than displaying incorrect
information. And a single beep is not enough to indicate failure. I know the
match is not found if _nothing_ is highlighted.
Chromium and Firefox don't highlight previous matches when match isn't found.
Chromium's only indication is a "0/0", while Firefox beeps, turns prompt red
and displays "Phrase not found".
When a match isn't found:
- beep
- change prompt color (see below)
- display "NOT FOUND" in the prompt
- remove highlight from the last match
- don't jump to start until prompt is closed
An 'errorcolor' could be added to nano that not only changes the incremental
prompt color when a match isn't found, but _all_ error messages that currently
use statuscolor. If color is enabled and terminal supports color, it could
default to "bold,black,red", if not, just use "bold,reverse" instead of the
normal "reverse". This would be a huge improvement across nano, as it would
visually separate all the 'info' messages from actual 'error' messages.
> > As for whether I want this feature... I'm ambivalent.
>
> Yes, ambivalent, that's what I am too. It's a nice feature, but...
> unnecessary. This is something that I would hide behind a compile
> flag, --enable-extra.
[I haven't looked at the patch yet...]
I would never type ^I to enable it, but if it was always on then it might be
useful. Unless it immediately searches after every key press. I would never use
the feature without a ~250ms delay, nano would probably lag when typing fast or
pasting.