Skip to content

Commit

Permalink
Refresh watched value if expression is edited
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanderkamp committed Jun 29, 2022
1 parent 0980fa5 commit 8babd03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pudb/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,9 @@ def edit_inspector_detail(w, size, key):
iinfo.access_level = "all"

if var.watch_expr is not None:
var.watch_expr.expression = watch_edit.get_edit_text()
new_expression = watch_edit.get_edit_text()
if new_expression != var.watch_expr.expression:
var.watch_expr.set_expression(new_expression)

elif result == "del":
try:
Expand Down
4 changes: 4 additions & 0 deletions pudb/var_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ def eval(self, frame_globals, frame_locals):
return WatchEvalError()
return self._value

def set_expression(self, expression):
self.expression = expression
self._value = self.NOT_EVALUATED


class WatchEvalError:
def __str__(self):
Expand Down

0 comments on commit 8babd03

Please sign in to comment.