Skip to content

Commit

Permalink
multispaces defaults to false, and de-activate in search-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet committed Jul 27, 2017
1 parent 5dcb0d6 commit 08d2711
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions base/repl/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -478,15 +478,15 @@ function edit_insert(buf::IOBuffer, c)
end
end

function edit_backspace(s::PromptState, multispaces::Bool=true)
function edit_backspace(s::PromptState, multispaces::Bool=false)
if edit_backspace(s.input_buffer, multispaces)
refresh_line(s)
else
beep(terminal(s))
end
end

function edit_backspace(buf::IOBuffer, multispaces::Bool=true)
function edit_backspace(buf::IOBuffer, multispaces::Bool=false)
oldpos = position(buf)
if oldpos > 0
c = char_move_left(buf)
Expand Down Expand Up @@ -1378,7 +1378,7 @@ AnyDict(
end,
'\n' => KeyAlias('\r'),
# Backspace/^H
'\b' => (s,o...)->edit_backspace(s),
'\b' => (s,o...)->edit_backspace(s, true),
127 => KeyAlias('\b'),
# Meta Backspace
"\e\b" => (s,o...)->edit_delete_prev_word(s),
Expand Down
8 changes: 4 additions & 4 deletions test/lineedit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -413,24 +413,24 @@ end
LineEdit.edit_insert(s, "for x=1:10\n")
LineEdit.edit_tab(s)
@test bufferdata(s) == "for x=1:10\n "
LineEdit.edit_backspace(s)
LineEdit.edit_backspace(s, true)
@test bufferdata(s) == "for x=1:10\n"
LineEdit.edit_insert(s, " ")
LineEdit.edit_tab(s)
@test bufferdata(s) == "for x=1:10\n "
LineEdit.edit_insert(s, " ")
LineEdit.edit_backspace(s)
LineEdit.edit_backspace(s, true)
@test bufferdata(s) == "for x=1:10\n "
LineEdit.edit_insert(s, "éé=3 ")
LineEdit.edit_tab(s)
@test bufferdata(s) == "for x=1:10\n éé=3 "
LineEdit.edit_backspace(s)
LineEdit.edit_backspace(s, true)
@test bufferdata(s) == "for x=1:10\n éé=3"
LineEdit.edit_insert(s, "\n 1∉x ")
LineEdit.edit_tab(s)
@test bufferdata(s) == "for x=1:10\n éé=3\n 1∉x "
LineEdit.edit_backspace(s, false)
@test bufferdata(s) == "for x=1:10\n éé=3\n 1∉x "
LineEdit.edit_backspace(s)
LineEdit.edit_backspace(s, true)
@test bufferdata(s) == "for x=1:10\n éé=3\n 1∉x "
end

0 comments on commit 08d2711

Please sign in to comment.