From f3ad74315d95c58e17eced0e37cf6bf019f12f88 Mon Sep 17 00:00:00 2001 From: hedy Date: Sun, 12 Nov 2023 08:30:05 +0800 Subject: [PATCH] fix: Outline refresh on CursorHold event moving cursor Closes #7 --- lua/symbols-outline/init.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lua/symbols-outline/init.lua b/lua/symbols-outline/init.lua index b14ad86..a62c6d6 100644 --- a/lua/symbols-outline/init.lua +++ b/lua/symbols-outline/init.lua @@ -252,11 +252,15 @@ function M._highlight_current_item(winnr) return end - if - not has_outline_open -- Outline not open - -- Not currently on outline window, but no code window is given. - or (not winnr and not current_buffer_is_outline) - then + if current_buffer_is_outline and not winnr then + -- Don't update cursor pos and content if they are navigating the outline. + -- Winnr may be given when user explicitly wants to restore location + -- (follow_cursor), or through the open handler. + return + end + + if not has_outline_open and not winnr then + -- Outline not open and no code window given return end