word selection

This commit is contained in:
2025-11-22 15:33:36 -05:00
parent 2928482322
commit 4faa1b601a
3 changed files with 17 additions and 7 deletions

View File

@@ -1,3 +1,5 @@
use std::time::{Duration, Instant};
use super::*;
pub fn error(ui: &mut Ui, msg: &str) -> WidgetId {
@@ -49,10 +51,13 @@ impl WidgetAttr<TextEdit> for Selectable {
}
fn select(id: WidgetId<TextEdit>, client: &mut Client, data: CursorData) {
let now = Instant::now();
let recent = (now - client.last_click) < Duration::from_millis(300);
client.last_click = now;
client
.ui
.text(&id)
.select(data.cursor, data.size, data.sense.is_dragging());
.select(data.cursor, data.size, data.sense.is_dragging(), recent);
if let Some(region) = client.ui.window_region(&id) {
client.handle.window.set_ime_allowed(true);
client.handle.window.set_ime_cursor_area(