[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
completing something already completed
From: |
Jared Yanovich |
Subject: |
completing something already completed |
Date: |
Fri, 25 Jun 2004 11:55:39 -0500 |
When performing completions on something that is already "completed,"
the shared text is duplicated. Here is an example illustrating the
situation. Point is denoted by * on above line.
Current behavior:
*
bash-2.05b$ ls Makefile
Hit tab and you get:
*
bash-2.05b$ ls Makefilefile
instead of the preferred:
*
bash-2.05b$ ls Makefile
Although this isn't a "bug" per se, it is still annoying. I made a
patch that just moves point in these situations. Since this breaks
expected, current functionality, perhaps it could be turned into an
option if this idea is not liked enough to be made default?
bash-2.05b/lib/readline (with patches 001-007 applied):
--- text.c.orig Thu May 30 12:46:13 2002
+++ text.c Fri Jun 25 11:55:11 2004
@@ -175,12 +175,23 @@ _rl_replace_text (text, start, end)
const char *text;
int start, end;
{
- int n;
+ int n = 0;
+ /* Skip over text that already exists. */
+ while (start < rl_line_buffer_len &&
+ *text != '\0' &&
+ rl_line_buffer[start] == *text) {
+ start++;
+ text++;
+ n++;
+ }
+
rl_begin_undo_group ();
- rl_delete_text (start, end + 1);
+ if (start <= end)
+ rl_delete_text (start, end + 1);
rl_point = start;
- n = rl_insert_text (text);
+ if (*text != '\0')
+ n += rl_insert_text (text);
rl_end_undo_group ();
return n;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- completing something already completed,
Jared Yanovich <=