add patches
This commit is contained in:
parent
a6f4b5ac0a
commit
0ee56eecfb
5 changed files with 189 additions and 0 deletions
67
patches/editor.patch
Normal file
67
patches/editor.patch
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
--- iced-o/widget/src/text_editor.rs 2025-04-23 13:38:47.123616714 +0200
|
||||
+++ iced/widget/src/text_editor.rs 2025-04-23 13:59:09.467473938 +0200
|
||||
@@ -43,6 +43,7 @@
|
||||
use crate::core::text::highlighter::{self, Highlighter};
|
||||
use crate::core::text::{self, LineHeight, Text, Wrapping};
|
||||
use crate::core::time::{Duration, Instant};
|
||||
+use crate::core::touch;
|
||||
use crate::core::widget::operation;
|
||||
use crate::core::widget::{self, Widget};
|
||||
use crate::core::window;
|
||||
@@ -719,6 +720,10 @@
|
||||
mouse::click::Kind::Triple => Action::SelectLine,
|
||||
};
|
||||
|
||||
+ if !state.is_focused() {
|
||||
+ shell.publish(on_edit(Action::Focus));
|
||||
+ }
|
||||
+
|
||||
state.focus = Some(Focus::now());
|
||||
state.last_click = Some(click);
|
||||
state.drag_click = Some(click.kind());
|
||||
@@ -789,6 +794,7 @@
|
||||
Binding::Unfocus => {
|
||||
state.focus = None;
|
||||
state.drag_click = None;
|
||||
+ shell.publish(on_edit(Action::Blur));
|
||||
}
|
||||
Binding::Copy => {
|
||||
if let Some(selection) = content.selection() {
|
||||
@@ -1294,6 +1300,37 @@
|
||||
Some(Update::InputMethod(Ime::Commit(content.clone())))
|
||||
}
|
||||
_ => None,
|
||||
+ },
|
||||
+ Event::Touch(event) => match event {
|
||||
+ touch::Event::FingerPressed { .. } => {
|
||||
+ if let Some(cursor_position) = cursor.position_in(bounds) {
|
||||
+ let cursor_position = cursor_position
|
||||
+ - Vector::new(padding.top, padding.left);
|
||||
+
|
||||
+ let click = mouse::Click::new(
|
||||
+ cursor_position,
|
||||
+ mouse::Button::Left,
|
||||
+ state.last_click,
|
||||
+ );
|
||||
+
|
||||
+ Some(Update::Click(click))
|
||||
+ } else if state.focus.is_some() {
|
||||
+ binding(Binding::Unfocus)
|
||||
+ } else {
|
||||
+ None
|
||||
+ }
|
||||
+ }
|
||||
+ touch::Event::FingerLifted { .. }
|
||||
+ | touch::Event::FingerLost { .. } => Some(Update::Release),
|
||||
+ touch::Event::FingerMoved { .. } => match state.drag_click {
|
||||
+ Some(mouse::click::Kind::Single) => {
|
||||
+ let cursor_position = cursor.position_in(bounds)?
|
||||
+ - Vector::new(padding.top, padding.left);
|
||||
+
|
||||
+ Some(Update::Drag(cursor_position))
|
||||
+ }
|
||||
+ _ => None,
|
||||
+ },
|
||||
},
|
||||
Event::Keyboard(keyboard::Event::KeyPressed {
|
||||
key,
|
||||
Loading…
Add table
Add a link
Reference in a new issue