plines_win_nofold(): Ignore virtcols after 32000th computation #3527

Avoid crashing or hanging when editing a file than contains ludicrously
long lines (more than 100,000,000 virtual columns).

The change is in plines_win_nofold, which is called by wrapping and folding
code. As a result, wrapping and folding may be done incorrectly when the UI is
capable of rendering more than 32000 characters at a time (tiny font).

fixes #2838
This commit is contained in:
Victor Adam 2015-06-17 11:38:47 +02:00 committed by Justin M. Keyes
parent 9db42d4ce9
commit e4a974c7cc

View File

@ -1273,7 +1273,7 @@ int plines_win_nofold(win_T *wp, linenr_T lnum)
* Add column offset for 'number', 'relativenumber' and 'foldcolumn'. * Add column offset for 'number', 'relativenumber' and 'foldcolumn'.
*/ */
width = wp->w_width - win_col_off(wp); width = wp->w_width - win_col_off(wp);
if (width <= 0) { if (width <= 0 || col > 32000) {
return 32000; // bigger than the number of lines of the screen return 32000; // bigger than the number of lines of the screen
} }
if (col <= (unsigned int)width) { if (col <= (unsigned int)width) {