diff options
author | Chet Ramey <chet.ramey@case.edu> | 2011-11-23 19:12:30 -0500 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2011-11-23 19:12:30 -0500 |
commit | bcd7f75a2bc2f7c67c9cd6899ff546afa45cbba4 (patch) | |
tree | 71f09c9e7e2a9be3c3aa79e31cb48d7069d8a979 /kill.c | |
parent | 753c336c548b9a1358058751c6288b6e31458d89 (diff) | |
download | readline-bcd7f75a2bc2f7c67c9cd6899ff546afa45cbba4.tar.gz |
Readline-5.0 import
Diffstat (limited to 'kill.c')
-rw-r--r-- | kill.c | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -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; } |