* bug in delete-to-char in 4.3.9
@ 2008-12-07 7:18 Greg Klanderman
2008-12-07 18:43 ` Peter Stephenson
0 siblings, 1 reply; 3+ messages in thread
From: Greg Klanderman @ 2008-12-07 7:18 UTC (permalink / raw)
To: Zsh list
[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 440 bytes --]
Hi, there appears to be a small bug in delete-to-char in zsh 4.3.9.
I'm upgrading from 4.2.5 so don't know how long ago it was introduced.
The bug causes either incorrect behavior, or the crash:
| zsh: fatal error: out of memory
zap-to-char works so long as you don't give it a prefix (count)
argument.
Below is the obvious patch obtained by comparing the code with 4.2.7
and looking for discrepancies; it seems to work.
cheers,
Greg
[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 396 bytes --]
--- /home/greg/.backups/deltochar.c!!!build!zsh!zsh-4.3.9!Src!Zle!.~1~ 2008-04-14 04:45:16.000000000 -0400
+++ zsh-4.3.9/Src/Zle/deltochar.c 2008-12-07 01:52:54.000000000 -0500
@@ -48,7 +48,7 @@
if (dest != zlell) {
/* HERE adjust dest for trailing combining chars */
if (!zap || n > 0)
- INCCS();
+ dest++;
if (!n) {
forekill(dest - zlecs, CUT_RAW);
ok++;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: bug in delete-to-char in 4.3.9
2008-12-07 7:18 bug in delete-to-char in 4.3.9 Greg Klanderman
@ 2008-12-07 18:43 ` Peter Stephenson
2008-12-08 15:10 ` Greg Klanderman
0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2008-12-07 18:43 UTC (permalink / raw)
To: gak, Zsh list
On Sun, 7 Dec 2008 02:18:11 -0500
Greg Klanderman <gak@klanderman.net> wrote:
> Hi, there appears to be a small bug in delete-to-char in zsh 4.3.9.
> I'm upgrading from 4.2.5 so don't know how long ago it was introduced.
> The bug causes either incorrect behavior, or the crash:
>
> | zsh: fatal error: out of memory
>
> zap-to-char works so long as you don't give it a prefix (count)
> argument.
Yes, it's got a bit knocked about.
Index: Src/Zle/deltochar.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/deltochar.c,v
retrieving revision 1.9
diff -u -r1.9 deltochar.c
--- Src/Zle/deltochar.c 13 Apr 2008 16:58:42 -0000 1.9
+++ Src/Zle/deltochar.c 7 Dec 2008 18:42:27 -0000
@@ -44,11 +44,10 @@
if (n > 0) {
while (n-- && dest != zlell) {
while (dest != zlell && (ZLE_INT_T)zleline[dest] != c)
- dest++;
+ INCPOS(dest);
if (dest != zlell) {
- /* HERE adjust dest for trailing combining chars */
if (!zap || n > 0)
- INCCS();
+ INCPOS(dest);
if (!n) {
forekill(dest - zlecs, CUT_RAW);
ok++;
@@ -58,10 +57,10 @@
} else {
/* ignore character cursor is on when scanning backwards */
if (dest)
- dest--;
+ DECPOS(dest);
while (n++ && dest != 0) {
while (dest != 0 && (ZLE_INT_T)zleline[dest] != c)
- dest--;
+ DECPOS(dest);
if ((ZLE_INT_T)zleline[dest] == c) {
if (!n) {
/* HERE adjust zap for trailing combining chars */
@@ -69,7 +68,7 @@
ok++;
}
if (dest)
- dest--;
+ DECPOS(dest);
}
}
}
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-12-08 15:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-07 7:18 bug in delete-to-char in 4.3.9 Greg Klanderman
2008-12-07 18:43 ` Peter Stephenson
2008-12-08 15:10 ` Greg Klanderman
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).