summaryrefslogtreecommitdiff
path: root/cmd-line-utils/readline/kill.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd-line-utils/readline/kill.c')
-rw-r--r--cmd-line-utils/readline/kill.c57
1 files changed, 49 insertions, 8 deletions
diff --git a/cmd-line-utils/readline/kill.c b/cmd-line-utils/readline/kill.c
index 32a661f076f..061bdafcf9a 100644
--- a/cmd-line-utils/readline/kill.c
+++ b/cmd-line-utils/readline/kill.c
@@ -77,7 +77,7 @@ static int rl_yank_nth_arg_internal PARAMS((int, int, int));
of kill material. */
int
rl_set_retained_kills (num)
- int num __attribute__((unused));
+ int num;
{
return 0;
}
@@ -294,7 +294,7 @@ rl_backward_kill_line (direction, ignore)
/* Kill the whole line, no matter where point is. */
int
rl_kill_full_line (count, ignore)
- int count __attribute__((unused)), ignore __attribute__((unused));
+ int count, ignore;
{
rl_begin_undo_group ();
rl_point = 0;
@@ -312,7 +312,7 @@ rl_kill_full_line (count, ignore)
using behaviour that they expect. */
int
rl_unix_word_rubout (count, key)
- int count, key __attribute__((unused));
+ int count, key;
{
int orig_point;
@@ -337,6 +337,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;
}
@@ -348,7 +389,7 @@ rl_unix_word_rubout (count, key)
doing. */
int
rl_unix_line_discard (count, key)
- int count __attribute__((unused)), key __attribute__((unused));
+ int count, key;
{
if (rl_point == 0)
rl_ding ();
@@ -385,7 +426,7 @@ region_kill_internal (delete)
/* Copy the text in the region to the kill ring. */
int
rl_copy_region_to_kill (count, ignore)
- int count __attribute__((unused)), ignore __attribute__((unused));
+ int count, ignore;
{
return (region_kill_internal (0));
}
@@ -393,7 +434,7 @@ rl_copy_region_to_kill (count, ignore)
/* Kill the text between the point and mark. */
int
rl_kill_region (count, ignore)
- int count __attribute__((unused)), ignore __attribute__((unused));
+ int count, ignore;
{
int r, npoint;
@@ -458,7 +499,7 @@ rl_copy_backward_word (count, key)
/* Yank back the last killed text. This ignores arguments. */
int
rl_yank (count, ignore)
- int count __attribute__((unused)), ignore __attribute__((unused));
+ int count, ignore;
{
if (rl_kill_ring == 0)
{
@@ -477,7 +518,7 @@ rl_yank (count, ignore)
yank back some other text. */
int
rl_yank_pop (count, key)
- int count __attribute__((unused)), key __attribute__((unused));
+ int count, key;
{
int l, n;