Add WrapMode to TextView/TextEditor #68

Merged
david-swift merged 3 commits from mlm/adwaita-swift:AddWrapMode into main 2025-08-27 13:36:22 +02:00
Contributor

Steps

  • Build the project on your machine. If it does not compile, fix the errors.
  • Describe the purpose and approach of your pull request below.
  • Submit the pull request. Thank you very much for your contribution!

Purpose

Add support for the "GtkWrapModes" to TextEditor/TextView.

Approach

  • Wrapped the GtkWrapMode in a Swift enum WrapMode.
  • Added an extension to GtkWrapMode so it can be used as a rawValue in WrapMode.
  • Added a wrapMode() modifier to TextEditor to set the wrap mode.
  • Modified the update method to update the wrap mode as well.
## Steps - [x] Build the project on your machine. If it does not compile, fix the errors. - [x] Describe the purpose and approach of your pull request below. - [x] Submit the pull request. Thank you very much for your contribution! ## Purpose Add support for the "GtkWrapModes" to TextEditor/TextView. ## Approach - Wrapped the GtkWrapMode in a Swift enum `WrapMode`. - Added an extension to GtkWrapMode so it can be used as a rawValue in `WrapMode`. - Added a `wrapMode()` modifier to `TextEditor` to set the wrap mode. - Modified the `update` method to update the wrap mode as well.
mlm added 1 commit 2025-08-25 10:21:20 +02:00
Add WrapMode to TextView/TextEditor
Some checks failed
SwiftLint / SwiftLint (pull_request) Has been cancelled
0af3864058
david-swift added 1 commit 2025-08-26 13:33:56 +02:00
Fix code style
All checks were successful
SwiftLint / SwiftLint (pull_request) Successful in 6s
87b970d844
david-swift added 1 commit 2025-08-27 13:27:59 +02:00
Use more declarative approach for text editor
Some checks failed
SwiftLint / SwiftLint (pull_request) Has been cancelled
4eb58b154c
Owner

Thank you very much for this addition! This implementation works well.

I refactored the code to use the more declarative way for the widget definition. This comes with another advantage: While the old implementation updates properties such as the wrap mode whenever a state variable in one of the parent views updates, using the declarative approach ensures that the value is only being updated if it actually changes.

Thanks again!

Thank you very much for this addition! This implementation works well. I refactored the code to use the [more declarative way](https://meta.aparoksha.dev/documentation/meta/createbackend#A-Regular-Widget) for the widget definition. This comes with another advantage: While the old implementation updates properties such as the wrap mode whenever a state variable in one of the parent views updates, using the declarative approach ensures that the value is only being updated if it actually changes. Thanks again!
david-swift changed title from WIP: Add WrapMode to TextView/TextEditor to Add WrapMode to TextView/TextEditor 2025-08-27 13:36:15 +02:00
david-swift merged commit ebb2455fe1 into main 2025-08-27 13:36:22 +02:00
Sign in to join this conversation.
No Reviewers
No Milestone
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: aparoksha/adwaita-swift#68
No description provided.