Skip to content

Commit

Permalink
FIX: fixed inplace operations not refreshing window title and/or array (
Browse files Browse the repository at this point in the history
closes #22 and #280)
  • Loading branch information
gdementen committed Jul 26, 2024
1 parent cea750c commit 51e05f9
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions doc/source/changes/version_0_34_5.rst.inc
Original file line number Diff line number Diff line change
@@ -4,3 +4,7 @@ Fixes
^^^^^

* fixed console plots when xlwings 0.31.4+ is installed (closes :editor_issue:`278`).

* fixed some inplace modifications on arrays done via in the console not refreshing
the displayed array automatically and/or not adding a `*` to the window title
to inform the session is modified (closes :editor_issue:`22` and :editor_issue:`280`).
8 changes: 6 additions & 2 deletions larray_editor/editor.py
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@
REOPEN_LAST_FILE = object()

assignment_pattern = re.compile(r'[^\[\]]+[^=]=[^=].+')
setitem_pattern = re.compile(r'(\w+)(\.i|\.iflat|\.points|\.ipoints)?\[.+\][^=]=[^=].+')
setitem_pattern = re.compile(r'(\w+)(\.i|\.iflat|\.points|\.ipoints)?\[.+\][^=]*=[^=].+')
history_vars_pattern = re.compile(r'_i?\d+')
# XXX: add all scalars except strings (from numpy or plain Python)?
# (long) strings are not handled correctly so should NOT be in this list
@@ -699,9 +699,13 @@ def ipython_cell_executed(self):
setitem_match = setitem_pattern.match(last_input)
if setitem_match:
varname = setitem_match.group(1)
# otherwise it should have failed at this point, but let us be sure
# setitem to (i)python special variables do not concern us
if varname in clean_ns:
if self._display_in_grid(varname, clean_ns[varname]):
# For better or worse, _save_data() only saves "displayable data"
# so changes to variables we cannot display do not concern us,
# and this line should not be moved outside the if condition.
self.unsaved_modifications = True
# XXX: this completely refreshes the array, including detecting scientific & ndigits, which might
# not be what we want in this case
self.select_list_item(varname)

0 comments on commit 51e05f9

Please sign in to comment.