Skip to content

Commit 1b9a4d3

Browse files
authored
Normalize whitespaces in user input (#267)
1 parent 85f550e commit 1b9a4d3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/commands.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ function execute_command(state::DebuggerState, v::Union{Val{:c},Val{:nc},Val{:n}
2929
# These commands take no arguments
3030
kwargs = Dict()
3131
if v != Val(:u)
32-
length(split(cmd)) == 1 || return invalid_command(state, cmd)
32+
length(split(cmd, r" +")) == 1 || return invalid_command(state, cmd)
3333
else
34-
args = split(cmd)
34+
args = split(cmd, r" +")
3535
length(args) > 2 && return invalid_command(state, cmd)
3636
cmd = args[1]
3737
if length(args) == 2
@@ -93,7 +93,7 @@ end
9393
execute_command(state::DebuggerState, ::Val{:st}, cmd) = true
9494

9595
function execute_command(state::DebuggerState, ::Union{Val{:f}, Val{:fr}}, cmd)
96-
subcmds = split(cmd, ' ')
96+
subcmds = split(cmd, r" +")
9797
if length(subcmds) == 1
9898
if cmd == "f"
9999
new_level = 1
@@ -129,7 +129,7 @@ function execute_command(state::DebuggerState, ::Union{Val{:f}, Val{:fr}}, cmd)
129129
end
130130

131131
function execute_command(state::DebuggerState, v::Union{Val{:up}, Val{:down}}, cmd::AbstractString)
132-
args = split(cmd, " ")[2:end]
132+
args = split(cmd, r" +")[2:end]
133133
if isempty(args)
134134
offset = v == Val(:up) ? +1 : -1
135135
else
@@ -142,7 +142,7 @@ function execute_command(state::DebuggerState, v::Union{Val{:up}, Val{:down}}, c
142142
end
143143
function execute_command(state::DebuggerState, ::Val{:w}, cmd::AbstractString)
144144
# TODO show some info messages?
145-
cmds = split(cmd)
145+
cmds = split(cmd, r" +")
146146
success_and_show = false
147147
if length(cmds) == 1
148148
success_and_show = true
@@ -176,7 +176,7 @@ function execute_command(state::DebuggerState, ::Val{:w}, cmd::AbstractString)
176176
end
177177

178178
function execute_command(state::DebuggerState, v::Union{Val{:bp}}, cmd::AbstractString)
179-
cmds = split(cmd, ' ')
179+
cmds = split(cmd, r" +")
180180
function repl_show_breakpoints()
181181
if state.terminal !== nothing
182182
io = Base.pipe_writer(state.terminal)
@@ -294,7 +294,7 @@ function execute_command(state::DebuggerState, ::Union{Val{:help}, Val{:?}}, cmd
294294
295295
296296
An empty command will execute the previous command.
297-
297+
298298
Hit `` ` `` to enter "evaluation mode," where any expression you type is executed in the debug context.
299299
Hit backspace as the first character of the line (or `^C` anywhere) to return to "debug mode." """)
300300
return false

0 commit comments

Comments
 (0)