Skip to content

Commit

Permalink
REPL: add option to disable auto-indent feature (#26605)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet authored Apr 9, 2018
1 parent bde5344 commit f659d5d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stdlib/REPL/src/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ end

# align: number of ' ' to insert after '\n'
# if align < 0: align like line above
function edit_insert_newline(s::PromptState, align=-1)
function edit_insert_newline(s::PromptState, align::Int = 0 - options(s).auto_indent)
push_undo(s)
buf = buffer(s)
if align < 0
Expand Down
6 changes: 4 additions & 2 deletions stdlib/REPL/src/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ mutable struct Options
backspace_align::Bool
backspace_adjust::Bool
confirm_exit::Bool # ^D must be repeated to confirm exit
auto_indent::Bool # indent a newline like line above
end

Options(;
Expand All @@ -278,12 +279,13 @@ Options(;
beep_colors = ["\e[90m"], # gray (text_colors not yet available)
beep_use_current = true,
backspace_align = true, backspace_adjust = backspace_align,
confirm_exit = false) =
confirm_exit = false,
auto_indent = true) =
Options(hascolor, extra_keymap, tabwidth,
kill_ring_max, region_animation_duration,
beep_duration, beep_blink, beep_maxduration,
beep_colors, beep_use_current,
backspace_align, backspace_adjust, confirm_exit)
backspace_align, backspace_adjust, confirm_exit, auto_indent)

# for use by REPLs not having an options field
const GlobalOptions = Options()
Expand Down

0 comments on commit f659d5d

Please sign in to comment.