Description
Bug Description
Description:
I'm experiencing significant performance degradation in both the standard TextEdit widget and my custom PlainTextEdit widget when handling large amounts of text.
Reproduction Steps:
Load a TextInput widget (or TextEdit) with approximately 130,172 characters (specifically 130,172 × 3 in my case)
Attempt to:
-
Select text ranges
-
Scroll through the content
-
Observe severe lag and unresponsiveness
Expected Behavior: The widget should maintain reasonable performance for basic operations (selection, scrolling) regardless of text length.
Actual Behavior: The widget becomes extremely slow and unresponsive when:
-
Selecting characters/text ranges
-
Scrolling through the content
-
Performing other text manipulations
Additional Context:
-
This occurs in both custom implementations (PlainTextEdit) and the standard TextEdit widget
-
The performance impact becomes noticeable at around 130,172 × 3 characters (data.txt)
Reproducible Code (if applicable)
component EditBase inherits Rectangle {
in property <string> font-family: Font.family;
in-out property <bool> has-focus: false;
border-width: 1px;
border-radius: 4px;
border-color: Color.stroke-surface-flyout;
background: Color.fill-control-input-active;
focus-bar := Rectangle {
x: 0px;
y: root.height - self.height - root.border-width;
width: root.width;
height: 2px;
border-radius: 4px;
background: Color.fill-accent-default;
visible: root.has-focus;
}
}
export component PlainTextEdit inherits EditBase {
in-out property <string> text <=> text-input.text;
in property <bool> read-only <=> text-input.read-only;
has-focus: text-input.has-focus;
scroll-view := ScrollView {
vertical-scrollbar-policy: as-needed;
horizontal-scrollbar-policy: always-off;
VerticalLayout {
padding: Spacing.base;
text-input := TextInput {
color: Color.text-primary;
font-family: root.font-family;
font-size: Font.body.size;
font-weight: Font.body.weight;
single-line: false;
wrap: char-wrap;
}
}
}
public function append(s: string) {
text-input.text += s;
text-input.set-selection-offsets(text-input.text.character-count, text-input.text.character-count);
scroll-view.viewport-y = scroll-view.height - scroll-view.viewport-height;
}
public function clear() {
text-input.text = "";
scroll-view.viewport-y = 0;
}
}
Environment Details
- Slint Version: 1.12
- Platform/OS: Windows 11 23H2
- Programming Language: Rust
- Backend/Renderer: wint/skia
Product Impact
I am building a serial debug assistant with Slint, which will receive many bytes (approximately 131072) and display them on TextInput in HEX (like "AA BB CC FF ...". Because of this issue, the application will be too slow to operate when I receive bytes from my MCU.