Improve return values of some actions + some improvements by dmaluka · Pull Request #3352 · micro-editor/micro (original) (raw)

@dmaluka mentioned this pull request

Jun 15, 2024

masmu

masmu

@dmaluka

Return false if there is nothing to undo/redo.

This also fixes false "Undid action" and "Redid actions" infobar messages in the case when no action was actually undone or redone.

@dmaluka

@dmaluka

@dmaluka

ClearInfo and ClearStatus actions do exactly the same thing. Let's keep them both, for compatibility reasons (who knows how many users are using either of the two), but at least document that there is no difference between the two.

@dmaluka

When there is no selection (i.e. selection is empty), SkipMultiCursor searches for the empty text, "finds" it as the beginning of the buffer, and as a result, jumps to the beginning of the buffer, which confuses the user. Fix it.

@dmaluka

If the original selection was not done by the user manually but as a result of the initial SpawnMultiCursor, deselect this original selection if we execute RemoveMultiCursor and there is no multicursor to remove (i.e. the original spawned cursor is the only one). This improves user experience by making RemoveMultiCursor behavior nicely symmetrical to SpawnMultiCursor.

@dmaluka

Use Deselect() in order to place the cursor at the beginning of the selection, not at the end of it, and to refresh its LastVisualX.

@dmaluka

@dmaluka

Instead of calling execAction() and then letting it check whether it should actually execute this action, do this check before calling execAction(), to make the code clear and straightforward.

Precisely: for multicursor actions, call execAction() in a loop for every cursor, but for non-multicursor actions, call execAction() just once, without a loop. This, in particular, allows to get rid of the hacky "c == nil" check, since we no longer iterate a slice that may change in the meantime (since SpawnMultiCursor and RemoveMultiCursor are non-multicursor actions and thus are no longer executed while iterating the slice).

Neko-Box-Coder added a commit to Neko-Box-Coder/micro-dev that referenced this pull request

Aug 14, 2024

@Neko-Box-Coder

This adds missing deselect calls that were present previously for RemoveAllMultiCursors before PR micro-editor#3352

dmaluka pushed a commit that referenced this pull request

Aug 15, 2024

@Neko-Box-Coder

This adds missing deselect calls that were present previously for RemoveAllMultiCursors before PR #3352

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})