Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork6.5k
fix(decorations): line('w$') wrong in on_start#36957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Problem:When a floating window is created and drawn for the first time,line('w$') can be wrong in decoration provider on_start callback.Solution:Validate botline before invoking on_start.tomtomjhj commentedDec 14, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I think this is not the correct fix.
So the actual problem is why botline is incorrect after validation. I don't have time to investigate this right now. Here is my observation so far. Apply this patch to print some logs diff --git a/src/nvim/eval.c b/src/nvim/eval.cindex dd4ebf7be1..0070357fe1 100644--- a/src/nvim/eval.c+++ b/src/nvim/eval.c@@ -5363,12 +5363,14 @@ pos_T *var2fpos(const typval_T *const tv, const bool dollar_lnum, int *const ret pos.col = 0; if (name[1] == '0') { // "w0": first visible line+ smsg(0, "var2pos('w0', %d)", curwin->handle); update_topline(curwin); // In silent Ex mode topline is zero, but that's not a valid line // number; use one instead. pos.lnum = curwin->w_topline > 0 ? curwin->w_topline : 1; return &pos; } else if (name[1] == '$') { // "w$": last visible line+ smsg(0, "var2pos('w$', %d)", curwin->handle); validate_botline(curwin); // In silent Ex mode botline is zero, return zero then. pos.lnum = curwin->w_botline > 0 ? curwin->w_botline - 1 : 0;diff --git a/src/nvim/move.c b/src/nvim/move.cindex 762f6b7d51..7cbbdaa0aa 100644--- a/src/nvim/move.c+++ b/src/nvim/move.c@@ -610,9 +610,11 @@ void changed_line_abv_curs_win(win_T *wp) // Make sure the value of wp->w_botline is valid. void validate_botline(win_T *wp) {+ smsg(0, "validate_botline %d, valid %d, botline %d", wp->handle, wp->w_valid, wp->w_botline); if (!(wp->w_valid & VALID_BOTLINE)) { comp_botline(wp); }+ smsg(0, "updated botline %d", wp->w_botline); } // Mark wp->w_botline as invalid (because of some change in the buffer). Build, then run nvim with Dismiss the hit-enter prompt and see the log with 1002 is the win id of the floating window. |
Uh oh!
There was an error while loading.Please reload this page.
Problem:
When a floating window is created and drawn for the first time, line('w$') can be wrong in decoration provider on_start callback.
Solution:
Validate botline before invoking on_start.
Fixes:#36641,#36609.
Related:#26833