Skip to content

Commit 51e05f9

Browse files
committed
FIX: fixed inplace operations not refreshing window title and/or array (closes #22 and #280)
1 parent cea750c commit 51e05f9

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

doc/source/changes/version_0_34_5.rst.inc

+4
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ Fixes
44
^^^^^
55

66
* fixed console plots when xlwings 0.31.4+ is installed (closes :editor_issue:`278`).
7+
8+
* fixed some inplace modifications on arrays done via in the console not refreshing
9+
the displayed array automatically and/or not adding a `*` to the window title
10+
to inform the session is modified (closes :editor_issue:`22` and :editor_issue:`280`).

larray_editor/editor.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
REOPEN_LAST_FILE = object()
7878

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

0 commit comments

Comments
 (0)