Skip to content

Commit

Permalink
Populate input panel with current value when editing watch expression.
Browse files Browse the repository at this point in the history
  • Loading branch information
martomo committed Jan 6, 2018
1 parent bb07894 commit 41d7efe
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,12 @@ def callback(self, index):
self.watch_index = int(index)
# Edit watch expression
if self.edit:
self.set_expression()
currentValue = ''
try:
currentValue = S.WATCH[index]['expression']
except (IndexError, KeyError):
pass
self.set_expression(currentValue)
# Remove watch expression
else:
S.WATCH.pop(self.watch_index)
Expand Down Expand Up @@ -558,9 +563,9 @@ def on_change(self, line):
def on_cancel(self):
pass

def set_expression(self):
def set_expression(self, initialValue=''):
# Show user input for setting watch expression
self.window.show_input_panel('Watch expression', '', self.on_done, self.on_change, self.on_cancel)
self.window.show_input_panel('Watch expression', initialValue, self.on_done, self.on_change, self.on_cancel)

def update_view(self):
async_session = session.SocketHandler(session.ACTION_WATCH, check_watch_view=True)
Expand Down

0 comments on commit 41d7efe

Please sign in to comment.