Skip to content

Commit

Permalink
update some keys from improvements upstream (#218)
Browse files Browse the repository at this point in the history
* update some keys from improvements upstream

* update the test as well
  • Loading branch information
Kristoffer Carlsson committed Sep 1, 2020
1 parent 811a962 commit f682498
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/BracketInserter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function insert_into_keymap!(D::Dict)
return
end
end
edit_backspace(buffer(s))
edit_backspace(s, true)
end
rewrite_with_ANSI(s)
end
Expand Down
25 changes: 4 additions & 21 deletions src/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ end
function create_keybindings()

D = Dict{Any, Any}()
D['\b'] = (s, data, c) -> if LineEdit.edit_backspace(buffer(s))
D['\b'] = (s, data, c) -> if LineEdit.edit_backspace(s, true)
rewrite_with_ANSI(s)
else
beep(terminal(s))
Expand All @@ -90,7 +90,7 @@ function create_keybindings()
# Meta F
D["\ef"] = (s, data, c) -> (LineEdit.edit_move_word_right(s); rewrite_with_ANSI(s))
# Meta Enter
D["\e\r"] = (s, data, c) -> (LineEdit.edit_insert(buffer(s), '\n'); rewrite_with_ANSI(s))
D["\e\r"] = (s, data, c) -> (LineEdit.edit_insert_newline(s); rewrite_with_ANSI(s))
D["^A"] = (s, data, c) -> (LineEdit.move_line_start(s); rewrite_with_ANSI(s))
D["^E"] = (s, data, c) -> (LineEdit.move_line_end(s); rewrite_with_ANSI(s))
D["\e[H"] = (s, data, c) -> (LineEdit.move_input_start(s); rewrite_with_ANSI(s))
Expand Down Expand Up @@ -133,7 +133,7 @@ function create_keybindings()
end
return :done
else
edit_insert(buffer(s), '\n')
LineEdit.edit_insert_newline(s)
rewrite_with_ANSI(s)
end
end
Expand Down Expand Up @@ -245,24 +245,7 @@ function create_keybindings()

# Tab
D['\t'] = (s, data, c) -> begin
buf = buffer(s)
# Yes, we are ignoring the possiblity
# the we could be in the middle of a multi-byte
# sequence, here but that's ok, since any
# whitespace we're interested in is only one byte
i = position(buf)
if i != 0
c = buf.data[i]
if c == UInt8('\n') || c == UInt8('\t') ||
# hack to allow path completion in cmds
# after a space, e.g., `cd <tab>`, while still
# allowing multiple indent levels
(c == UInt8(' ') && i > 3 && buf.data[i-1] == UInt8(' '))
edit_insert(s, " "^4)
return
end
end
LineEdit.complete_line(s)
LineEdit.edit_tab(s, true)
rewrite_with_ANSI(s)
end

Expand Down
10 changes: 10 additions & 0 deletions test/flicker/simple.multiout
Original file line number Diff line number Diff line change
Expand Up @@ -89,39 +89,47 @@
++++++++++++++++++++++++++++++++++++++++++++++++++
|julia> function foo(a = b())
|
|
--------------------------------------------------
|AAAAAAABBBBBBBBCDDDECCBCFGGE
|CCCCCCC
|
++++++++++++++++++++++++++++++++++++++++++++++++++
|julia> function foo(a = b())
| e
|
|
--------------------------------------------------
|AAAAAAABBBBBBBBCDDDECCBCFGGE
|CCCCCCCC
|
|
++++++++++++++++++++++++++++++++++++++++++++++++++
|julia> function foo(a = b())
| en
|
|
|
--------------------------------------------------
|AAAAAAABBBBBBBBCDDDECCBCFGGE
|CCCCCCCCC
|
|
|
++++++++++++++++++++++++++++++++++++++++++++++++++
|julia> function foo(a = b())
| end
|
|
|
|
--------------------------------------------------
|AAAAAAABBBBBBBBCDDDECCBCFGGE
|CCCCCCCBBB
|
|
|
|
++++++++++++++++++++++++++++++++++++++++++++++++++
|julia> function foo(a = b())
| end
Expand All @@ -130,11 +138,13 @@
|
|
|
|
--------------------------------------------------
|AAAAAAABBBBBBBBCDDDECCBCFGGE
|CCCCCCCBBB
|
|
|
|
|
|

0 comments on commit f682498

Please sign in to comment.