Mercurial > vim
view src/if_perlsfio.c @ 34389:8b0e390b61fe v9.1.0121
patch 9.1.0121: Infinite loop or signed overflow with 'smoothscroll'
Commit: https://github.com/vim/vim/commit/02fcae02a926e4e8379d77fb716da4202029882d
Author: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Date: Wed Feb 21 19:40:44 2024 +0100
patch 9.1.0121: Infinite loop or signed overflow with 'smoothscroll'
Problem: infinite loop in win_update with 'smoothscroll' set when
window width is equal to textoff, or signed integer overflow
if smaller.
Solution: don't revalidate wp->w_skipcol in that case, as no buffer text
is being shown. (Sean Dewar)
Don't instead reset w_skipcol; that would lose the scroll position
within the line, which may be undesirable if the window is made wider
later.
Also include changes from the splitmove PR #14042 that I (in my infinite
Git wisdom) forgot to commit. This includes a change to
Test_window_split_no_room to ensure it doesn't fail for some screen
sizes.
Move Test_smoothscroll_in_zero_width_window to test_scroll_opt.vim, as
that file feels more appropriate.
closes: #14068
Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 21 Feb 2024 19:45:06 +0100 |
parents | f0f9692d4487 |
children |
line wrap: on
line source
/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * * Do ":help uganda" in Vim to read copying and usage conditions. * Do ":help credits" in Vim to see a list of people who contributed. * See README.txt for an overview of the Vim source code. */ /* * if_perlsfio.c: Special I/O functions for Perl interface. */ #define _memory_h // avoid memset redeclaration #define IN_PERL_FILE // don't include if_perl.pro from prot.h #include "vim.h" #if defined(USE_SFIO) || defined(PROTO) #ifndef USE_SFIO // just generating prototypes # define Sfio_t int # define Sfdisc_t int #endif #define NIL(type) ((type)0) static int sfvimwrite( Sfio_t *f, // stream involved char *buf, // buffer to read from int n, // number of bytes to write Sfdisc_t *disc) // discipline { char_u *str; str = vim_strnsave((char_u *)buf, n); if (str == NULL) return 0; msg_split((char *)str); vim_free(str); return n; } /* * sfdcnewnvi -- * Create Vim discipline */ Sfdisc_t * sfdcnewvim(void) { Sfdisc_t *disc; disc = ALLOC_ONE(Sfdisc_t); if (disc == NULL) return NULL; disc->readf = (Sfread_f)NULL; disc->writef = sfvimwrite; disc->seekf = (Sfseek_f)NULL; disc->exceptf = (Sfexcept_f)NULL; return disc; } #endif // USE_SFIO