[2697] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

Re: [PATCH] If popless:start-search is passed "", continue search

daemon@ATHENA.MIT.EDU (David A Benjamin)
Sat Oct 2 21:30:47 2010

Date: Sat, 2 Oct 2010 21:30:44 -0400 (EDT)
From: David A Benjamin <davidben@MIT.EDU>
To: Nelson Elhage <nelhage@mit.edu>
cc: barnowl-dev@mit.edu
In-Reply-To: <87tyl4la5d.fsf@mit.edu>

Er, well there's a separate popless:search. This one is more akin to 
start-command so that search can work with a locktext of '/' or '?' 
(perhaps that should be an argument to popless:start-search and specified 
in the keybinding...) and without needing to expose popless:start-command 
to avoid context nuisances.

Probably would be nice if the callback tunneled into popless:search, but 
the interface to that function is unfortunate with the funny bypassing of 
normal tokenization. Notably search strings that begin with spaces or -r. 
(This actually rather annoys me; I would not be opposed to search and 
popless:search following the usual convention and binding / and ? to a 
similar start-search.)

Didn't notice the mistake in the documentation. I'll push a change with 
that and a SEE ALSO.

David

On Sat, 2 Oct 2010, Nelson Elhage wrote:

> lgtm. Should we maybe rename the function popless:search for
> parallelism?
>
> (In fact, it looks like the "usage" line for popless:start-search
> already thinks it's called popless:search).
>
> - Nelson
>
> On Thu, 30 Sep 2010 20:24:19 -0400, David Benjamin <davidben@MIT.EDU> wrote:
>> Matches behavior with pressing / RET in both the recwin and less itself.
>>
>> Reported-By: Anders Kaseorg <andersk@mit.edu>
>> ---
>>  viewwin.c |   10 ++++++++--
>>  1 files changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/viewwin.c b/viewwin.c
>> index 4a97c74..32effdb 100644
>> --- a/viewwin.c
>> +++ b/viewwin.c
>> @@ -172,11 +172,17 @@ typedef struct _owl_viewwin_search_data { /*noproto*/
>>
>>  static void owl_viewwin_callback_search(owl_editwin *e)
>>  {
>> +  int consider_current = false;
>>    const char *line = owl_editwin_get_text(e);
>>    owl_viewwin_search_data *data = owl_editwin_get_cbdata(e);
>> -  owl_function_set_search(line);
>> +
>> +  /* Given an empty string, just continue the current search. */
>> +  if (line && *line) {
>> +    owl_function_set_search(line);
>> +    consider_current = true;
>> +  }
>>    if (!owl_viewwin_search(data->v, owl_global_get_search_re(&g),
>> -			  true, data->direction))
>> +                          consider_current, data->direction))
>>      owl_function_error("No matches");
>>  }
>>
>> --
>> 1.7.3.1.g716de
>>
>>
>

home help back first fref pref prev next nref lref last post