Skip to content

Commit

Permalink
Fix bug in LineEdit
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno committed Jan 1, 2018
1 parent cf114c3 commit 9f5c04f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions base/repl/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,15 @@ function common_prefix(completions)
c1 = completions[1]
isempty(c1) && return ret
i = 1
cc, nexti = c1, 2
cc, nexti = iterate(c1, i)
while true
for c in completions
(i > endof(c) || c[i] != cc) && return ret
end
ret = string(ret, cc)
i >= endof(c1) && return ret
i = nexti
cc, nexti = c1, i+1
cc, nexti = iterate(c1, i)
end
end

Expand Down
12 changes: 8 additions & 4 deletions test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ fake_repl() do stdin_write, stdout_read, repl
notify(b)
wait(c)

# Give ourselves a generous timer here, just to prevent
# this causing e.g. a CI hang when there's something unexpected
# in the output.
t = Timer(200) do t
isopen(t) || return
error("Stuck waiting for repl test")
end

# Latex completions
write(stdin_write, "\x32\\alpha\t")
readuntil(stdout_read, "α")
Expand Down Expand Up @@ -212,10 +220,6 @@ fake_repl() do stdin_write, stdout_read, repl
# Test down arrow to go back to history
# populate history with a trivial input

t = Timer(10) do t
isopen(t) || return
error("Stuck waiting for history test")
end
s1 = "12345678"; s2 = "23456789"
write(stdin_write, s1, '\n')
readuntil(stdout_read, s1)
Expand Down

0 comments on commit 9f5c04f

Please sign in to comment.