Merged
Conversation
1f6fb77 to
0a7af6c
Compare
0a7af6c to
761797e
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the text sample management to use Compose's built-in TextFieldState instead of custom state management. The migration eliminates redundant state synchronization code and leverages Compose's native undo/redo functionality.
Key changes:
- Replaced
TextSampleRepositorywithSampleRepositoryusingTextFieldStatefor text state management - Migrated
TextEditorcomponent to useTextFieldStatedirectly instead of value/onChange pattern - Updated
onTextLayoutcallback to work with TextFieldState2 API (receives lambda returningTextLayoutResult)
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| MatcherAction.kt | Removed obsolete UpdateText action since state is now managed directly via TextFieldState |
| MatcherViewModel.kt | Updated to use SampleRepository and expose sampleField instead of managing text updates via actions |
| MatcherScreen.kt | Simplified TextEditor usage by passing TextFieldState directly instead of value/onChange callbacks |
| TextEditor.*.kt | Migrated to TextFieldState parameter and updated onTextLayout to receive lambda for TextFieldState2 compatibility |
| SampleRepository.kt | New interface exposing TextFieldState and flows for text/history instead of combined state flow |
| SampleRepositoryImpl.kt | New implementation using TextFieldState with built-in undo/redo support |
| PatternStateRepository.kt | Added cleanUpdate method and updated clear signature for consistency |
| SalvageManagerImpl.kt | Updated to work with new repository interfaces and direct text access |
| Opened.kt | Changed to accept CharSequence instead of SampleState for simplified comparison |
| Pattern.kt | Updated sample field type to CharSequence for compatibility with TextFieldState |
| PatternsSqlDelightDataSource.kt | Added .toString() conversion when persisting CharSequence to database |
| Inputs.kt | Removed text field as it's no longer needed in the model |
| HistoryState.kt | Added constructor accepting UndoState for compatibility with TextFieldState |
| TextLayoutResult.kt | Added bounds checking to prevent index out of bounds errors |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
feature/matcher/src/commonMain/kotlin/com/neoutils/neoregex/feature/matcher/MatcherViewModel.kt
Show resolved
Hide resolved
...shared-ui/src/webMain/kotlin/com/neoutils/neoregex/core/sharedui/component/TextEditor.web.kt
Outdated
Show resolved
Hide resolved
ccfdc14 to
0169e75
Compare
0169e75 to
97001a5
Compare
97001a5 to
4a7eca6
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15