Patch 8.2.2198
Problem: ml_get error when resizing window and using text property.
Solution: Validate botline of the right window. (closes #7528)
Files: src/move.c, src/proto/move.pro, src/textprop.c,
src/testdir/test_textprop.vim
*** ../vim-8.2.2197/src/move.c 2020-12-17 21:35:25.747874396 +0100
--- src/move.c 2020-12-23 14:29:59.844130303 +0100
***************
*** 541,546 ****
--- 541,548 ----
#endif
// Approximate the value of w_botline
wp->w_botline += lnum - wp->w_topline;
+ if (wp->w_botline > wp->w_buffer->b_ml.ml_line_count + 1)
+ wp->w_botline = wp->w_buffer->b_ml.ml_line_count + 1;
wp->w_topline = lnum;
wp->w_topline_was_set = TRUE;
#ifdef FEAT_DIFF
***************
*** 595,602 ****
void
validate_botline(void)
{
! if (!(curwin->w_valid & VALID_BOTLINE))
! comp_botline(curwin);
}
/*
--- 597,613 ----
void
validate_botline(void)
{
! validate_botline_win(curwin);
! }
!
! /*
! * Make sure the value of wp->w_botline is valid.
! */
! void
! validate_botline_win(win_T *wp)
! {
! if (!(wp->w_valid & VALID_BOTLINE))
! comp_botline(wp);
}
/*
*** ../vim-8.2.2197/src/proto/move.pro 2019-12-14 18:41:52.155639334 +0100
--- src/proto/move.pro 2020-12-23 14:14:15.463772125 +0100
***************
*** 13,18 ****
--- 13,19 ----
void changed_line_abv_curs(void);
void changed_line_abv_curs_win(win_T *wp);
void validate_botline(void);
+ void validate_botline_win(win_T *wp);
void invalidate_botline(void);
void invalidate_botline_win(win_T *wp);
void approximate_botline_win(win_T *wp);
*** ../vim-8.2.2197/src/textprop.c 2020-12-18 19:49:52.349571840 +0100
--- src/textprop.c 2020-12-23 14:30:05.472114225 +0100
***************
*** 419,425 ****
int i;
// w_botline may not have been updated yet.
! validate_botline();
for (lnum = wp->w_topline; lnum < wp->w_botline; ++lnum)
{
count = get_text_props(wp->w_buffer, lnum, &props, FALSE);
--- 419,425 ----
int i;
// w_botline may not have been updated yet.
! validate_botline_win(wp);
for (lnum = wp->w_topline; lnum < wp->w_botline; ++lnum)
{
count = get_text_props(wp->w_buffer, lnum, &props, FALSE);
*** ../vim-8.2.2197/src/testdir/test_textprop.vim 2020-12-02
17:36:49.177409727 +0100
--- src/testdir/test_textprop.vim 2020-12-23 14:30:24.396059720 +0100
***************
*** 1358,1361 ****
--- 1358,1381 ----
call prop_type_delete('test')
endfunc
+ " this was causing an ml_get error because w_botline was wrong
+ func Test_prop_one_line_window()
+ enew
+ call range(2)->setline(1)
+ call prop_type_add('testprop', {})
+ call prop_add(1, 1, {'type': 'testprop'})
+ call popup_create('popup', {'textprop': 'testprop'})
+ $
+ new
+ wincmd _
+ call feedkeys("\r", 'xt')
+ redraw
+
+ call popup_clear()
+ call prop_type_delete('testprop')
+ close
+ bwipe!
+ endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2197/src/version.c 2020-12-23 12:50:16.575182402 +0100
--- src/version.c 2020-12-23 14:30:49.495986467 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2198,
/**/
--
hundred-and-one symptoms of being an internet addict:
12. You turn off your Wifi and get this awful empty feeling, like you just
pulled the plug on a loved one.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202012231336.0BNDaQbp2882286%40masaka.moolenaar.net.