Comments (7)
Yeah, good point. That frame_key
thing was one of the first things I added to this codebase, and needless to say, I've learned a lot since then. My thinking was to do something like rate-limit redrawing, but I don't think that really makes any difference, and clearly causes some issues. So, let's just ditch the idea, and see how that goes.
from neogit.
Damn. Alright, I'll be able to take a look sometime in the next few days. Holidays, and all that :)
from neogit.
same question
from neogit.
@CKolkey I'm getting a very similar error, on both master
and nightly
. I'm running the latest neovim dev version (v0.10.0-dev-1947+gab2aad509d).
It happens after viewing a commit (<CR>
on a commit), closing the Commit View window (q
), and then moving the cursor. On master
, the specific error is
Error in decoration provider NeogitBufferViewDecorNeogitCommitView.end:
Error executing lua: .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:520: Invalid buffer id: 54
stack traceback:
[C]: in function 'get_changedtick'
.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:520: in function 'frame_key'
.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:530: in function <.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:529>
On nightly
, the error is very slightly different:
Error in decoration provider neogit-buffer-26-ViewDecor.end:
Error executing lua: .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:577: Invalid buffer id: 26
stack traceback:
[C]: in function 'get_changedtick'
.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:577: in function 'frame_key'
.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:587: in function <.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:586>
from neogit.
Simply pcall
ing buffer:get_changedtick()
in the same way as #1065 seems to at least get rid of the error for me (this diff is on nightly
):
diff --git a/lua/neogit/lib/buffer.lua b/lua/neogit/lib/buffer.lua
index ec099527..9977e5c6 100644
--- a/lua/neogit/lib/buffer.lua
+++ b/lua/neogit/lib/buffer.lua
@@ -574,7 +574,12 @@ function Buffer.create(config)
buffer:call(function()
local function frame_key()
- return table.concat { fn.line("w0"), fn.line("w$"), fn.getcurpos()[2], buffer:get_changedtick() }
+ local ok, tick = pcall(buffer.get_changedtick, buffer)
+ if ok then
+ return table.concat { fn.line("w0"), fn.line("w$"), fn.getcurpos()[2], tick }
+ else
+ return table.concat { fn.line("w0"), fn.line("w$"), fn.getcurpos()[2], "0" }
+ end
end
local last_frame_key = frame_key()
No idea if the change is correct or makes sense here, but the error at least goes away. Currently, once the error message appears, clicking any key just re-triggers the error, so it makes neovim entirely unusable.
from neogit.
Yeah, just didn't have a chance to merge master into nightly. I have now :)
from neogit.
Yeah, just didn't have a chance to merge master into nightly. I have now :)
#1065 doesn't fix my issue, unfortunately - that's in status.lua
whereas my error is coming from lib/buffer.lua
. My fix above is basically just making the same change as #1065 but in a different file.
I've also added a test print()
inside frame_key()
just to see when the function is actually being called, like so:
diff --git a/lua/neogit/lib/buffer.lua b/lua/neogit/lib/buffer.lua
index ec09952..e5528f7 100644
--- a/lua/neogit/lib/buffer.lua
+++ b/lua/neogit/lib/buffer.lua
@@ -573,8 +573,17 @@ function Buffer.create(config)
buffer:create_namespace("ViewDecor")
buffer:call(function()
+ local i = 0
+
local function frame_key()
- return table.concat { fn.line("w0"), fn.line("w$"), fn.getcurpos()[2], buffer:get_changedtick() }
+ local ok, tick = pcall(buffer.get_changedtick, buffer)
+ print("call", buffer.handle, i)
+ i = i + 1
+ if ok then
+ return table.concat { fn.line("w0"), fn.line("w$"), fn.getcurpos()[2], tick }
+ else
+ return table.concat { fn.line("w0"), fn.line("w$"), fn.getcurpos()[2], "0" }
+ end
end
local last_frame_key = frame_key()
And from that I can see that the frame_key
function is called every time the cursor moves or anything happens onscreen, even after the commit view and all other neogit views have been closed. I can't imagine this is intentional, so adding pcall
isn't fixing the root cause, just the symptom.
from neogit.
Related Issues (20)
- Events section in vim help
- Readme missing info about fuzzy finders
- Making the popup windows' names easily legible
- Expanding the "Recent commits" section sometimes doesn't work HOT 8
- Run git command with certain environment variables
- Neogit causes a black loading screen when starting neovim on v0.10 nightly
- ERROR while toggling diff: Blocking on future timed out or was interrupted.
- Renamed file cannot be shown properly HOT 9
- Revert changes to DiffAtFile action HOT 1
- Multitude of keymap issues during user customization HOT 6
- Neogit tab fails to load HOT 12
- Logo for Neogit HOT 14
- Status bufer not focused nor is status updated on new cwd
- Failing to open popups for more than one repositories
- Option to open status with the current file selected
- Status buffer broken during rebase with unmerged paths HOT 4
- Compose commit messages while pre-commit hooks are running HOT 4
- Cannot checkout worktree HOT 2
- `w` opens up worktree instead of jumping a word HOT 4
- Telescope integration not working HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neogit.