Changing text size and colour using a routine with less than 0.25 seconds prevents undo and redo on my machine. I think sclang needs time to remember the text change.
However, the following code cannot be evaluated by cmd/ctrl + enter
(
1
+ // evaluate this block by pressing cmd/ctrl + enter after placing the cursor on this line.
2
)
although using .enterInterpretsSelection_(true); as follows:
(
w = Window().front;
t = TextView(w.asView, w.asView.bounds.insetBy(0, 0))
.focus(true)
.enterInterpretsSelection_(true);
)
(
w = Window().front;
t = TextView(w.asView, w.asView.bounds.insetBy(0, 0))
.focus(true);
t.enterInterpretsSelection = true;
)
(
w = Window().front;
t = TextView(w.asView, w.asView.bounds.insetBy(0, 0))
.focus(true);
t.enterInterpretsSelection_(true);
)
Hm, what would be the correct behavior of “undo,” if you’re making rapid programmatic changes? To undo the last change of any sort, or to undo the user’s latest interactive change? The former would be technically easy but probably not meaningful to the user; the latter would be harder I guess.
The identification of paren-blocks is an editor feature, and TextView isn’t a full-featured code editor. It should be possible to write a response function in sclang to find the code boundaries and interpret.