>Synopsis:      up/down-history is not working in ksh with set -o vi.
>Category:      system user
>Environment:
        System      : OpenBSD 5.2
        Details     : OpenBSD 5.2 (GENERIC) #278: Wed Aug  1 10:04:16 MDT
2012
                         [email protected]:
/usr/src/sys/arch/i386/compile/GENERIC

        Architecture: OpenBSD.i386
        Machine     : i386
>Description:
        If "set -o vi" is set in ksh you can not navigate in command-mode
with arrow-keys.
        If "set -o emacs" is set then arrow keys works and it also works in
vi itself and
        in bash from ports with "set -o vi".
        This has been the case with pdksh in every openbsd release at least
since 4.6. In
        fact, it is probable it never worked in pdksh and it is likely to
behave the same
        in other bsd's and linuxes with pdksh - I only tried it on Mac OS/X
but it does the
        same thing there with pdksh - the stock ksh in OS/X has the correct
behaviour.
>How-To-Repeat:
        $ set -o vi # in ksh
        $       # press <escape> to get into command-mode
        $     # if you use arrow keys you don't get anywhere... "hjkl" has
to be used.
>Fix:
        This is trivial to work around - either do "set -o emacs" or use
"hjkl" for
        navigation in command-mode. -Having said that it is an anomaly and
possibly an
        indication that something is not entirely right with how ksh
handles input in
        vi-mode. From what I can see, the code for handling different
keybindings is al-
        ready in there, but the character-sequence is not getting through
to ksh correctly.
        I doubt that code from vi would help very much, from what I
understand it uses
        curses. Taking from the emacs.c might not be an option either -
tedu@ commented
                "a glance at the code reveals emacs and vi modes are
                implemented totally separately. hurray!"
        -Maybe a glance at bash's vi-module would help, but my bet would be
that the code
        for handling the escape-sequences and keybindinings is already in
vi.c - it is just
        something that blocks the sequences. -Unfortunately I am not a
c-programmer and
        can only barely read c, writing or debugging a c-program is not
part of my core
        skill-set.


dmesg:
OpenBSD 5.2 (GENERIC) #278: Wed Aug  1 10:04:16 MDT 2012
    [email protected]:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel(R) Pentium(R) 4 CPU 2.40GHz ("GenuineIntel" 686-class) 2.40 GHz
cpu0:
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,CNXT-ID,xTPR
real mem  = 803225600 (766MB)
avail mem = 779243520 (743MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 12/02/03, BIOS32 rev. 0 @ 0xffe90,
SMBIOS rev. 2.3 @ 0xf0450 (60 entries)
bios0: vendor Dell Computer Corporation version "A05" date 12/02/2003
bios0: Dell Computer Corporation Dimension 2400
acpi0 at bios0: rev 0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP SSDT APIC BOOT
acpi0: wakeup devices VBTN(S4) PCI0(S3) USB0(S3) USB1(S3) USB2(S3) PCI1(S5)
PCI2(S5) MOU_(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 132MHz
ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 20, 24 pins
ioapic0: misconfigured as apic 0, remapped to apid 1
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (PCI1)
acpiprt2 at acpi0: bus -1 (PCI2)
acpicpu0 at acpi0
acpibtn0 at acpi0: VBTN
bios0: ROM list: 0xc0000/0xb800 0xcb800/0x1800! 0xcd000/0x3000
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel 82845G Host" rev 0x01
vga1 at pci0 dev 2 function 0 "Intel 82845G Video" rev 0x01
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
intagp0 at vga1
agp0 at intagp0: aperture at 0xf0000000, size 0x8000000
inteldrm0 at vga1: apic 1 int 16
drm0 at inteldrm0
uhci0 at pci0 dev 29 function 0 "Intel 82801DB USB" rev 0x01: apic 1 int 16
uhci1 at pci0 dev 29 function 1 "Intel 82801DB USB" rev 0x01: apic 1 int 19
uhci2 at pci0 dev 29 function 2 "Intel 82801DB USB" rev 0x01: apic 1 int 18
ehci0 at pci0 dev 29 function 7 "Intel 82801DB USB" rev 0x01: apic 1 int 23
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
ppb0 at pci0 dev 30 function 0 "Intel 82801BA Hub-to-PCI" rev 0x81
pci1 at ppb0 bus 1
re0 at pci1 dev 4 function 0 "Realtek 8169" rev 0x10: RTL8110S (0x0400),
apic 1 int 16, address 00:17:3f:99:ff:20
rgephy0 at re0 phy 7: RTL8169S/8110S PHY, rev. 0
re1 at pci1 dev 5 function 0 "Realtek 8169" rev 0x10: RTL8110S (0x0400),
apic 1 int 17, address 00:17:3f:9a:00:3c
rgephy1 at re1 phy 7: RTL8169S/8110S PHY, rev. 0
re2 at pci1 dev 6 function 0 "Realtek 8169" rev 0x10: RTL8110S (0x0400),
apic 1 int 18, address 00:17:3f:9b:d3:e3
rgephy2 at re2 phy 7: RTL8169S/8110S PHY, rev. 0
bce0 at pci1 dev 9 function 0 "Broadcom BCM4401" rev 0x01: apic 1 int 17,
address 00:0d:56:62:6b:7d
bmtphy0 at bce0 phy 1: BCM4401 10/100baseTX PHY, rev. 0
ichpcib0 at pci0 dev 31 function 0 "Intel 82801DB LPC" rev 0x01
pciide0 at pci0 dev 31 function 1 "Intel 82801DB IDE" rev 0x01: DMA,
channel 0 configured to compatibility, channel 1 configured to compatibility
wd0 at pciide0 channel 0 drive 0: <QUANTUM FIREBALLlct20 20>
wd0: 8-sector PIO, LBA, 19470MB, 39876480 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
atapiscsi0 at pciide0 channel 1 drive 0
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0: <_NEC, DVD+RW ND-2100AD, 103D> ATAPI 5/cdrom
removable
cd0(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 2
ichiic0 at pci0 dev 31 function 3 "Intel 82801DB SMBus" rev 0x01: apic 1
int 17
iic0 at ichiic0
spdmem0 at iic0 addr 0x50: 512MB DDR SDRAM non-parity PC2100CL2.5
spdmem1 at iic0 addr 0x51: 256MB DDR SDRAM non-parity PC2700CL2.5
auich0 at pci0 dev 31 function 5 "Intel 82801DB AC97" rev 0x01: apic 1 int
17, ICH4 AC97
ac97: codec id 0x41445374 (Analog Devices AD1981B)
ac97: codec features headphone, 20 bit DAC, No 3D Stereo
audio0 at auich0
usb1 at uhci0: USB revision 1.0
uhub1 at usb1 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb2 at uhci1: USB revision 1.0
uhub2 at usb2 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb3 at uhci2: USB revision 1.0
uhub3 at usb3 "Intel UHCI root hub" rev 1.00/1.00 addr 1
isa0 at ichpcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
lpt0 at isa0 port 0x378/4 irq 7
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
mtrr: Pentium Pro MTRR support
uhidev0 at uhub2 port 2 configuration 1 interface 0 "Avocent Dell 03R874"
rev 1.10/1.00 addr 2
uhidev0: iclass 3/1
ukbd0 at uhidev0: 8 variable keys, 6 key codes, country code 33
wskbd1 at ukbd0 mux 1
wskbd1: connecting to wsdisplay0
uhidev1 at uhub2 port 2 configuration 1 interface 1 "Avocent Dell 03R874"
rev 1.10/1.00 addr 2
uhidev1: iclass 3/1, 3 report ids
ums0 at uhidev1 reportid 1: 5 buttons, Z dir
wsmouse0 at ums0 mux 0
uhid0 at uhidev1 reportid 2: input=2, output=0, feature=0
uhid1 at uhidev1 reportid 3: input=1, output=0, feature=0
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
root on wd0a swap on wd0b dump on wd0b

usbdevs:
Controller /dev/usb0:
addr 1: high speed, self powered, config 1, EHCI root hub(0x0000),
Intel(0x8086), rev 1.00
 port 1 powered
 port 2 powered
 port 3 powered
 port 4 powered
 port 5 powered
 port 6 powered
Controller /dev/usb1:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000),
Intel(0x8086), rev 1.00
 port 1 powered
 port 2 powered
Controller /dev/usb2:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000),
Intel(0x8086), rev 1.00
 port 1 powered
 port 2 addr 2: low speed, power 100 mA, config 1, Dell 03R874(0x0294),
Avocent(0x0624), rev 1.00
Controller /dev/usb3:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000),
Intel(0x8086), rev 1.00
 port 1 powered
 port 2 powered

Reply via email to