Open kcoombs opened 5 hours ago
Confirming this definitely isn't the intended behavior. I'm guessing we've missed an option when configuring the native text widgets.
Not sure if this also affects GTK, iOS or Android; seems highly plausible it might be an issue on GTK.
As least so far as MacOS goes, this seems to prevent MultiLineTextInput from taking rich-formatted text on a paste:
diff --git a/cocoa/src/toga_cocoa/widgets/multilinetextinput.py b/cocoa/src/toga_cocoa/widgets/multilinetextinput.py
index c651fa8e4..e908ecb6d 100644
--- a/cocoa/src/toga_cocoa/widgets/multilinetextinput.py
+++ b/cocoa/src/toga_cocoa/widgets/multilinetextinput.py
@@ -36,6 +36,7 @@ class MultilineTextInput(Widget):
# Create the actual text widget
self.native_text = TogaTextView.alloc().init()
+ self.native_text.setRichText_(False)
self.native_text.interface = self.interface
self.native_text.delegate = self.native_text
See https://developer.apple.com/documentation/appkit/nstextview/1449538-richtext.
Describe the bug
When pasting rich-formatted text into a MultiLineTextInput widget, the widget takes on the rich formatting.
Steps to reproduce
Expected behavior
While rich formatting may be desirable in some situations, I'd expect the default behavior to be displaying only plain text, like a TextInput widget.
Screenshots
Before paste:
Rich text (TextEdit):
After paste:
After clear:
Environment
Operating System:
Python version:
Software versions:
Logs
Additional context
No response