diff --git a/base/repl/LineEdit.jl b/base/repl/LineEdit.jl index 7daae45a42c36..7c330774fef99 100644 --- a/base/repl/LineEdit.jl +++ b/base/repl/LineEdit.jl @@ -1572,7 +1572,8 @@ function setup_search_keymap(hp) # Bracketed paste mode "\e[200~" => (s,data,c)-> begin ps = state(s, mode(s)) - input = readuntil(ps.terminal, "\e[201~")[1:(end-6)] + str = readuntil(ps.terminal, "\e[201~") + input = str[1:prevind(str, end-5)] edit_insert(data.query_buffer, input); update_display_buffer(s, data) end, "*" => (s,data,c)->(edit_insert(data.query_buffer, c); update_display_buffer(s, data)) @@ -1642,7 +1643,8 @@ global tabwidth = 8 function bracketed_paste(s) ps = state(s, mode(s)) - input = readuntil(ps.terminal, "\e[201~")[1:(end-6)] + str = readuntil(ps.terminal, "\e[201~") + input = str[1:prevind(str, end-5)] input = replace(input, '\r', '\n') if position(buffer(s)) == 0 indent = Base.indentation(input; tabwidth=tabwidth)[1]