aboutsummaryrefslogtreecommitdiff
path: root/contrib/libreadline/kill.c
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2004-10-18 07:02:42 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2004-10-18 07:02:42 +0000
commitfc34a2e6e7440f272f42e77105629b6ff62ef2fa (patch)
treef78c1227a8143a263e4974d6bf25cf0ccde0e716 /contrib/libreadline/kill.c
parent8c5ab3080739fa4331e6890bfb1d4aa852a64c82 (diff)
downloadsrc-fc34a2e6e7440f272f42e77105629b6ff62ef2fa.tar.gz
src-fc34a2e6e7440f272f42e77105629b6ff62ef2fa.zip
Virgin import of GNU Readline 5.0
Notes
Notes: svn path=/vendor/libreadline/dist/; revision=136644
Diffstat (limited to 'contrib/libreadline/kill.c')
-rw-r--r--contrib/libreadline/kill.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/contrib/libreadline/kill.c b/contrib/libreadline/kill.c
index a616b920d903..1d3254c3275d 100644
--- a/contrib/libreadline/kill.c
+++ b/contrib/libreadline/kill.c
@@ -339,6 +339,47 @@ rl_unix_word_rubout (count, key)
if (rl_editing_mode == emacs_mode)
rl_mark = rl_point;
}
+
+ return 0;
+}
+
+/* This deletes one filename component in a Unix pathname. That is, it
+ deletes backward to directory separator (`/') or whitespace. */
+int
+rl_unix_filename_rubout (count, key)
+ int count, key;
+{
+ int orig_point, c;
+
+ if (rl_point == 0)
+ rl_ding ();
+ else
+ {
+ orig_point = rl_point;
+ if (count <= 0)
+ count = 1;
+
+ while (count--)
+ {
+ c = rl_line_buffer[rl_point - 1];
+ while (rl_point && (whitespace (c) || c == '/'))
+ {
+ rl_point--;
+ c = rl_line_buffer[rl_point - 1];
+ }
+
+ while (rl_point && (whitespace (c) == 0) && c != '/')
+ {
+ rl_point--;
+ c = rl_line_buffer[rl_point - 1];
+ }
+ }
+
+ rl_kill_text (orig_point, rl_point);
+ if (rl_editing_mode == emacs_mode)
+ rl_mark = rl_point;
+ }
+
return 0;
}