Skip to content

Commit 1ef93a0

Browse files
committed
Merge pull request #7121 from JuliaLang/jb/7111
fix #7111, tab completion where the first item is ""
2 parents fb588be + 168fc7f commit 1ef93a0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

base/LineEdit.jl

+7-5
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,18 @@ end
9191

9292
function common_prefix(completions)
9393
ret = ""
94-
i = nexti = 1
95-
cc, nexti = next(completions[1], 1)
94+
c1 = completions[1]
95+
isempty(c1) && return ret
96+
i = 1
97+
cc, nexti = next(c1, i)
9698
while true
9799
for c in completions
98-
(i > length(c) || c[i] != cc) && return ret
100+
(i > endof(c) || c[i] != cc) && return ret
99101
end
100102
ret *= string(cc)
101-
i >= length(completions[1]) && return ret
103+
i >= endof(c1) && return ret
102104
i = nexti
103-
cc, nexti = next(completions[1], i)
105+
cc, nexti = next(c1, i)
104106
end
105107
end
106108

0 commit comments

Comments
 (0)