Skip to content

Commit 58307b4

Browse files
authored
fix printing for evaluation level and make fr show the current level by default instead of level 1 (#142)
* fix printing for evaluation level * show current level by default
1 parent e0dcd97 commit 58307b4

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Basic Commands:
3939
- `c`: continue execution until a breakpoint is hit
4040
- `bt`: show a simple backtrace
4141
- ``` `stuff ```: run `stuff` in the current function's context
42-
- `fr [v::Int]`: show all variables in the current function, `v` defaults to `1`
42+
- `fr [v::Int]`: show all variables in the current or `v`th frame
4343
- `f [n::Int]`: go to the `n`-th function in the call stack
4444
- `w`
4545
- `w add expr`: add an expression to the watch list

src/commands.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ execute_command(state::DebuggerState, ::Val{:st}, cmd) = true
7575
function execute_command(state::DebuggerState, ::Union{Val{:f}, Val{:fr}}, cmd)
7676
subcmds = split(cmd, ' ')
7777
if length(subcmds) == 1
78-
new_level = 1
78+
if cmd == "f"
79+
new_level = 1
80+
else
81+
new_level = state.level
82+
end
7983
else
8084
new_level = tryparse(Int, subcmds[2])
8185
if new_level == nothing
@@ -150,7 +154,7 @@ function execute_command(state::DebuggerState, ::Val{:?}, cmd::AbstractString)
150154
- `c`: continue execution until a breakpoint is hit\\
151155
- `bt`: show a simple backtrace\\
152156
- ``` `stuff ```: run `stuff` in the current function's context\\
153-
- `fr [v::Int]`: show all variables in the current frame, `v` defaults to `1`\\
157+
- `fr [v::Int]`: show all variables in the current or `v`th frame\\
154158
- `f [n::Int]`: go to the `n`-th frame\\
155159
- `w`\\
156160
- `w add expr`: add an expression to the watch list\\

src/repl.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function julia_prompt(state::DebuggerState)
123123
# Return early if this has already been called on the state
124124
isassigned(state.julia_prompt) && return state.julia_prompt[]
125125

126-
julia_prompt = LineEdit.Prompt(promptname(state.level, "julia");
126+
julia_prompt = LineEdit.Prompt(() -> promptname(state.level, "julia");
127127
# Copy colors from the prompt object
128128
prompt_prefix = state.repl.prompt_color,
129129
prompt_suffix = (state.repl.envcolors ? Base.input_color : state.repl.input_color),

0 commit comments

Comments
 (0)