[Cuis-dev] Syntax Error notification undo bug

Eric Brandwein brandweineric at gmail.com
Wed Jun 5 11:21:56 PDT 2019

Hi all,

There's currently a bug when having an unrecognized selector in a method
and a syntax error at the same time. When the method is saved, and the undo
command is generated, the selector replacement and the syntax error
notification insertion of text are merged into one command, which in turn
makes the command not represent the actual user input.

For example, if we don't have the m2 method defined, and we try to save
this method:

    self m2.

, an 'Unrecognized selector' popup will appear, prompting you to select the
correct selector. After selecting it, a syntax error text will appear after
the '[', and the source text will end up looking something like this:

    self m1.
    [End of block expected ->

After undoing the last command, because the selector replacement was merged
with the syntax error replacement, the method will look something like this:

    self m2ed ->

I made a ChangeSet that fixes it by checking that the stop position of the
last replacement corresponds with the start position of the new replacement
before merging the two. But I believe the problem comes from the fact that
syntax error replacements should not be merged at all with previous
replacement commands; after all, user text replacements and syntax error
text replacements seem to me pretty separate undoable commands.

Changing this without having tests for the TextEditor seemed like a pretty
dangerous task, so I didn't. Plus, the way I thought about changing it
involved changing the Parser, which seemed even more dangerous. There
probably are tests for the Parser, but I couldn't find them in the
BaseSystemTests. Where are they?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20190605/9a6da54a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3785-SyntaxErrorUndoFix-EricBrandwein-2019Jun05-03h24m-EB.1.cs.st
Type: application/octet-stream
Size: 2264 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20190605/9a6da54a/attachment.obj>

More information about the Cuis-dev mailing list