Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message field does not wrap #45

Closed
cryptoAlgorithm opened this issue May 26, 2022 · 5 comments
Closed

Message field does not wrap #45

cryptoAlgorithm opened this issue May 26, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@cryptoAlgorithm
Copy link
Member

Describe the bug
When typing a long message into the message field, the text does not wrap once it hits the end of the field.
Although newlines work (opt + return), the text does not wrap anymore like it did before with TextEditor

To Reproduce

  1. Type very long text in the message field
  2. Notice how the text does not scroll, but you can still input text into the field
  3. Send the message and note that the text that was entered beyond the width of the field is present

Expected behavior
The text wraps to the next line

Screenshots

Note the cut-off 't' that appears after the cursor

Screenshot 2022-05-26 at 11 46 25 AM

Additional context
Text wrapping used to work while a TextEditor was used, but newlines didn't. Now, its the opposite xD

@cryptoAlgorithm cryptoAlgorithm added the bug Something isn't working label May 26, 2022
@charxene
Copy link
Contributor

charxene commented May 30, 2022

Was alt-enter handling the reason for switching from TextEditor to TextField? I think we should explore more options for TextEditor handling enter as a commit action and alt enter as an edit action.

@cryptoAlgorithm
Copy link
Member Author

Yeah, among other issues that TextEditor brought, like a hardcoded background (someone figured how to override it with a transparent color), and no option for a placeholder hint. Also, there were other issues using it with a ScrollView. The other option is to use AppKit, which allows handling of the raw keydown events, but was very tough.

@cryptoAlgorithm
Copy link
Member Author

I might use swiftui-introspect to access the low level NSTextView of the TextEditor to handle keyDown events 🤔

@cryptoAlgorithm
Copy link
Member Author

This appears to be fixed in macOS 13, irregardless of whether Xcode 13 or 14 is used to build Swiftcord. So, it appears to be some SwiftUI 'bug' (or maybe its a bug in macOS 13 that fixes this as a side effect?) that was fixed in macOS 13. Either ways, the 'fixed' behaviour in macOS 13 is not what I want (it scrolls horizontally when the field overflows instead of wrapping vertically), so I'll still have to figure out some other solution for this.

@cryptoAlgorithm
Copy link
Member Author

Moved to #75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants