Subject: [sup-talk] new in svn: in-buffer search

From: [email-masked] (William Morgan)
Date: Tue, 06 Nov 2007 14:41:37 -0800

Thanks to Eyal Oren, who took a first crack at a patch and got me
excited, SVN head now has in-buffer search.

First, note that I've remapped the index search from '/' to '\'. Hah!

'/' now does an in-buffer search, highlights the results, and jumps to
the first one. 'n' jumps to the next result; ^G or any other key cancels
the current search.

Also note that the search is restricted to exactly what you see on the
screen. Collapsed messages in thread-view-mode, etc must be uncollapsed
in order to be in-buffer search candidates. Maybe there will be fancier
behavior in the future.

Future plans: regex search (very easy to do now), and use the
highlighting code to make search-results-mode nicer.

-- 
William <wmorgan-sup at masanjin.net>

---

From: [email-masked] (Ian Taylor)
Date: Tue, 06 Nov 2007 17:57:25 -0500

> highlighting code to make search-results-mode nicer.

Not sure if this was introduced as a result of this patch, but '?' in
the first view seems to crash sup with this error:

The problem was: 'unknown key name "ctrl_g"' (error type ArgumentError)
A backtrace follows:
/var/lib/gems/1.8/gems/sup-0.2/lib/sup/keymap.rb:54:in `keysym_to_string': unknown key name "ctrl_g" (ArgumentError)
        from /var/lib/gems/1.8/gems/sup-0.2/lib/sup/keymap.rb:80:in `help_text'
        from /var/lib/gems/1.8/gems/sup-0.2/lib/sup/keymap.rb:80:in `map'
        from /var/lib/gems/1.8/gems/sup-0.2/lib/sup/keymap.rb:80:in `help_text'
        from /var/lib/gems/1.8/gems/sup-0.2/lib/sup/keymap.rb:77:in `map'
        from /var/lib/gems/1.8/gems/sup-0.2/lib/sup/keymap.rb:77:in `help_text'
        from /var/lib/gems/1.8/gems/sup-0.2/lib/sup/modes/help-mode.rb:13:in `initialize'
        from /var/lib/gems/1.8/gems/sup-0.2/bin/sup:217:in `new'
        from /var/lib/gems/1.8/gems/sup-0.2/bin/sup:217
        from /var/lib/gems/1.8/gems/sup-0.2/lib/sup/buffer.rb:262:in `spawn_unless_exists'
        from /var/lib/gems/1.8/gems/sup-0.2/bin/sup:217
        from /var/lib/gems/1.8/bin/sup:16:in `load'
        from /var/lib/gems/1.8/bin/sup:16

My guess is that the following changes need to be made in keymap.rb

     when :end: "<end>"
     when :enter, :return: "<enter>"
     when :ctrl_l: "ctrl-l"
-    when :ctrl_l: "ctrl-g"
+    when :ctrl_g: "ctrl-g"
     when :tab: "tab"
     when " ": "<space>"
     else

-- 
Ian Taylor

---

From: [email-masked] (William Morgan)
Date: Tue, 06 Nov 2007 16:18:41 -0800

> My guess is that the following changes need to be made in keymap.rb

Exactly. Thanks!

---

From: [email-masked] (Marcus Williams)
Date: Wed, 07 Nov 2007 08:53:35 +0000

> the first one. 'n' jumps to the next result; ^G or any other key cancels

This feels a bit wrong to me (might just be me though). I'd say that
searching for emails is the most used case for a search option in sup
so should have the '/', and searching in buffer should be something
different.

Better than that, make '/' mode dependant so you can use say ctrl-s to
search for emails (always), ctrl-f to search in buffer (always) but
map '/' to ctrl-s in thread-index mode (so that would be in inbox and
search results). In all other modes '/' could map to ctrl-f.

Any thoughts?

Marcus

---

From: [email-masked] (Eyal Oren)
Date: Wed, 07 Nov 2007 10:21:57 +0100

> search results). In all other modes '/' could map to ctrl-f.
Personally, I feel that '/' should search in buffer, as many other UNIX tools do 
(vi, mutt, less, etc). 

Btw, William, thanks for the search! It's great. But wouldn't you like to search 
from the top instead of searching from cursor position? I often want to use 
search instead of hitting cursor-up seven times.

-- 
 -eyal

---

From: [email-masked] (Marcus Williams)
Date: Wed, 07 Nov 2007 09:43:47 +0000

On 7.11.2007, Eyal Oren wrote:
> Personally, I feel that '/' should search in buffer, as many other
> UNIX tools do (vi, mutt, less, etc). 

I agree with you, but I dont think it makes sense in the inbox or
thread index views which is why I suggested having it mode dependant.
Maybe that would just confuse though.

That aside I like it :)

Marcus

---

From: [email-masked] (Marcus Williams)
Date: Wed, 07 Nov 2007 09:53:16 +0000

On 7.11.2007, Eyal Oren wrote:
> Btw, William, thanks for the search! It's great. But wouldn't you
> like to search from the top instead of searching from cursor
> position? I often want to use search instead of hitting cursor-up
> seven times.

Forgot to add - you can just hit '1' to move your cursor to the top of
the buffer if that helps.

Marcus

---

From: [email-masked] (vasudeva)
Date: Wed, 7 Nov 2007 09:25:27 -0500

> search results). In all other modes '/' could map to ctrl-f.

For purposes of migration from existing tools, and conforming to
established UNIX conventions, I like keeping / as buffer search (per
the 'screen search' CLI norm) and \ as ferret-index search (somewhat
unusual functionality in terms of CLI app search conventions, thus
deserving of a lower-priority keybinding). 

That said, I think mode-dependency could be a neat resolve. 

/></

--
linkswarm.com :: Collaborative Insolence
vasudeva.linkswarm.com/gallery :: For The Faint of Heart

---

From: [email-masked] (William Morgan)
Date: Wed, 07 Nov 2007 12:41:46 -0800

> deserving of a lower-priority keybinding). 

This was pretty much my thinking. Anyone else want to weight in?  (I'll
admit I'm having to retrain myself to use the new keybindings, which is
mildly irritating.)

---

From: [email-masked] (Marcus Williams)
Date: Wed, 07 Nov 2007 21:05:58 +0000

> admit I'm having to retrain myself to use the new keybindings, which is

Retraining is one thing, the other is that the '\' is in different
places on all the keyboards I use! I'm sure I'll get over it though :)

Two things - can we make the prompts different to make it more obvious
and make a blank search not do anything?

Marcus

---

From: [email-masked] (Colin Bell)
Date: Thu, 08 Nov 2007 08:56:21 +1100

> admit I'm having to retrain myself to use the new keybindings, which is

You could replace \ with F for Filter or Ferret-index search if the \
character is too annoying. My first thought was to borrow L for Limit
from mutt but that doesn't work too well with labels :-)

---

From: [email-masked] (William Morgan)
Date: Sun, 11 Nov 2007 16:02:16 -0800

> from mutt but that doesn't work too well with labels :-)

I'm actually quite liking \ now that I've gotten used to it. I'll add F.
If you're tired of being bound by my capricious whims, patches to make
keybindings configurable are welcome!

---

From: [email-masked] (William Morgan)
Date: Sun, 11 Nov 2007 16:11:58 -0800

> and make a blank search not do anything?

Done!

---

From: [email-masked] (William Morgan)
Date: Sun, 11 Nov 2007 16:13:43 -0800

Excerpts from Eyal Oren's message of Wed Nov 07 01:21:57 -0800 2007:
> Btw, William, thanks for the search! It's great. But wouldn't you like
> to search from the top instead of searching from cursor position? I
> often want to use search instead of hitting cursor-up seven times.

I'm following vi, emacs, and less precedent here. You can hit 1 or Home
to jump up to the top. (Maybe that should be 0.)

---

From: [email-masked] (Christopher Warrington)
Date: Sun, 11 Nov 2007 18:33:19 -0600

> keybindings configurable are welcome!

The "Refine Search" keybinding probably needs to be re-adjusted.
Currently, it is '.', which is right next to / on a normal QWERTY
keyboard.

Right now, ']' is unbound and next to '\' on typical QWERTY keyboards.

-- 
Christopher Warrington <chrisw at rice.edu>