-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### Description - Cleans up undo/redo operations when TextFormation is activated, for instance when inserting or deleting a newline. > ~Note: Requires [CodeEditTextView#25](CodeEditApp/CodeEditTextView#25) to be merged.~ Merged! ### Related Issues * closes #233 ### Checklist - [x] I read and understood the [contributing guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md) as well as the [code of conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md) - [x] The issues this PR addresses are related to each other - [x] My changes generate no new warnings - [x] My code builds and runs on my machine - [x] My changes are all related to the related issue above - [x] I documented my code ### Screenshots https://github.com/CodeEditApp/CodeEditSourceEditor/assets/35942988/d842b77d-60b4-4afd-be6c-2fb3d0342c4c
- Loading branch information
1 parent
a5581a2
commit a72e6c9
Showing
5 changed files
with
40 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
17 changes: 17 additions & 0 deletions
17
Sources/CodeEditSourceEditor/Extensions/TextMutation+isEmpty.swift
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// TextMutation+isEmpty.swift | ||
// CodeEditSourceEditor | ||
// | ||
// Created by Khan Winter on 3/1/24. | ||
// | ||
|
||
import TextStory | ||
|
||
extension TextMutation { | ||
/// Determines if the mutation is an empty mutation. | ||
/// | ||
/// Will return `true` if the mutation is neither a delete operation nor an insert operation. | ||
var isEmpty: Bool { | ||
self.string.isEmpty && self.range.isEmpty | ||
} | ||
} |
This file contains 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
This file contains 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