Skip to content

Commit d9bed31

Browse files
qhuy4119inducer
authored andcommitted
Add the delete hotkey to remove watch expression
User can remove a watch expression by selecting it and press the delete key on keyboard
1 parent 5fa8f80 commit d9bed31

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

pudb/debugger.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@
115115
m - toggle method visibility
116116
w - toggle line wrapping
117117
n/insert - add new watch expression
118-
e - edit options (also to delete)
118+
delete - remove watch expression
119+
e - edit options
119120
120121
Keys in stack list:
121122
enter - jump to frame
@@ -938,6 +939,11 @@ def change_var_state(w, size, key):
938939
iinfo.wrap = not iinfo.wrap
939940
elif key == "m":
940941
iinfo.show_methods = not iinfo.show_methods
942+
elif key == "delete":
943+
fvi = self.get_frame_var_info(read_only=False)
944+
for i, watch_expr in enumerate(fvi.watches):
945+
if watch_expr is var.watch_expr:
946+
del fvi.watches[i]
941947

942948
self.update_var_view(focus_index=focus_index)
943949

@@ -1095,6 +1101,7 @@ def insert_watch(w, size, key):
10951101
self.var_list.listen("e", edit_inspector_detail)
10961102
self.var_list.listen("n", insert_watch)
10971103
self.var_list.listen("insert", insert_watch)
1104+
self.var_list.listen("delete", change_var_state)
10981105

10991106
self.var_list.listen("[", partial(change_rhs_box, "variables", 0, -1))
11001107
self.var_list.listen("]", partial(change_rhs_box, "variables", 0, 1))

0 commit comments

Comments
 (0)