bug-bash
[Top][All Lists]
Advanced

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

Negative or zero arguments to yank-last-arg in bound keystrokes


From: Dennis Williamson
Subject: Negative or zero arguments to yank-last-arg in bound keystrokes
Date: Mon, 8 Nov 2010 17:26:57 -0600

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale'
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include
-I./lib   -g -O2
uname output: Linux hostname 2.6.31-21-generic #59-Ubuntu SMP Wed Mar
24 07:28:56 UTC 2010 i686 GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 4.1
Patch Level: 9
Release Status: release

Description:

Negative or zero arguments to yank-last-arg in bound keystrokes do not perform
as expected when the keystroke is pressed repeatedly.

Comparing to yank-last-arg with no arguments or positive arguments which step
backwards successively through history entries, when the argument is zero or
negative, repeated keypresses only alternate between the two previous history
entries.

Also present in:

GNU bash, version 4.1.0(1)-release (i686-pc-linux-gnu)
GNU bash, version 4.0.33(1)-release (i486-pc-linux-gnu)
GNU bash, version 3.2.51(24)-release (i686-pc-cygwin)

Repeat-By:

Create these keystroke bindings using whatever keystrokes you like. The demo
below will use Alt-h, Alt-i, Alt-j, Alt-k and Alt-m:

  bind '"\eh": "\e1\e."'
  bind '"\ei": "\e0\e."'
  bind '"\ej": "\e-\e."'
  bind '"\ek": "\e-1\e."'
  bind '"\em": "\e-2\e."'

Enter four example commands for testing. It doesn't matter what they are as
long as they are different commands and have a few arguments that differ so
it's easy to see the demonstration.

  printf '%s\n' foo bar
  echo aaa bbb ccc
  ls -ld . ..
  getent passwd root sys

Press Alt-h four times, you should correctly get "passwd", "-ld", "aaa"
and "'%s\n'" in succession. Clear the line (Ctrl-u).

Alt-. also correctly gives "sys", "..", "ccc" and "bar". (Ctrl-u to clear)

Now try the same thing with each of the other keystrokes, clearing the line
between each test.

Alt-i: Instead of "getent", "ls", "echo" and "printf" you will see "getent",
"getent", "ls" and "getent". Subsequent repetitions will alternate between
"ls" and "getent".

Alt-j: Instead of "root", ".", "bbb" and "foo" you will see "root",
"root", "." and "root". Subsequent repetitions will alternate between
"." and "root".

Alt-k: Same behavior as Alt-j.

Alt-m: Instead of "passwd", "-ld", "aaa" and "'%s\n'" you will see "passwd",
"passwd", "-ld" and "passwd". Subsequent repetitions will alternate between
"-ld" and "passwd".

Other negative arguments behave similarly.



reply via email to

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