Skip to content

Commit

Permalink
Keep cursor at prefix position.
Browse files Browse the repository at this point in the history
  • Loading branch information
blakejohnson committed Dec 11, 2014
1 parent 0bfc341 commit d8c89d2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion base/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,13 @@ function history_move_prefix(s::LineEdit.PrefixSearchState,
for idx in idxs
if (idx == max_idx) || (beginswith(hist.history[idx], prefix) && (hist.history[idx] != cur_response || hist.modes[idx] != LineEdit.mode(s)))
history_move(s, hist, idx)
LineEdit.move_input_end(s)
if length(prefix) == 0
# on empty prefix search, move cursor to the end
LineEdit.move_input_end(s)
else
# otherwise, keep cursor at the prefix position as a visual cue
seek(LineEdit.buffer(s), length(prefix))
end
LineEdit.refresh_line(s)
return :ok
end
Expand Down

0 comments on commit d8c89d2

Please sign in to comment.