Skip to content

Commit

Permalink
[REPL] Meta-e: Don't execute the edited code when exiting editor
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Jul 24, 2022
1 parent 743578a commit fa00937
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions stdlib/REPL/src/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1349,19 +1349,16 @@ function edit_input(s, f = (filename, line, column) -> InteractiveUtils.edit(fil
col += 1
end

# Write current input to temp file, edit, read back
write(filename, str)
f(filename, line, col)
str_mod = readchomp(filename)
rm(filename)
if str != str_mod # something was changed, run the input
write(buf, str_mod)
commit_line(s)
:done
else # no change, the edit session probably unsuccessful
write(buf, str)
seek(buf, pos) # restore state from before edit
refresh_line(s)
end

# Write updated content and move cursor to the end
write(buf, str_mod)
move_input_end(s)
refresh_line(s)
end

# return the identifier under the cursor, possibly with other words concatenated
Expand Down

0 comments on commit fa00937

Please sign in to comment.