Version: (using KDE 4.3.4) OS: Linux Installed from: Archlinux Packages The character deletion ansi code "[P" fails to delete the last character of a line. This behavior is due to the void Screen::deleteChars(int n) function in Screen.cpp. The line lenght check seems wrong: 208 if ( cuX+n >= screenLines[cuY].count() ) 209 n = screenLines[cuY].count() - 1 - cuX; should probably be: 208 if ( cuX+n > screenLines[cuY].count() ) 209 n = screenLines[cuY].count() - cuX; which would be coherent with the existing Q_ASSERT: 212 Q_ASSERT( cuX+n < screenLines[cuY].count() ); Regards,
*** This bug has been confirmed by popular vote. ***
The following bash command trigger the bug: echo -n $'AB\x1b[1D\x1b[1P' ; sleep 5 This command writes 'AB' then moves backward with ESC [1D and fails to delete the 'B' character under cursor with ESC [1P. xterm, linux, screen and other terminal emulators do have the correct behavior and delete 'B'.
Created attachment 42911 [details] The attached patch fixes the bug.
Did that patch actually work for you? When I did, the ASSERT crashed my konsole.
Yes, I used it for a while on kdebase-4.3.4 before upgrading recently. I might not have Q_ASSERT enabled. I realize that this line seems wrong too: Q_ASSERT( cuX+n < screenLines[cuY].count() ) screenLines[cuY].remove(cuX,n); For instance lets assume curX == 0, Q_ASSERT prevents removing all characters on the line. However screenLines[cuY].remove(0, screenLines[cuY].count()) is a valid operation. Isn't it ?
Created attachment 42977 [details] The attached patch fixes the bug and the Q_ASSERT.
SVN commit 1119662 by hindenburg: Correct ANSI's 'delete char' to delete the last character in a line. Patch provided by Alexandre Becoulet BUG: 217669 M +3 -3 Screen.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1119662
SVN commit 1119960 by hindenburg: Correct ANSI's 'delete char' to delete the last character in a line. Patch provided by Alexandre Becoulet CCBUG: 217669 M +3 -3 Screen.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1119960