From fc40496e5117e86ee53572dff1f469ca1fdaf9bc Mon Sep 17 00:00:00 2001 From: Kevin King Date: Mon, 15 Apr 2024 00:40:58 -0700 Subject: [PATCH] Implement ShowHover command to support modal hover keybind (#3158) Hides the hover popup on any move command. --- CHANGELOG.md | 1 + lapce-app/src/editor.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c54f49cb..3472ce28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - [#2779](https://github.com/lapce/lapce/pull/2779): Fix files detection on fresh git/VCS repository - [#3031](https://github.com/lapce/lapce/pull/3031): Fix find not receiving inputs when clicked - [#3142](https://github.com/lapce/lapce/pull/3142): Fix terminal default profile saving incorrectly +- [#3158](https://github.com/lapce/lapce/pull/3158): Fix ShowHover command for showing hover with keybind ## 0.3.1 diff --git a/lapce-app/src/editor.rs b/lapce-app/src/editor.rs index e9a97567..fb4a727e 100644 --- a/lapce-app/src/editor.rs +++ b/lapce-app/src/editor.rs @@ -612,6 +612,7 @@ fn run_move_command( count: Option, mods: Modifiers, ) -> CommandExecuted { + self.common.hover.active.set(false); if movement.is_jump() && movement != &self.editor.last_movement.get_untracked() { @@ -1046,6 +1047,12 @@ pub fn run_focus_command( FocusCommand::InlineCompletionInvoke => { self.update_inline_completion(InlineCompletionTriggerKind::Invoked); } + FocusCommand::ShowHover => { + let start_offset = self.doc().buffer.with_untracked(|b| { + b.prev_code_boundary(self.cursor().get_untracked().offset()) + }); + self.update_hover(start_offset); + } _ => {} }