To: vim-dev@vim.org Subject: Patch 7.2.164 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 7.2.164 Problem: When 'showbreak' is set the size of the Visual block may be reported wrong. (Eduardo Daudt Flach) Solution: Temporarily make 'sbr' empty. Files: src/normal.c, src/ops.c *** ../vim-7.2.163/src/normal.c Sat Feb 21 20:27:00 2009 --- src/normal.c Wed Apr 22 18:30:20 2009 *************** *** 3709,3721 **** #ifdef FEAT_VISUAL if (VIsual_active && !char_avail()) { ! int i = lt(VIsual, curwin->w_cursor); long lines; colnr_T leftcol, rightcol; linenr_T top, bot; /* Show the size of the Visual area. */ ! if (i) { top = VIsual.lnum; bot = curwin->w_cursor.lnum; --- 3709,3721 ---- #ifdef FEAT_VISUAL if (VIsual_active && !char_avail()) { ! int cursor_bot = lt(VIsual, curwin->w_cursor); long lines; colnr_T leftcol, rightcol; linenr_T top, bot; /* Show the size of the Visual area. */ ! if (cursor_bot) { top = VIsual.lnum; bot = curwin->w_cursor.lnum; *************** *** 3734,3747 **** if (VIsual_mode == Ctrl_V) { getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol); sprintf((char *)showcmd_buf, "%ldx%ld", lines, (long)(rightcol - leftcol + 1)); } else if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum) sprintf((char *)showcmd_buf, "%ld", lines); else ! sprintf((char *)showcmd_buf, "%ld", (long)(i ? curwin->w_cursor.col - VIsual.col : VIsual.col - curwin->w_cursor.col) + (*p_sel != 'e')); showcmd_buf[SHOWCMD_COLS] = NUL; /* truncate */ --- 3734,3756 ---- if (VIsual_mode == Ctrl_V) { + #ifdef FEAT_LINEBREAK + char_u *saved_sbr = p_sbr; + + /* Make 'sbr' empty for a moment to get the correct size. */ + p_sbr = empty_option; + #endif getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol); + #ifdef FEAT_LINEBREAK + p_sbr = saved_sbr; + #endif sprintf((char *)showcmd_buf, "%ldx%ld", lines, (long)(rightcol - leftcol + 1)); } else if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum) sprintf((char *)showcmd_buf, "%ld", lines); else ! sprintf((char *)showcmd_buf, "%ld", (long)(cursor_bot ? curwin->w_cursor.col - VIsual.col : VIsual.col - curwin->w_cursor.col) + (*p_sel != 'e')); showcmd_buf[SHOWCMD_COLS] = NUL; /* truncate */ *** ../vim-7.2.163/src/ops.c Wed Apr 22 17:42:53 2009 --- src/ops.c Wed Apr 22 18:30:07 2009 *************** *** 392,398 **** colnr_T ws_vcol; int i = 0, j = 0; int len; - #ifdef FEAT_RIGHTLEFT int old_p_ri = p_ri; --- 392,397 ---- *************** *** 6284,6294 **** --- 6283,6302 ---- if (VIsual_mode == Ctrl_V) { + #ifdef FEAT_LINEBREAK + char_u * saved_sbr = p_sbr; + + /* Make 'sbr' empty for a moment to get the correct size. */ + p_sbr = empty_option; + #endif oparg.is_VIsual = 1; oparg.block_mode = TRUE; oparg.op_type = OP_NOP; getvcols(curwin, &min_pos, &max_pos, &oparg.start_vcol, &oparg.end_vcol); + #ifdef FEAT_LINEBREAK + p_sbr = saved_sbr; + #endif if (curwin->w_curswant == MAXCOL) oparg.end_vcol = MAXCOL; /* Swap the start, end vcol if needed */ *** ../vim-7.2.163/src/version.c Wed Apr 29 12:03:35 2009 --- src/version.c Wed Apr 29 17:38:05 2009 *************** *** 678,679 **** --- 678,681 ---- { /* Add new patch number below this line */ + /**/ + 164, /**/ -- There are 10 kinds of people: Those who understand binary and those who don't. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///