beeware / beeware/toga

MultiLineTextInput widget persistently takes on rich formatting on a paste operation

Open
#2,957 7 comments 0 reactions 0 assignees View on GitHub
bug macOS windows
Dominant language
Python
Stars
5.4k
Forks
827
Avg merge
15h 39m
Merged PRs (30d)
40

Description

### Describe the bug

When pasting rich-formatted text into a MultiLineTextInput widget, the widget takes on the rich formatting.

### Steps to reproduce

1. Launch a Toga application that includes a MultiLineTextInput widget. e.g., from the Toga repository, examples/multilinetextinput.
2. Copy rich-formatted text from another application, e.g., MS Word, TextEdit, a web browser.
3. Paste into the MultiLineTextInput widget.
4. Rich-formatting is preserved in the MultiLineTextInput widget. The formatting persists even when clearing the value (e.g., "clear" button in the Toga multilinetextinput example).

### 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:**

Screenshot 2024-11-15 at 18 19 16

**Rich text (TextEdit):**

Screenshot 2024-11-15 at 18 21 04

**After paste:**

Screenshot 2024-11-15 at 18 21 22

**After clear:**

Screenshot 2024-11-15 at 18 21 29

### Environment

- Operating System:
- MacOS Sequoia 15.1
- Windows 11
- Others???

- Python version:
- 3.12.7

- Software versions:
- Toga: 0.4.8

### Logs

```

```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the MultiLineTextInput widget and the examples/multilinetextinput application to reproduce the paste and clear behavior. Trace the widget's platform-specific implementations and existing text-input tests, if present, to determine how rich text is handled on macOS and Windows. Done means pasted rich text displays as plain text by default and clearing the widget removes any residual formatting.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.