Skip to content

Commit

Permalink
Fix clear-screen timing when showing context (#1026)
Browse files Browse the repository at this point in the history
According to doc, when enabled, before showing the debugging context,
screen will be cleaned.

```
Clear the screen before showing the context sections when breaking:
gef➤ gef config context.clear_screen 1
```

This is helpful to keep the debug experience focused, but the timing
seems to be broken with the current code.

Currently, clearing screen will happen after all contexts are shown.
Hence, whenever a breakpoint is hit, all contexts will be off the screen
leaving only the input prompt as screenshot shows below.
  • Loading branch information
r12f committed Dec 21, 2023
1 parent 4f20983 commit f0d2818
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gef.py
Expand Up @@ -7379,6 +7379,9 @@ def do_invoke(self, argv: List[str]) -> None:
if redirect and os.access(redirect, os.W_OK):
enable_redirect_output(to_file=redirect)

if self["clear_screen"] and len(argv) == 0:
clear_screen(redirect)

for section in current_layout:
if section[0] == "-":
continue
Expand All @@ -7400,9 +7403,6 @@ def do_invoke(self, argv: List[str]) -> None:

self.context_title("")

if self["clear_screen"] and len(argv) == 0:
clear_screen(redirect)

if redirect and os.access(redirect, os.W_OK):
disable_redirect_output()
return
Expand Down

0 comments on commit f0d2818

Please sign in to comment.