comparison src/normal.c @ 10154:4647267906cc v7.4.2347

commit https://github.com/vim/vim/commit/c4a908e83690844b0d3a46124ba6af7d23485d69 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 8 23:35:30 2016 +0200 patch 7.4.2347 Problem: Crash when closing a buffer while Visual mode is active. (Dominique Pelle) Solution: Adjust the position before computing the number of lines. When closing the current buffer stop Visual mode.
author Christian Brabandt <cb@256bit.org>
date Thu, 08 Sep 2016 23:45:06 +0200
parents cfb38b57d407
children 758f3d5a463d
comparison
equal deleted inserted replaced
10153:715d6c5707b8 10154:4647267906cc
1607 #endif 1607 #endif
1608 oap->end = oap->start; 1608 oap->end = oap->start;
1609 oap->start = curwin->w_cursor; 1609 oap->start = curwin->w_cursor;
1610 } 1610 }
1611 1611
1612 /* Just in case lines were deleted that make the position invalid. */
1613 check_pos(curwin->w_buffer, &oap->end);
1612 oap->line_count = oap->end.lnum - oap->start.lnum + 1; 1614 oap->line_count = oap->end.lnum - oap->start.lnum + 1;
1613 1615
1614 #ifdef FEAT_VIRTUALEDIT 1616 #ifdef FEAT_VIRTUALEDIT
1615 /* Set "virtual_op" before resetting VIsual_active. */ 1617 /* Set "virtual_op" before resetting VIsual_active. */
1616 virtual_op = virtual_active(); 1618 virtual_op = virtual_active();
9449 oap->block_mode = TRUE; 9451 oap->block_mode = TRUE;
9450 9452
9451 #ifdef FEAT_MBYTE 9453 #ifdef FEAT_MBYTE
9452 /* prevent from moving onto a trail byte */ 9454 /* prevent from moving onto a trail byte */
9453 if (has_mbyte) 9455 if (has_mbyte)
9454 {
9455 check_pos(curwin->w_buffer, &oap->end);
9456 mb_adjustpos(curwin->w_buffer, &oap->end); 9456 mb_adjustpos(curwin->w_buffer, &oap->end);
9457 }
9458 #endif 9457 #endif
9459 9458
9460 getvvcol(curwin, &(oap->start), &oap->start_vcol, NULL, &oap->end_vcol); 9459 getvvcol(curwin, &(oap->start), &oap->start_vcol, NULL, &oap->end_vcol);
9461 9460
9462 if (!redo_VIsual_busy) 9461 if (!redo_VIsual_busy)