[Top][All Lists]

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

Regression in history search in VI mode?

From: Uwe Doering
Subject: Regression in history search in VI mode?
Date: Fri, 21 Sep 2007 17:04:18 +0200
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv: Gecko/20070804 SeaMonkey/1.1.4

Hi there,

I found what I think is a regression in Bash 3.2PL25 vs. 3.1PL17. In VI mode, when I press ESC and '/' (or ESC and '?') in insert mode Bash is supposed to switch to command mode and enter the history search function. This works well if there is a pause between ESC and the next key. However, if I hit the keys in quick succession I get a beep instead of the expected '/' or '?' at the start of the history search input line. When I enter '/' or '?' again at this point it does what I want.

So obviously Bash enters command mode but then doesn't accept the next key right away. Interestingly this doesn't happen with most (any?) other command characters. There, entering them right after ESC works, as far as I can tell.

What's even stranger is that after a while, under circumstances that aren't clear to me, a quickly entered sequence of ESC and '/' ends up in a mode as if I entered the 'n' or 'N' key in command mode (find previous or next matching history line). Only if I enter '/' or '?' again at this point I get the blank search input line I anticipated. This seems to be a variant of the initial wrong behavior.

Finally, I found kind of a fix. However, it works only for the current shell session and has to be repeated in each new shell. So it's rather a workaround than a fix. In a freshly started Bash in VI mode, if I enter

ESC 'D' 'a'

the key sequence discussed above suddenly works as expected. Apparently the 'D' command (delete chars up to the end of the line) has a side effect that makes things work. To me this looks suspiciously like some data structure that doesn't get properly initialized at shell start-up. But then, I don't have much insight into Bash's internals.

This version of Bash has been built on FreeBSD 4.11 via the FreeBSD Ports Repository. The only customization was the '--disable-nls' configure argument which makes Bash work even in the early boot phase when it otherwise wouldn't find the NLS shared lib. Apart from that, there are no custom key bindings, and the readline variables as per 'bind -v' are as follows:

set bind-tty-special-chars on
set blink-matching-paren on
set byte-oriented on
set completion-ignore-case off
set convert-meta off
set disable-completion off
set enable-keypad off
set expand-tilde off
set history-preserve-point off
set horizontal-scroll-mode off
set input-meta on
set mark-directories on
set mark-modified-lines off
set mark-symlinked-directories off
set match-hidden-files on
set meta-flag on
set output-meta on
set page-completions on
set prefer-visible-bell on
set print-completions-horizontally off
set show-all-if-ambiguous off
set show-all-if-unmodified off
set visible-stats off
set bell-style audible
set comment-begin #
set completion-query-items 100
set editing-mode vi
set keymap vi-insert

That's about all details I have right now. So let's hope that this is reproducible by the Bash maintainers and can eventually be fixed. At least for me that new behavior is quite a nuisance.


Uwe Doering         |  EscapeBox - Managed On-Demand UNIX Servers
address@hidden  |  http://www.escapebox.net

reply via email to

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