File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed
internal/compiler/widgets Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -46,15 +46,19 @@ export component TextEditBase inherits Rectangle {
4646 }
4747
4848 public function cut () {
49- text-input.cut ();
49+ if (!root .read_only && root .enabled) {
50+ text-input.cut ();
51+ }
5052 }
5153
5254 public function copy () {
5355 text-input.copy ();
5456 }
5557
5658 public function paste () {
57- text-input.paste ();
59+ if (!root .read_only && root .enabled) {
60+ text-input.paste ();
61+ }
5862 }
5963
6064 forward-focus : text-input;
Original file line number Diff line number Diff line change @@ -99,15 +99,19 @@ export component TextEdit {
9999 }
100100
101101 public function cut () {
102- text-input.cut ();
102+ if (!root .read-only && root .enabled) {
103+ text-input.cut ();
104+ }
103105 }
104106
105107 public function copy () {
106108 text-input.copy ();
107109 }
108110
109111 public function paste () {
110- text-input.paste ();
112+ if (!root .read-only && root .enabled) {
113+ text-input.paste ();
114+ }
111115 }
112116
113117 forward-focus : text-input;
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export component TestCase inherits Window {
1616 callback edited <=> edit.edited;
1717 in-out property <string > text <=> edit.text;
1818 in-out property <bool > read-only <=> edit.read-only;
19+ in-out property <bool > enabled <=> edit.enabled;
1920 public function paste () {
2021 edit.paste ();
2122 }
@@ -98,6 +99,15 @@ let edit = edit_search.next().unwrap();
9899assert_eq!(edit.accessible_read_only(), Some(false));
99100instance.set_read_only(true);
100101assert_eq!(edit.accessible_read_only(), Some(true));
102+
103+ instance.set_read_only(true);
104+ instance.invoke_paste();
105+ assert_eq!(instance.get_text(), "XxxHello👋");
106+ instance.set_read_only(false);
107+
108+ instance.set_enabled(false);
109+ instance.invoke_paste();
110+ assert_eq!(instance.get_text(), "XxxHello👋");
101111```
102112
103113*/
You can’t perform that action at this time.
0 commit comments