Giter Club home page Giter Club logo

Comments (13)

romgrk avatar romgrk commented on May 26, 2024 1

#41 should fix the issue.

Edit: it's merged. Can you check if it's good on your side?

from nvim-treesitter-context.

lucypero avatar lucypero commented on May 26, 2024

Dupicate of #16

from nvim-treesitter-context.

romgrk avatar romgrk commented on May 26, 2024

It is currently not reproducible on my setup. What version of things are you using? All up to date?

from nvim-treesitter-context.

lucypero avatar lucypero commented on May 26, 2024

Yes

Latest nvim nightly release as of now.
NVIM v0.5.0-dev+1194-gc20ae3aad
Build type: RelWithDebInfo

Every plugin and treesitter parser is up to date

from nvim-treesitter-context.

romgrk avatar romgrk commented on May 26, 2024

Can you apply this patch, and report what you see in :message after trying to insert a few chars?

diff --git a/lua/treesitter-context.lua b/lua/treesitter-context.lua
index 0f5f35a..c8c3d27 100644
--- a/lua/treesitter-context.lua
+++ b/lua/treesitter-context.lua
@@ -186,6 +186,7 @@ do
   local line
   cursor_moved_vertical = function()
     local newline =  vim.api.nvim_win_get_cursor(0)[1]
+    log_message({newline, line})
     if newline ~= line then
       line = newline
       return true

The gutter width shouldn't update when the cursor hasn't moved vertically.

from nvim-treesitter-context.

lucypero avatar lucypero commented on May 26, 2024

I'm not getting any messages in :message after applying the patch

from nvim-treesitter-context.

romgrk avatar romgrk commented on May 26, 2024

Oh right forgot to remove the silents:

diff --git a/lua/treesitter-context.lua b/lua/treesitter-context.lua
index 0f5f35a..62b03c5 100644
--- a/lua/treesitter-context.lua
+++ b/lua/treesitter-context.lua
@@ -186,6 +186,7 @@ do
   local line
   cursor_moved_vertical = function()
     local newline =  vim.api.nvim_win_get_cursor(0)[1]
+    log_message({newline, line})
     if newline ~= line then
       line = newline
       return true
@@ -489,15 +490,15 @@ end
 
 function M.enable()
   nvim_augroup('treesitter_context', {
-    {'WinScrolled', '*',                   'silent lua require("treesitter-context").update_context()'},
-    {'User',        'CursorMovedVertical', 'silent lua require("treesitter-context").update_context()'},
-    {'CursorMoved', '*',                   'silent lua require("treesitter-context").do_au_cursor_moved_vertical()'},
-    {'BufEnter',    '*',                   'silent lua require("treesitter-context").update_context()'},
-    {'WinEnter',    '*',                   'silent lua require("treesitter-context").update_context()'},
-    {'WinLeave',    '*',                   'silent lua require("treesitter-context").close()'},
-    {'VimResized',  '*',                   'silent lua require("treesitter-context").open()'},
-    {'User',        'SessionSavePre',      'silent lua require("treesitter-context").close()'},
-    {'User',        'SessionSavePost',     'silent lua require("treesitter-context").open()'},
+    {'WinScrolled', '*',                   'lua require("treesitter-context").update_context()'},
+    {'User',        'CursorMovedVertical', 'lua require("treesitter-context").update_context()'},
+    {'CursorMoved', '*',                   'lua require("treesitter-context").do_au_cursor_moved_vertical()'},
+    {'BufEnter',    '*',                   'lua require("treesitter-context").update_context()'},
+    {'WinEnter',    '*',                   'lua require("treesitter-context").update_context()'},
+    {'WinLeave',    '*',                   'lua require("treesitter-context").close()'},
+    {'VimResized',  '*',                   'lua require("treesitter-context").open()'},
+    {'User',        'SessionSavePre',      'lua require("treesitter-context").close()'},
+    {'User',        'SessionSavePost',     'lua require("treesitter-context").open()'},
   })
 
   M.throttled_update_context()

from nvim-treesitter-context.

lucypero avatar lucypero commented on May 26, 2024

ok now i'm getting messages

[1475]                                                                                                                                        
[1476, 1475]                                                                                                                                  
[1477, 1476]                                                                                                                                  
[1478, 1477]                                                                                                                                  
[1478, 1478]                                                                                                                                  
[1477, 1478]                                                                                                                                  
[1478, 1477]                                                                                                                                  
[1477, 1478]                                                                                                                                  
[1476, 1477]                                                                                                                                  
[1475, 1476]                                                                                                                                  
[1474, 1475]                                                                                                                                  
[1473, 1474]                                                                                                                                  
[1475, 1473]                                                                                                                                  
[1475, 1475]                                                                                                                                  
[1475, 1475]                                                                                                                                  
[1475, 1475]                                                                                                                                  
[1475, 1475]                                                                                                                                  
[1475, 1475]                                                                                                                                  
[1475, 1475]                                                                                                                                  
[1475, 1475]                                                                                                                                  
[1475, 1475]                                                                                                                                  
[1475, 1475]                                                                                                                                  
[1475, 1475]                                                                                                                                  
[1475, 1475]

from nvim-treesitter-context.

romgrk avatar romgrk commented on May 26, 2024

And that is without moving the cursor vertically? Does the change below logs "cursor_moved_vertical" when you type text?

diff --git a/lua/treesitter-context.lua b/lua/treesitter-context.lua
index 0f5f35a..cb2bce8 100644
--- a/lua/treesitter-context.lua
+++ b/lua/treesitter-context.lua
@@ -224,6 +224,7 @@ local M = {}
 
 function M.do_au_cursor_moved_vertical()
   if cursor_moved_vertical() then
+    log_message({'cursor_moved_vertical'})
     vim.cmd [[doautocmd User CursorMovedVertical]]
   end
 end

from nvim-treesitter-context.

romgrk avatar romgrk commented on May 26, 2024

One more thing, are you able to reproduce the issue with a minimal vimrc like this? I still can't reproduce (latest everything), I wonder if it's an interaction with something else.

let $PLUGIN_DIRECTORY = '~/.config/nvim/bundle'
set runtimepath^=$PLUGIN_DIRECTORY/nvim-treesitter
set runtimepath^=$PLUGIN_DIRECTORY/nvim-treesitter-context

from nvim-treesitter-context.

lucypero avatar lucypero commented on May 26, 2024

Yes. The bug is still present, running with this config:

nvim -u minimal_config.vim

let $PLUGIN_DIRECTORY = '~/.local/share/nvim/plugged'
set runtimepath^=$PLUGIN_DIRECTORY/nvim-treesitter
set runtimepath^=$PLUGIN_DIRECTORY/nvim-treesitter-context

Not only that, the plugin is even more bugged out when running this config. Take a look at how it behaves

2021-04-08_01-29-13.mp4

from nvim-treesitter-context.

lucypero avatar lucypero commented on May 26, 2024

And that is without moving the cursor vertically? Does the change below logs "cursor_moved_vertical" when you type text?

No. After adding some text typing Ahello<esc>, it just outputs [1500,1500]

from nvim-treesitter-context.

lucypero avatar lucypero commented on May 26, 2024

Looks like it's fixed. Great ๐Ÿ˜ Thank you

from nvim-treesitter-context.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.