diff --git a/lua/init.lua b/lua/init.lua
index 570b101553..ab6bd7f940 100644
--- a/lua/init.lua
+++ b/lua/init.lua
@@ -97,3 +97,25 @@ vim.api.nvim_create_autocmd({ "VimLeavePre" }, {
         rpcnotify("neovide.quit", vim.v.exiting)
     end
 })
+
+local function unlink_highlight(name)
+    local highlight = vim.api.nvim_get_hl(0, {name=name, link=false})
+    vim.api.nvim_set_hl(0, name, highlight)
+end
+
+-- Neovim only reports the final highlight group in the ext_hlstate information
+-- So we need to unlink all the groups when the color scheme is changed
+-- This is quite hacky, so let the user disable it.
+vim.api.nvim_create_autocmd({ "ColorScheme" }, {
+    pattern = "*",
+    nested = false,
+    callback = function()
+        if vim.g.neovide_unlink_border_highlights then
+            unlink_highlight("FloatTitle")
+            unlink_highlight("FloatFooter")
+            unlink_highlight("FloatBorder")
+            unlink_highlight("WinBar")
+            unlink_highlight("WinBarNC")
+        end
+    end
+})
diff --git a/src/window/settings.rs b/src/window/settings.rs
index 0820091159..cc6f8422b9 100644
--- a/src/window/settings.rs
+++ b/src/window/settings.rs
@@ -23,6 +23,7 @@ pub struct WindowSettings {
     pub theme: String,
     pub input_macos_alt_is_meta: bool,
     pub input_ime: bool,
+    pub unlink_border_highlights: bool,
 
     #[option = "mousemoveevent"]
     pub mouse_move_event: bool,
@@ -59,6 +60,7 @@ impl Default for WindowSettings {
             mouse_move_event: false,
             observed_lines: None,
             observed_columns: None,
+            unlink_border_highlights: true,
         }
     }
 }
diff --git a/website/docs/configuration.md b/website/docs/configuration.md
index 926e54e605..c96f68974b 100644
--- a/website/docs/configuration.md
+++ b/website/docs/configuration.md
@@ -317,7 +317,7 @@ Lua:
 vim.g.neovide_underline_stroke_scale = 1.0
 ```
 
-**Unrelease yet.**
+**Unreleased yet.**
 
 Setting `g:neovide_underline_stroke_scale` to a floating point will increase or decrease the stroke
 width of the underlines (including undercurl, underdash, etc.). If the scaled stroke width is less
@@ -346,6 +346,29 @@ 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.
 
+#### Fix border and winbar scrolling glitches
+
+VimScript:
+
+```vim
+let g:neovide_unlink_border_highlights = v:true
+```
+
+Lua:
+
+```lua
+vim.g.neovide_unlink_border_highlights = true
+```
+
+**Unreleased yet.**
+
+Neovide uses some highlight groups for detecting the border of the windows, when scrolling. This
+detection is not perfect due to some limitations of Neovim, it only returns the final highlight
+groups for linked highlights. This option unlinks those highlight groups after the color scheme is
+loaded to make Neovide detect them properly.
+
+If this causes other problems, you can set this option to false.
+
 ### Functionality
 
 #### Refresh Rate