<<< Date Index >>>     <<< Thread Index >>>

Re: Listing patterns in the help screen



On Tue, Mar 15, 2005 at 01:31:24PM +0900, Tamotsu Takahashi wrote:
> On Mon, Mar 14, 2005 at 04:32:36AM +0100, Benjamin Pflugmann wrote:
> > While I am in the line editor that doesn't work (help doesn't either),
> > and that's when it's most useful to me. What about a patch that binds
> > the list of patterns to a key when you are typing in a limit, tag
> > match or similar (obviously binding it to '?' isn't a good idea).
> > 
> > That wouldn't make the usual help list any less useful, as it would
> > display a help where none was available before.
> 
> Good.
> Here is a beta-quality patch. (I modified the patch
> after the last time I built mutt, so this is untested.
> But this should apply and build, I think.)
> 
> Mutt will show you the list of patterns when you type <tab>
> (the <complete> function) after '~' on a pattern prompt
> (e.g. <search> or <limit>). You can choose one of them in
> the menu. It's very useful. Thanks for the idea!

A little improvement here:
--- enter.c     2005-03-14 23:27:49.000000000 +0900
+++ enter.c     2005-03-15 21:10:41.000000000 +0900
@@ -211,6 +211,7 @@
   {
     /* Coming back after return 1 */
     redraw = M_REDRAW_LINE;
+    first = 0;
   }
   else
   {
@@ -551,17 +552,14 @@
          }
          else if (flags & M_PATTERN)
          {
-           my_wcstombs (buf, buflen, state->wbuf, state->curpos);
-           i = strlen (buf);
-           if (i && buf[i - 1] == '~')
+           if ((i = state->curpos) && state->wbuf[i - 1] == '~')
            {
              if (mutt_ask_pattern (buf, buflen))
                replace_part (state, i, buf);
              rv = 1;
              goto bye;
            }
-           else
-             goto self_insert;
+           goto self_insert;
          }
          else
            goto self_insert;