Skip to content

Commit 77687c2

Browse files
committed
Revert previous fix: wrong!
1 parent 2e82232 commit 77687c2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/tabcomp.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,13 +1391,15 @@ is_multi_sel(void)
13911391
static int
13921392
clean_rl_buffer(const char *text)
13931393
{
1394+
if (!text || !*text)
1395+
return FUNC_FAILURE;
1396+
13941397
if (rl_point != rl_end)
13951398
return FUNC_SUCCESS;
13961399

13971400
/* If the previous char is not space, then a common prefix was appended:
13981401
* remove it. */
1399-
if (rl_end == 0
1400-
|| (rl_end > 0 && rl_line_buffer && rl_line_buffer[rl_end - 1] != ' ')
1402+
if ((rl_end > 0 && rl_line_buffer && rl_line_buffer[rl_end - 1] != ' ')
14011403
|| (rl_end >= 2 && rl_line_buffer && rl_line_buffer[rl_end - 2] == '\\')) {
14021404
/* Find the last non-escaped space. */
14031405
int i = rl_end, sp = -1;
@@ -2059,7 +2061,7 @@ tab_complete(const int what_to_do)
20592061
/* Common prefix for multiple matches is appended to the input query.
20602062
* Let's rise a flag to know if we should reinsert the original query
20612063
* in case the user cancels the completion (pressing ESC). */
2062-
int common_prefix_added =
2064+
const int common_prefix_added =
20632065
(fzftab == 1 && matches[1] && strcmp(matches[0], text) != 0);
20642066
#endif /* _NO_FZF */
20652067

0 commit comments

Comments
 (0)