From 9ba691cd3a8ffb021cb194bd3185317a65c3194a Mon Sep 17 00:00:00 2001 From: ath3 Date: Tue, 19 Dec 2023 02:17:12 +0100 Subject: Support drawing popup frame (#4313) Co-authored-by: Blaž Hrastnik --- helix-term/src/commands/dap.rs | 9 +++++++-- helix-term/src/commands/lsp.rs | 12 +++++++++++- helix-term/src/commands/typed.rs | 1 - 3 files changed, 18 insertions(+), 4 deletions(-) (limited to 'helix-term/src/commands') diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs index cc013d1e..e9fde476 100644 --- a/helix-term/src/commands/dap.rs +++ b/helix-term/src/commands/dap.rs @@ -8,7 +8,7 @@ use dap::{StackFrame, Thread, ThreadStates}; use helix_core::syntax::{DebugArgumentValue, DebugConfigCompletion, DebugTemplate}; use helix_dap::{self as dap, Client}; use helix_lsp::block_on; -use helix_view::editor::Breakpoint; +use helix_view::{editor::Breakpoint, graphics::Margin}; use serde_json::{to_value, Value}; use tokio_stream::wrappers::UnboundedReceiverStream; @@ -581,7 +581,12 @@ pub fn dap_variables(cx: &mut Context) { } let contents = Text::from(tui::text::Text::from(variables)); - let popup = Popup::new("dap-variables", contents); + let margin = if cx.editor.popup_border() { + Margin::all(1) + } else { + Margin::none() + }; + let popup = Popup::new("dap-variables", contents).margin(margin); cx.replace_or_push_layer("dap-variables", popup); } diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index 87400461..ac6a1a21 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -23,6 +23,7 @@ use helix_core::{ use helix_view::{ document::{DocumentInlayHints, DocumentInlayHintsId, Mode}, editor::Action, + graphics::Margin, theme::Style, Document, View, }; @@ -744,7 +745,16 @@ pub fn code_action(cx: &mut Context) { }); picker.move_down(); // pre-select the first item - let popup = Popup::new("code-action", picker).with_scrollbar(false); + let margin = if editor.menu_border() { + Margin::vertical(1) + } else { + Margin::none() + }; + + let popup = Popup::new("code-action", picker) + .with_scrollbar(false) + .margin(margin); + compositor.replace_or_push("code-action", popup); }; diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 1d4d6505..f530ce10 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -574,7 +574,6 @@ fn set_line_ending( Ok(()) } - fn earlier( cx: &mut compositor::Context, args: &[Cow], -- cgit v1.2.3-70-g09d2