mirror of https://github.com/lapce/lapce.git
cursor blink when switching window tab
This commit is contained in:
parent
a79254b445
commit
1268fb9ec8
|
@ -550,6 +550,8 @@ fn event(
|
|||
Event::Command(cmd) if cmd.is(LAPCE_UI_COMMAND) => {
|
||||
let command = cmd.get_unchecked(LAPCE_UI_COMMAND);
|
||||
if let LapceUICommand::Focus = command {
|
||||
self.cursor_blink_timer =
|
||||
ctx.request_timer(Duration::from_millis(500), None);
|
||||
self.request_focus(ctx, data, true);
|
||||
let editor_data = data.editor_view_content(self.view_id);
|
||||
self.ensure_cursor_visible(
|
||||
|
@ -563,7 +565,7 @@ fn event(
|
|||
}
|
||||
Event::Timer(id) if self.cursor_blink_timer == *id => {
|
||||
ctx.set_handled();
|
||||
if data.focus == self.view_id {
|
||||
if ctx.is_focused() {
|
||||
ctx.request_paint();
|
||||
self.cursor_blink_timer =
|
||||
ctx.request_timer(Duration::from_millis(500), None);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use druid::{
|
||||
kurbo::Line,
|
||||
widget::{LensWrap, WidgetExt},
|
||||
BoxConstraints, Command, Env, Event, EventCtx, InternalEvent, LayoutCtx,
|
||||
LifeCycle, LifeCycleCtx, PaintCtx, Point, RenderContext, Size, Target, Widget,
|
||||
WidgetId, WidgetPod, WindowState,
|
||||
BoxConstraints, Command, Env, Event, EventCtx, LayoutCtx, LifeCycle,
|
||||
LifeCycleCtx, PaintCtx, Point, RenderContext, Size, Target, Widget, WidgetId,
|
||||
WidgetPod, WindowState,
|
||||
};
|
||||
use lapce_data::{
|
||||
command::{LapceUICommand, LAPCE_UI_COMMAND},
|
||||
|
@ -356,10 +356,8 @@ fn event(
|
|||
| Event::MouseUp(_)
|
||||
| Event::MouseMove(_)
|
||||
| Event::Wheel(_)
|
||||
| Event::KeyDown(_)
|
||||
| Event::Timer(_)
|
||||
| Event::AnimFrame(_)
|
||||
| Event::Internal(InternalEvent::RouteTimer(..))
|
||||
| Event::KeyDown(_)
|
||||
| Event::KeyUp(_) => {}
|
||||
_ => {
|
||||
for (i, tab) in self.tabs.iter_mut().enumerate() {
|
||||
|
|
Loading…
Reference in New Issue