From 4a053bcb2bd2a2efbfb97b7aaa1b07b207e18911 Mon Sep 17 00:00:00 2001 From: Salman Farooq Date: Sat, 6 Jul 2024 04:22:28 +0500 Subject: [PATCH 01/12] add cursorcolumn and cursorline to base16_transparent theme --- runtime/themes/base16_transparent.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/themes/base16_transparent.toml b/runtime/themes/base16_transparent.toml index 70452366f4c8..d5786f89eb85 100644 --- a/runtime/themes/base16_transparent.toml +++ b/runtime/themes/base16_transparent.toml @@ -24,6 +24,10 @@ "ui.cursor.match" = { fg = "light-yellow", underline = { color = "light-yellow", style = "line" } } "ui.cursor.primary" = { modifiers = ["reversed", "slow_blink"] } "ui.cursor.secondary" = { modifiers = ["reversed"] } +"ui.cursorline.primary" = { underline = { color = "light-gray", style = "line" } } +"ui.cursorline.secondary" = { underline = { color = "light-gray", style = "line" } } +"ui.cursorcolumn.primary" = { bg = "gray" } +"ui.cursorcolumn.secondary" = { bg = "gray" } "ui.virtual.ruler" = { bg = "gray" } "ui.virtual.whitespace" = "gray" "ui.virtual.indent-guide" = "gray" From c185d403dc583178c9dab97d12f5bd97fa36e009 Mon Sep 17 00:00:00 2001 From: Salman Farooq Date: Fri, 6 Sep 2024 02:42:32 +0500 Subject: [PATCH 02/12] remove-margins-from-overlay --- helix-term/src/ui/overlay.rs | 2 +- helix-term/src/ui/picker.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helix-term/src/ui/overlay.rs b/helix-term/src/ui/overlay.rs index ff184d4073fa..6f49c9217e0b 100644 --- a/helix-term/src/ui/overlay.rs +++ b/helix-term/src/ui/overlay.rs @@ -19,7 +19,7 @@ pub struct Overlay { pub fn overlaid(content: T) -> Overlay { Overlay { content, - calc_child_size: Box::new(|rect: Rect| clip_rect_relative(rect.clip_bottom(2), 90, 90)), + calc_child_size: Box::new(|rect: Rect| clip_rect_relative(rect.clip_bottom(2), 100, 100)), } } diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 82fe9689164d..633dff7ed97e 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -960,7 +960,7 @@ impl Component for Picker MIN_AREA_WIDTH_FOR_PREVIEW; let picker_width = if render_preview { - area.width / 2 + area.width * 3 / 8 } else { area.width }; From 5ad7319ac27e462fcd4d94361142ec7865b62258 Mon Sep 17 00:00:00 2001 From: Salman Farooq Date: Sun, 20 Oct 2024 15:16:09 +0500 Subject: [PATCH 03/12] remove-bottom-clip --- helix-term/src/ui/overlay.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-term/src/ui/overlay.rs b/helix-term/src/ui/overlay.rs index 6f49c9217e0b..599737709f9e 100644 --- a/helix-term/src/ui/overlay.rs +++ b/helix-term/src/ui/overlay.rs @@ -19,7 +19,7 @@ pub struct Overlay { pub fn overlaid(content: T) -> Overlay { Overlay { content, - calc_child_size: Box::new(|rect: Rect| clip_rect_relative(rect.clip_bottom(2), 100, 100)), + calc_child_size: Box::new(|rect: Rect| clip_rect_relative(rect.clip_bottom(0), 100, 100)), } } From ee5f956cbffb6138d9c67f9636bcca5e9d1d91d9 Mon Sep 17 00:00:00 2001 From: Salman Farooq Date: Sun, 22 Dec 2024 03:05:27 +0500 Subject: [PATCH 04/12] cleanup-and-comments --- helix-term/src/ui/overlay.rs | 22 +--------------------- helix-term/src/ui/picker.rs | 13 +++++++------ 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/helix-term/src/ui/overlay.rs b/helix-term/src/ui/overlay.rs index 599737709f9e..2fa643ab606c 100644 --- a/helix-term/src/ui/overlay.rs +++ b/helix-term/src/ui/overlay.rs @@ -15,30 +15,10 @@ pub struct Overlay { pub calc_child_size: Box Rect>, } -/// Surrounds the component with a margin of 5% on each side, and an additional 2 rows at the bottom pub fn overlaid(content: T) -> Overlay { Overlay { content, - calc_child_size: Box::new(|rect: Rect| clip_rect_relative(rect.clip_bottom(0), 100, 100)), - } -} - -fn clip_rect_relative(rect: Rect, percent_horizontal: u8, percent_vertical: u8) -> Rect { - fn mul_and_cast(size: u16, factor: u8) -> u16 { - ((size as u32) * (factor as u32) / 100).try_into().unwrap() - } - - let inner_w = mul_and_cast(rect.width, percent_horizontal); - let inner_h = mul_and_cast(rect.height, percent_vertical); - - let offset_x = rect.width.saturating_sub(inner_w) / 2; - let offset_y = rect.height.saturating_sub(inner_h) / 2; - - Rect { - x: rect.x + offset_x, - y: rect.y + offset_y, - width: inner_w, - height: inner_h, + calc_child_size: Box::new(|rect: Rect| rect), } } diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index c76c686d02ea..e466d333d2cc 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -934,16 +934,17 @@ impl Picker { impl Component for Picker { fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) { - // +---------+ +---------+ - // |prompt | |preview | - // +---------+ | | - // |picker | | | - // | | | | - // +---------+ +---------+ + // +---------+ +-------------+ + // |prompt | |preview | + // +---------+ | | + // |picker | | | + // | | | | + // +---------+ +-------------+ let render_preview = self.show_preview && self.file_fn.is_some() && area.width > MIN_AREA_WIDTH_FOR_PREVIEW; + // The preview gets more space if it present let picker_width = if render_preview { area.width * 3 / 8 } else { From 7ad3d9906421ae338dc62a713f9038a2ebc9947e Mon Sep 17 00:00:00 2001 From: Salman Farooq Date: Sun, 22 Dec 2024 05:15:32 +0500 Subject: [PATCH 05/12] typo-correction --- helix-term/src/ui/picker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index e466d333d2cc..70d5faaf8d62 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -944,7 +944,7 @@ impl Component for Picker MIN_AREA_WIDTH_FOR_PREVIEW; - // The preview gets more space if it present + // The preview gets more space if it is present let picker_width = if render_preview { area.width * 3 / 8 } else { From 4939e5a6525cdb0da6d3c5cd1e3e3e948e8f0a64 Mon Sep 17 00:00:00 2001 From: Salman Farooq Date: Sun, 22 Dec 2024 05:19:48 +0500 Subject: [PATCH 06/12] slightly-adjust-comment-wording --- helix-term/src/ui/picker.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 70d5faaf8d62..facecadbf34d 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -944,9 +944,8 @@ impl Component for Picker MIN_AREA_WIDTH_FOR_PREVIEW; - // The preview gets more space if it is present let picker_width = if render_preview { - area.width * 3 / 8 + area.width * 3 / 8 // makes preview's width greater than the picker's } else { area.width }; From 63f5b069c19ddac2dea0e5f24181b0505cd576d3 Mon Sep 17 00:00:00 2001 From: Salman Farooq Date: Sun, 22 Dec 2024 05:22:48 +0500 Subject: [PATCH 07/12] ui/picker.rs: remove a comment --- helix-term/src/ui/picker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index facecadbf34d..049538bcdf41 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -945,7 +945,7 @@ impl Component for Picker MIN_AREA_WIDTH_FOR_PREVIEW; let picker_width = if render_preview { - area.width * 3 / 8 // makes preview's width greater than the picker's + area.width * 3 / 8 } else { area.width }; From e63f01694b996ba86c83cd3e1f84cb7b33e3f516 Mon Sep 17 00:00:00 2001 From: Salman Farooq Date: Thu, 2 Jan 2025 01:31:27 +0500 Subject: [PATCH 08/12] undo-picker-preview-ratio-change --- helix-term/src/ui/picker.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 049538bcdf41..df8d52ebd2f8 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -934,18 +934,18 @@ impl Picker { impl Component for Picker { fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) { - // +---------+ +-------------+ - // |prompt | |preview | - // +---------+ | | - // |picker | | | - // | | | | - // +---------+ +-------------+ + // +---------+ +---------+ + // |prompt | |preview | + // +---------+ | | + // |picker | | | + // | | | | + // +---------+ +---------+ let render_preview = self.show_preview && self.file_fn.is_some() && area.width > MIN_AREA_WIDTH_FOR_PREVIEW; let picker_width = if render_preview { - area.width * 3 / 8 + area.width / 2 } else { area.width }; From d24eaa1e51542e865d8bfccf7d71d42e55e23c11 Mon Sep 17 00:00:00 2001 From: Salman Farooq Date: Thu, 2 Jan 2025 01:33:53 +0500 Subject: [PATCH 09/12] undo-fullscreen-without-status-line-and-bring-back-old-code --- helix-term/src/ui/overlay.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/helix-term/src/ui/overlay.rs b/helix-term/src/ui/overlay.rs index 2fa643ab606c..ff184d4073fa 100644 --- a/helix-term/src/ui/overlay.rs +++ b/helix-term/src/ui/overlay.rs @@ -15,10 +15,30 @@ pub struct Overlay { pub calc_child_size: Box Rect>, } +/// Surrounds the component with a margin of 5% on each side, and an additional 2 rows at the bottom pub fn overlaid(content: T) -> Overlay { Overlay { content, - calc_child_size: Box::new(|rect: Rect| rect), + calc_child_size: Box::new(|rect: Rect| clip_rect_relative(rect.clip_bottom(2), 90, 90)), + } +} + +fn clip_rect_relative(rect: Rect, percent_horizontal: u8, percent_vertical: u8) -> Rect { + fn mul_and_cast(size: u16, factor: u8) -> u16 { + ((size as u32) * (factor as u32) / 100).try_into().unwrap() + } + + let inner_w = mul_and_cast(rect.width, percent_horizontal); + let inner_h = mul_and_cast(rect.height, percent_vertical); + + let offset_x = rect.width.saturating_sub(inner_w) / 2; + let offset_y = rect.height.saturating_sub(inner_h) / 2; + + Rect { + x: rect.x + offset_x, + y: rect.y + offset_y, + width: inner_w, + height: inner_h, } } From 09685a08d3fd95233e8924b4a23bf71102041195 Mon Sep 17 00:00:00 2001 From: Salman Farooq Date: Thu, 2 Jan 2025 02:12:51 +0500 Subject: [PATCH 10/12] make-overlaid-content-conditionally-take-all-the-space --- helix-term/src/ui/overlay.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/helix-term/src/ui/overlay.rs b/helix-term/src/ui/overlay.rs index ff184d4073fa..1230404c7f4c 100644 --- a/helix-term/src/ui/overlay.rs +++ b/helix-term/src/ui/overlay.rs @@ -7,6 +7,8 @@ use tui::buffer::Buffer; use crate::compositor::{Component, Context, Event, EventResult}; +pub const FULL_OVERLAID_MAX_WIDTH: u16 = 240; + /// Contains a component placed in the center of the parent component pub struct Overlay { /// Child component @@ -19,7 +21,14 @@ pub struct Overlay { pub fn overlaid(content: T) -> Overlay { Overlay { content, - calc_child_size: Box::new(|rect: Rect| clip_rect_relative(rect.clip_bottom(2), 90, 90)), + calc_child_size: Box::new(|rect: Rect| { + let percentage = if rect.width < FULL_OVERLAID_MAX_WIDTH { + 100 + } else { + 90 + }; + clip_rect_relative(rect.clip_bottom(2), percentage, percentage) + }), } } From abdf9b8fb79ea16395fb479b4f1c1d42cf16fb3e Mon Sep 17 00:00:00 2001 From: RokKos Date: Thu, 13 Nov 2025 09:39:13 +0100 Subject: [PATCH 11/12] docs(readme): adding reference/credit to the original PR --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 652126f454fa..8c7b0b7f0372 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ This fork of Helix implements the following pull requests. Future pull requests 22. https://github.com/helix-editor/helix/pull/14453 (ruler chars) 23. https://github.com/helix-editor/helix/pull/12902 (File Explorer: create/delete/copy/move/rename) 24. https://github.com/helix-editor/helix/pull/13963 (auto reload buffers on focus / changes) +25. https://github.com/helix-editor/helix/pull/12311 (Make overlays (e.g. pickers) fullscreen) ## Setup From 50bb41a1cf9b8f044c7782716a4f56efb0295807 Mon Sep 17 00:00:00 2001 From: RokKos Date: Sun, 14 Dec 2025 09:53:40 +0100 Subject: [PATCH 12/12] wip: trying to get the editor config passed in --- README.md | 10 ++++++++++ book/src/editor.md | 3 ++- helix-term/src/ui/overlay.rs | 10 ++++------ helix-view/src/editor.rs | 3 +++ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8c7b0b7f0372..2f6a576654b8 100644 --- a/README.md +++ b/README.md @@ -509,3 +509,13 @@ periodic.interval = 5000 focus-gained = true periodic.enable = true periodic.interval = 5000 +``` + +### Picker Full Screen + +Enables that pickers cover full screen instead of only 90% + +```toml +[editor] +pickers-full-screen = true +``` diff --git a/book/src/editor.md b/book/src/editor.md index 4c125a6ebcd3..6903a8dc070b 100644 --- a/book/src/editor.md +++ b/book/src/editor.md @@ -67,6 +67,7 @@ | `editor-config` | Whether to read settings from [EditorConfig](https://editorconfig.org) files | `true` | | `rainbow-brackets` | Whether to render rainbow colors for matching brackets. Requires tree-sitter `rainbows.scm` queries for the language. | `false` | | `kitty-keyboard-protocol` | Whether to enable Kitty Keyboard Protocol. Can be `enabled`, `disabled` or `auto` | `"auto"` | +| `pickers-full-screen` | if pickers should be full screen. | `false` | [^3]: In most cases, you also need to enable the `auto-format` setting under `languages.toml`. You can find the reasoning [here](https://github.com/helix-editor/helix/discussions/9043#discussioncomment-7811497). @@ -293,10 +294,10 @@ name = "rust" ### `[editor.auto-reload]` Section -Controls auto reloading of externally modified files. | Key | Description | Default | |--|--|---------| +|--|--|---------| | `focus-gained` | Enable automatic reloading of externally modified files when Helix is focused. Requires [focus event support](https://github.com/helix-editor/helix/wiki/Terminal-Support) from your terminal | `false` | | `periodic.enable` | Enable periodic auto reloading of externally modified files | `false` | | `periodic.interval` | Time interval in milliseconds between auto reload checks | `3000` | diff --git a/helix-term/src/ui/overlay.rs b/helix-term/src/ui/overlay.rs index 1230404c7f4c..90f7097c5595 100644 --- a/helix-term/src/ui/overlay.rs +++ b/helix-term/src/ui/overlay.rs @@ -18,15 +18,13 @@ pub struct Overlay { } /// Surrounds the component with a margin of 5% on each side, and an additional 2 rows at the bottom -pub fn overlaid(content: T) -> Overlay { +pub fn overlaid(content: T, ctx: &Context) -> Overlay { Overlay { content, calc_child_size: Box::new(|rect: Rect| { - let percentage = if rect.width < FULL_OVERLAID_MAX_WIDTH { - 100 - } else { - 90 - }; + let overlay_full_screen = + ctx.editor.config().pickers_full_screen && rect.width < FULL_OVERLAID_MAX_WIDTH; + let percentage = if overlay_full_screen { 100 } else { 90 }; clip_rect_relative(rect.clip_bottom(2), percentage, percentage) }), } diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 5017129f65ed..e7bb6960b080 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -499,6 +499,8 @@ pub struct Config { /// Completion Highlight configuration #[serde(default)] pub completion_highlight: CompletionHighlight, + /// If pickers should be full screen + pub pickers_full_screen: bool, } #[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize, Clone, Copy)] @@ -1643,6 +1645,7 @@ impl Default for Config { gradient_borders: GradientBorderConfig::default(), notifications: NotificationConfig::default(), completion_highlight: CompletionHighlight::default(), + pickers_full_screen: false, } } }