Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[patch] deltochar



Reverse kills were not handled correctly.  Also, kill the text so it
can be yanked, like emacs does.

There is still a minor bug in that consecutive reverse deltochar's do
not accumulate into a single kill.  They do going forwards.

Can someone tell me what the ZLE_KILL does in the call to
addzlefunction, and if it's needed?

greg
(please copy me on replies)


1998-11-05  Greg Klanderman  <greg@xxxxxxxxxxxxx>

	* Src/Zle/deltochar.c (deltochar): kill (saving in kill ring)
	instead of deleting.  properly handle reverse kills.


--- Src/Zle/deltochar.c.orig	Thu Nov  5 11:21:36 1998
+++ Src/Zle/deltochar.c	Thu Nov  5 12:23:28 1998
@@ -45,7 +45,7 @@
 	    if (dest != ll) {
 		dest++;
 		if (!n) {
-		    foredel(dest - cs);
+		    forekill(dest - cs, 0);
 		    ok++;
 		}
 	    }
@@ -58,9 +58,13 @@
 	    while (dest != 0 && line[dest] != c)
 		dest--;
 	    if (line[dest] == c && !n) {
-		backdel(cs - dest);
+		backkill(cs - dest, 1);
 		ok++;
 	    }
+            else if (dest)
+              dest--;
+            else
+              n = 0;
 	}
     }
     if (!ok)
@@ -71,7 +75,8 @@
 int
 boot_deltochar(Module m)
 {
-    w_deletetochar = addzlefunction("delete-to-char", deltochar, ZLE_KEEPSUFFIX);
+    w_deletetochar = addzlefunction("delete-to-char", deltochar,
+                                    ZLE_KILL | ZLE_KEEPSUFFIX);
     if (w_deletetochar)
 	return 0;
     zwarnnam(m->nam, "name clash when adding ZLE function `delete-to-char'",



Messages sorted by: Reverse Date, Date, Thread, Author