chore: update iced & cleanup text input
This commit is contained in:
parent
89d31e988d
commit
0e1a9d46eb
2 changed files with 16 additions and 12 deletions
2
iced
2
iced
|
|
@ -1 +1 @@
|
||||||
Subproject commit 59fbf68c541758197204aa52ceca9f89d63d1611
|
Subproject commit f7dc18037113719633f450e549d9a6428b5c84b9
|
||||||
|
|
@ -651,11 +651,11 @@ where
|
||||||
|
|
||||||
// if the previous state was at the end of the text, keep it there
|
// if the previous state was at the end of the text, keep it there
|
||||||
let old_value = Value::new(&old_value);
|
let old_value = Value::new(&old_value);
|
||||||
if state.is_focused() {
|
if state.is_focused()
|
||||||
if let cursor::State::Index(index) = state.cursor.state(&old_value) {
|
&& let cursor::State::Index(index) = state.cursor.state(&old_value)
|
||||||
if index == old_value.len() {
|
{
|
||||||
state.cursor.move_to(self.value.len());
|
if index == old_value.len() {
|
||||||
}
|
state.cursor.move_to(self.value.len());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -935,7 +935,8 @@ where
|
||||||
layout,
|
layout,
|
||||||
self.manage_value,
|
self.manage_value,
|
||||||
self.drag_threshold,
|
self.drag_threshold,
|
||||||
)
|
self.always_active,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
@ -1358,6 +1359,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
||||||
layout: Layout<'_>,
|
layout: Layout<'_>,
|
||||||
manage_value: bool,
|
manage_value: bool,
|
||||||
drag_threshold: f32,
|
drag_threshold: f32,
|
||||||
|
always_active: bool,
|
||||||
) {
|
) {
|
||||||
let update_cache = |state, value| {
|
let update_cache = |state, value| {
|
||||||
replace_paragraph(
|
replace_paragraph(
|
||||||
|
|
@ -1962,7 +1964,11 @@ pub fn update<'a, Message: Clone + 'static>(
|
||||||
|
|
||||||
let millis_until_redraw = CURSOR_BLINK_INTERVAL_MILLIS
|
let millis_until_redraw = CURSOR_BLINK_INTERVAL_MILLIS
|
||||||
- (*now - focus.updated_at).as_millis() % CURSOR_BLINK_INTERVAL_MILLIS;
|
- (*now - focus.updated_at).as_millis() % CURSOR_BLINK_INTERVAL_MILLIS;
|
||||||
|
shell.request_redraw_at(window::RedrawRequest::At(
|
||||||
|
now.checked_add(Duration::from_millis(millis_until_redraw as u64))
|
||||||
|
.unwrap_or(*now),
|
||||||
|
));
|
||||||
|
} else if always_active {
|
||||||
shell.request_redraw();
|
shell.request_redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2340,11 +2346,9 @@ pub fn draw<'a, Message>(
|
||||||
cursor::State::Index(position) => {
|
cursor::State::Index(position) => {
|
||||||
let (text_value_width, offset) =
|
let (text_value_width, offset) =
|
||||||
measure_cursor_and_scroll_offset(state.value.raw(), text_bounds, position);
|
measure_cursor_and_scroll_offset(state.value.raw(), text_bounds, position);
|
||||||
|
|
||||||
let is_cursor_visible = handling_dnd_offer
|
let is_cursor_visible = handling_dnd_offer
|
||||||
|| ((focus.now - focus.updated_at).as_millis() / CURSOR_BLINK_INTERVAL_MILLIS)
|
|| ((focus.now - focus.updated_at).as_millis() / CURSOR_BLINK_INTERVAL_MILLIS)
|
||||||
% 2
|
.is_multiple_of(2);
|
||||||
== 0;
|
|
||||||
if is_cursor_visible {
|
if is_cursor_visible {
|
||||||
if dnd_icon {
|
if dnd_icon {
|
||||||
(None, 0.0)
|
(None, 0.0)
|
||||||
|
|
@ -2479,7 +2483,7 @@ pub fn draw<'a, Message>(
|
||||||
},
|
},
|
||||||
bounds.position(),
|
bounds.position(),
|
||||||
color,
|
color,
|
||||||
*viewport,
|
text_bounds,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue