Subject: bin/32500: ksh (emacs-mode) has problem deleting words with ESC+d
To: None <,>
From: None <>
List: netbsd-bugs
Date: 01/11/2006 22:15:00
>Number:         32500
>Category:       bin
>Synopsis:       ksh (emacs-mode) has problem deleting words with ESC+d
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 11 22:15:00 +0000 2006
>Originator:     Philipp Lay
>Release:        NetBSD 3.0_STABLE
System: NetBSD euklid.lan 3.0_STABLE NetBSD 3.0_STABLE (EUKLID) #40: Tue Jan 10 21:57:55 CET 2006 lay@euklid.lan:/usr/src/sys/arch/i386/compile/EUKLID i386
Architecture: i386
Machine: i386

ksh (in emacs-mode) sets the cursor to a wrong position if you delete a
word with ESC+d (or meta+d) while the edit-buffer is "scrolled left" and
includes more characters than displayed.


start /bin/ksh in emacs mode and type this (you need to add some words if your 
terminal has more then 80 columns):
aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbb cccccccccccccccccccc dddddddddddddddddddd eeeeeeeeeeeeeeeeeeee

then go back with the cursor to the beginning of the "bbbb..."-block und use 
ESC+d to delete this block. the cursor is now at a wrong position, pressing 
CTRL+l redraws the line and shows the cursor at the right position.


a patch for bin/ksh/emacs.c:

--- bin/ksh/emacs.c-orig        2006-01-11 20:08:44.000000000 +0100
+++ bin/ksh/emacs.c     2006-01-11 21:40:03.000000000 +0100
@@ -583,7 +583,7 @@
         * there is no need to ' ','\b'.
         * But if we must, make sure we do the minimum.
-       if ((i = x_displen) > 0)
+       if ((i = xx_cols - 2 - x_col) > 0)
          j = (j < i) ? j : i;
          i = j;