projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
import of readline-4.3
[deliverable/binutils-gdb.git]
/
readline
/
kill.c
diff --git
a/readline/kill.c
b/readline/kill.c
index c3241bdadd00c5807e4837ab7bd4e91248fad2a9..a616b920d903b592411bb3e4e61bfbef5919df7b 100644
(file)
--- a/
readline/kill.c
+++ b/
readline/kill.c
@@
-70,6
+70,11
@@
static int rl_kill_index;
/* How many slots we have in the kill ring. */
static int rl_kill_ring_length;
/* How many slots we have in the kill ring. */
static int rl_kill_ring_length;
+static int _rl_copy_to_kill_ring PARAMS((char *, int));
+static int region_kill_internal PARAMS((int));
+static int _rl_copy_word_as_kill PARAMS((int, int));
+static int rl_yank_nth_arg_internal PARAMS((int, int, int));
+
/* How to say that you only want to save a certain amount
of kill material. */
int
/* How to say that you only want to save a certain amount
of kill material. */
int
@@
-129,7
+134,7
@@
_rl_copy_to_kill_ring (text, append)
if (_rl_last_command_was_kill && rl_editing_mode != vi_mode)
{
old = rl_kill_ring[slot];
if (_rl_last_command_was_kill && rl_editing_mode != vi_mode)
{
old = rl_kill_ring[slot];
- new = xmalloc (1 + strlen (old) + strlen (text));
+ new =
(char *)
xmalloc (1 + strlen (old) + strlen (text));
if (append)
{
if (append)
{
@@
-196,18
+201,21
@@
int
rl_kill_word (count, key)
int count, key;
{
rl_kill_word (count, key)
int count, key;
{
- int orig_point
= rl_point
;
+ int orig_point;
if (count < 0)
return (rl_backward_kill_word (-count, key));
else
{
if (count < 0)
return (rl_backward_kill_word (-count, key));
else
{
+ orig_point = rl_point;
rl_forward_word (count, key);
if (rl_point != orig_point)
rl_kill_text (orig_point, rl_point);
rl_point = orig_point;
rl_forward_word (count, key);
if (rl_point != orig_point)
rl_kill_text (orig_point, rl_point);
rl_point = orig_point;
+ if (rl_editing_mode == emacs_mode)
+ rl_mark = rl_point;
}
return 0;
}
}
return 0;
}
@@
-217,16
+225,20
@@
int
rl_backward_kill_word (count, ignore)
int count, ignore;
{
rl_backward_kill_word (count, ignore)
int count, ignore;
{
- int orig_point
= rl_point
;
+ int orig_point;
if (count < 0)
return (rl_kill_word (-count, ignore));
else
{
if (count < 0)
return (rl_kill_word (-count, ignore));
else
{
+ orig_point = rl_point;
rl_backward_word (count, ignore);
if (rl_point != orig_point)
rl_kill_text (orig_point, rl_point);
rl_backward_word (count, ignore);
if (rl_point != orig_point)
rl_kill_text (orig_point, rl_point);
+
+ if (rl_editing_mode == emacs_mode)
+ rl_mark = rl_point;
}
return 0;
}
}
return 0;
}
@@
-237,16
+249,19
@@
int
rl_kill_line (direction, ignore)
int direction, ignore;
{
rl_kill_line (direction, ignore)
int direction, ignore;
{
- int orig_point
= rl_point
;
+ int orig_point;
if (direction < 0)
return (rl_backward_kill_line (1, ignore));
else
{
if (direction < 0)
return (rl_backward_kill_line (1, ignore));
else
{
+ orig_point = rl_point;
rl_end_of_line (1, ignore);
if (orig_point != rl_point)
rl_kill_text (orig_point, rl_point);
rl_point = orig_point;
rl_end_of_line (1, ignore);
if (orig_point != rl_point)
rl_kill_text (orig_point, rl_point);
rl_point = orig_point;
+ if (rl_editing_mode == emacs_mode)
+ rl_mark = rl_point;
}
return 0;
}
}
return 0;
}
@@
-257,18
+272,22
@@
int
rl_backward_kill_line (direction, ignore)
int direction, ignore;
{
rl_backward_kill_line (direction, ignore)
int direction, ignore;
{
- int orig_point
= rl_point
;
+ int orig_point;
if (direction < 0)
return (rl_kill_line (1, ignore));
else
{
if (!rl_point)
if (direction < 0)
return (rl_kill_line (1, ignore));
else
{
if (!rl_point)
- ding ();
+
rl_
ding ();
else
{
else
{
+ orig_point = rl_point;
rl_beg_of_line (1, ignore);
rl_beg_of_line (1, ignore);
- rl_kill_text (orig_point, rl_point);
+ if (rl_point != orig_point)
+ rl_kill_text (orig_point, rl_point);
+ if (rl_editing_mode == emacs_mode)
+ rl_mark = rl_point;
}
}
return 0;
}
}
return 0;
@@
-282,6
+301,7
@@
rl_kill_full_line (count, ignore)
rl_begin_undo_group ();
rl_point = 0;
rl_kill_text (rl_point, rl_end);
rl_begin_undo_group ();
rl_point = 0;
rl_kill_text (rl_point, rl_end);
+ rl_mark = 0;
rl_end_undo_group ();
return 0;
}
rl_end_undo_group ();
return 0;
}
@@
-299,7
+319,7
@@
rl_unix_word_rubout (count, key)
int orig_point;
if (rl_point == 0)
int orig_point;
if (rl_point == 0)
- ding ();
+
rl_
ding ();
else
{
orig_point = rl_point;
else
{
orig_point = rl_point;
@@
-316,6
+336,8
@@
rl_unix_word_rubout (count, key)
}
rl_kill_text (orig_point, rl_point);
}
rl_kill_text (orig_point, rl_point);
+ if (rl_editing_mode == emacs_mode)
+ rl_mark = rl_point;
}
return 0;
}
}
return 0;
}
@@
-331,11
+353,13
@@
rl_unix_line_discard (count, key)
int count, key;
{
if (rl_point == 0)
int count, key;
{
if (rl_point == 0)
- ding ();
+
rl_
ding ();
else
{
rl_kill_text (rl_point, 0);
rl_point = 0;
else
{
rl_kill_text (rl_point, 0);
rl_point = 0;
+ if (rl_editing_mode == emacs_mode)
+ rl_mark = rl_point;
}
return 0;
}
}
return 0;
}
@@
-348,17
+372,14
@@
region_kill_internal (delete)
{
char *text;
{
char *text;
- if (rl_mark
=
= rl_point)
+ if (rl_mark
!
= rl_point)
{
{
- _rl_last_command_was_kill++;
- return 0;
+ text = rl_copy_text (rl_point, rl_mark);
+ if (delete)
+ rl_delete_text (rl_point, rl_mark);
+ _rl_copy_to_kill_ring (text, rl_point < rl_mark);
}
}
- text = rl_copy_text (rl_point, rl_mark);
- if (delete)
- rl_delete_text (rl_point, rl_mark);
- _rl_copy_to_kill_ring (text, rl_point < rl_mark);
-
_rl_last_command_was_kill++;
return 0;
}
_rl_last_command_was_kill++;
return 0;
}
@@
-512,19
+533,21
@@
rl_yank_nth_arg_internal (count, ignore, history_skip)
if (entry == 0)
{
if (entry == 0)
{
- ding ();
+
rl_
ding ();
return -1;
}
arg = history_arg_extract (count, count, entry->line);
if (!arg || !*arg)
{
return -1;
}
arg = history_arg_extract (count, count, entry->line);
if (!arg || !*arg)
{
- ding ();
+
rl_
ding ();
return -1;
}
rl_begin_undo_group ();
return -1;
}
rl_begin_undo_group ();
+ _rl_set_mark_at_pos (rl_point);
+
#if defined (VI_MODE)
/* Vi mode always inserts a space before yanking the argument, and it
inserts it right *after* rl_point. */
#if defined (VI_MODE)
/* Vi mode always inserts a space before yanking the argument, and it
inserts it right *after* rl_point. */
@@
-592,7
+615,7
@@
rl_yank_last_arg (count, key)
}
/* A special paste command for users of Cygnus's cygwin32. */
}
/* A special paste command for users of Cygnus's cygwin32. */
-#if defined (__CYGWIN
32
__)
+#if defined (__CYGWIN__)
#include <windows.h>
int
#include <windows.h>
int
@@
-612,12
+635,13
@@
rl_paste_from_clipboard (count, key)
if (ptr)
{
len = ptr - data;
if (ptr)
{
len = ptr - data;
- ptr = xmalloc (len + 1);
+ ptr =
(char *)
xmalloc (len + 1);
ptr[len] = '\0';
strncpy (ptr, data, len);
}
else
ptr = data;
ptr[len] = '\0';
strncpy (ptr, data, len);
}
else
ptr = data;
+ _rl_set_mark_at_pos (rl_point);
rl_insert_text (ptr);
if (ptr != data)
free (ptr);
rl_insert_text (ptr);
if (ptr != data)
free (ptr);
@@
-625,4
+649,4
@@
rl_paste_from_clipboard (count, key)
}
return (0);
}
}
return (0);
}
-#endif /* __CYGWIN
32
__ */
+#endif /* __CYGWIN__ */
This page took
0.026426 seconds
and
4
git commands to generate.