@@ -392,7 +392,7 @@ function mode_idx(hist::REPLHistoryProvider, mode)
392
392
end
393
393
394
394
function add_history (hist:: REPLHistoryProvider , s)
395
- str = rstrip (String (s. input_buffer))
395
+ str = rstrip (String (take! ( copy ( s. input_buffer)) ))
396
396
isempty (strip (str)) && return
397
397
mode = mode_idx (hist, LineEdit. mode (s))
398
398
! isempty (hist. history) &&
@@ -506,7 +506,7 @@ function history_move_prefix(s::LineEdit.PrefixSearchState,
506
506
prefix:: AbstractString ,
507
507
backwards:: Bool ,
508
508
cur_idx = hist. cur_idx)
509
- cur_response = String (LineEdit. buffer (s))
509
+ cur_response = String (take! ( copy ( LineEdit. buffer (s)) ))
510
510
# when searching forward, start at last_idx
511
511
if ! backwards && hist. last_idx > 0
512
512
cur_idx = hist. last_idx
@@ -547,7 +547,7 @@ function history_search(hist::REPLHistoryProvider, query_buffer::IOBuffer, respo
547
547
qpos = position (query_buffer)
548
548
qpos > 0 || return true
549
549
searchdata = beforecursor (query_buffer)
550
- response_str = String (response_buffer)
550
+ response_str = String (take! ( copy ( response_buffer)) )
551
551
552
552
# Alright, first try to see if the current match still works
553
553
a = position (response_buffer) + 1 # position is zero-indexed
@@ -596,7 +596,7 @@ LineEdit.reset_state(hist::REPLHistoryProvider) = history_reset_state(hist)
596
596
597
597
function return_callback (s)
598
598
ast = Base. syntax_deprecation_warnings (false ) do
599
- Base. parse_input_line (String (LineEdit. buffer (s)))
599
+ Base. parse_input_line (String (take! ( copy ( LineEdit. buffer (s)) )))
600
600
end
601
601
if ! isa (ast, Expr) || (ast. head != :continue && ast. head != :incomplete )
602
602
return true
0 commit comments