Skip to content

Commit

Permalink
Merge pull request JuliaLang#7558 from mbauman/7551
Browse files Browse the repository at this point in the history
  • Loading branch information
kmsquire committed Jul 14, 2014
2 parents 0160490 + 8f897cf commit 8ecbbab
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
10 changes: 7 additions & 3 deletions base/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,13 @@ end
function LineEdit.accept_result(s, p::LineEdit.HistoryPrompt{REPLHistoryProvider})
parent = LineEdit.state(s, p).parent
hist = p.hp
m = hist.mode_mapping[hist.modes[hist.cur_idx]]
LineEdit.replace_line(LineEdit.state(s, m), LineEdit.state(s, p).response_buffer)
LineEdit.transition(s, m)
if 1 <= hist.cur_idx <= length(hist.modes)
m = hist.mode_mapping[hist.modes[hist.cur_idx]]
LineEdit.replace_line(LineEdit.state(s, m), LineEdit.state(s, p).response_buffer)
LineEdit.transition(s, m)
else
LineEdit.transition(s, parent)
end
end

function history_prev(s::LineEdit.MIState, hist::REPLHistoryProvider,
Expand Down
10 changes: 10 additions & 0 deletions test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,16 @@ begin
LineEdit.accept_result(s, histp)
@test LineEdit.mode(s) == shell_mode
@test buffercontents(LineEdit.buffer(s)) == "ll"

# Issue #7551
# Enter search mode and try accepting an empty result
REPL.history_reset_state(hp)
LineEdit.edit_clear(s)
cur_mode = LineEdit.mode(s)
LineEdit.enter_search(s, histp, true)
LineEdit.accept_result(s, histp)
@test LineEdit.mode(s) == cur_mode
@test buffercontents(LineEdit.buffer(s)) == ""
end

ccall(:jl_exit_on_sigint, Void, (Cint,), 1)
Expand Down

0 comments on commit 8ecbbab

Please sign in to comment.