From c6fad60c72bac0b0ba1b7912f866caa3a6cb744c Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Fri, 5 May 2006 18:26:14 +0000 Subject: Readline 5.1 import for HEAD. --- readline/kill.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'readline/kill.c') diff --git a/readline/kill.c b/readline/kill.c index a616b920d90..1d3254c3275 100644 --- a/readline/kill.c +++ b/readline/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; } -- cgit v1.2.1