From cd3e754fcd5155383d7d471bf2854e7038c343e7 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Tue, 21 May 2024 17:35:23 +0300 Subject: [PATCH] Disable inter-layer grouping by default. The grouping inside a single layer is still enabled. --- src/renderer/mod.rs | 18 +++++++++++++++--- website/docs/configuration.md | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 4d0c73834..c95396c8e 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -99,6 +99,7 @@ pub struct RendererSettings { underline_stroke_scale: f32, text_gamma: f32, text_contrast: f32, + experimental_layer_grouping: bool, } impl Default for RendererSettings { @@ -119,6 +120,7 @@ impl Default for RendererSettings { underline_stroke_scale: 1., text_gamma: 0.0, text_contrast: 0.5, + experimental_layer_grouping: false, } } } @@ -207,7 +209,10 @@ impl Renderer { let default_background = self.grid_renderer.get_default_background(); let grid_scale = self.grid_renderer.grid_scale; - let transparency = { SETTINGS.get::().transparency }; + let transparency = SETTINGS.get::().transparency; + let layer_grouping = SETTINGS + .get::() + .experimental_layer_grouping; root_canvas.clear(default_background.with_a((255.0 * transparency) as u8)); root_canvas.save(); root_canvas.reset_matrix(); @@ -240,8 +245,15 @@ impl Renderer { for window in floating_windows { let zindex = window.anchor_info.as_ref().unwrap().sort_order; log::debug!("zindex: {}, base: {}", zindex, base_zindex); - // Group floating windows by consecutive z indices - if zindex - last_zindex > 1 && !current_windows.is_empty() { + if layer_grouping { + // Group floating windows by consecutive z indices + if zindex - last_zindex > 1 && !current_windows.is_empty() { + for windows in group_windows(current_windows, grid_scale) { + floating_layers.push(FloatingLayer { windows }); + } + current_windows = vec![]; + } + } else { for windows in group_windows(current_windows, grid_scale) { floating_layers.push(FloatingLayer { windows }); } diff --git a/website/docs/configuration.md b/website/docs/configuration.md index 96b15ba2f..ca26958b3 100644 --- a/website/docs/configuration.md +++ b/website/docs/configuration.md @@ -417,6 +417,26 @@ Set the [`background`](https://neovim.io/doc/user/options.html#'background') opt starts. Possible values: _light_, _dark_, _auto_. On systems that support it, _auto_ will mirror the system theme, and will update `background` when the system theme changes. +#### Layer grouping + +VimScript: + +```vim +let g:experimental_layer_grouping = v:false +``` + +Lua: + +```lua +vim.g.experimental_layer_grouping = false +``` + +**Available since 0.13.1.** + +Group non-emtpy consecutive layers (zindex) together, so that the shadows and blurring is done for +the whole group instead of each individual layer. This can get rid of some shadowing and blending +artifacts, but cause worse problems like [#2574](https://github.com/neovide/neovide/issues/2574). + ### Functionality #### Refresh Rate