Skip to content

Commit 8fed378

Browse files
fredrikekreKristofferC
authored andcommitted
Always show watch entries after watch commands. (#131)
1 parent bad1c46 commit 8fed378

File tree

3 files changed

+350
-10
lines changed

3 files changed

+350
-10
lines changed

src/commands.jl

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,27 +101,29 @@ end
101101
function execute_command(state::DebuggerState, ::Val{:w}, cmd::AbstractString)
102102
# TODO show some info messages?
103103
cmds = split(cmd)
104+
success_and_show = false
104105
if length(cmds) == 1
105-
io = Base.pipe_writer(state.terminal)
106-
show_watch_list(io, state)
107-
return false
106+
success_and_show = true
108107
elseif length(cmds) >= 2
109108
if cmds[2] == "rm"
110109
if length(cmds) == 2
111110
clear_watch_list!(state)
112-
return false
111+
success_and_show = true
113112
elseif length(cmds) == 3
114113
i = parse(Int, cmds[3])
115114
clear_watch_list!(state, i)
116-
return false
115+
success_and_show = true
117116
end
118117
end
119118
if cmds[2] == "add"
120-
if add_watch_entry!(state, join(cmds[3:end]))
121-
end
122-
return false
119+
success_and_show = add_watch_entry!(state, join(cmds[3:end]))
123120
end
124121
end
122+
if success_and_show
123+
io = Base.pipe_writer(state.terminal)
124+
show_watch_list(io, state)
125+
return false
126+
end
125127
# Error
126128
return execute_command(state, Val(:_), cmd)
127129
end

test/ui.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ end
8686
UP_ARROW = "\e[A"
8787

8888
run_terminal_test(@make_frame(my_gcd(10, 20)),
89-
["n\n","`", "my_gc\t\n", "a\n", UP_ARROW, UP_ARROW, UP_ARROW, CTRL_C,
89+
["n\n","`", "my_gc\t\n", "a\n", UP_ARROW, UP_ARROW, UP_ARROW, CTRL_C,
9090
"w add a\n", "w add sin(a)\n", "w add b\n", "w\n", "w rm 1\n", "w\n",
9191
"s\n", "fr 1\n", "fr 2\n", "f 2\n", "f 1\n",
9292
"bt\n", "st\n", "C", "c\n", "C", "c\n"],
@@ -99,7 +99,7 @@ end
9999
run_terminal_test(@make_frame(f_end(2)),
100100
["n\n", "n\n", "n\n"],
101101
"ui/history_floor.multiout")
102-
102+
103103
if v"1.1">= VERSION < v"1.2"
104104
run_terminal_test(@make_frame(my_gcd_noinfo(10, 20)),
105105
["n\n","`", "a\n", UP_ARROW, UP_ARROW, CTRL_C, EOT],

0 commit comments

Comments
 (0)