|
|
3ef2ca |
To: vim_dev@googlegroups.com
|
|
|
3ef2ca |
Subject: Patch 7.4.579
|
|
|
3ef2ca |
Fcc: outbox
|
|
|
3ef2ca |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
3ef2ca |
Mime-Version: 1.0
|
|
|
3ef2ca |
Content-Type: text/plain; charset=UTF-8
|
|
|
3ef2ca |
Content-Transfer-Encoding: 8bit
|
|
|
3ef2ca |
------------
|
|
|
3ef2ca |
|
|
|
3ef2ca |
Patch 7.4.579
|
|
|
3ef2ca |
Problem: Wrong cursor positioning when 'linebreak' is set and lines wrap.
|
|
|
3ef2ca |
Solution: Solve it. (Christian Brabandt)
|
|
|
3ef2ca |
Files: src/charset.c, src/screen.c
|
|
|
3ef2ca |
|
|
|
3ef2ca |
|
|
|
3ef2ca |
*** ../vim-7.4.578/src/charset.c 2014-10-31 12:41:57.427319153 +0100
|
|
|
3ef2ca |
--- src/charset.c 2015-01-14 19:34:38.916109031 +0100
|
|
|
3ef2ca |
***************
|
|
|
3ef2ca |
*** 1178,1205 ****
|
|
|
3ef2ca |
added = 0;
|
|
|
3ef2ca |
if ((*p_sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && col != 0)
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
! numberextra = win_col_off(wp);
|
|
|
3ef2ca |
col += numberextra + mb_added;
|
|
|
3ef2ca |
if (col >= (colnr_T)W_WIDTH(wp))
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
col -= W_WIDTH(wp);
|
|
|
3ef2ca |
numberextra = W_WIDTH(wp) - (numberextra - win_col_off2(wp));
|
|
|
3ef2ca |
! if (numberextra > 0)
|
|
|
3ef2ca |
col %= numberextra;
|
|
|
3ef2ca |
if (*p_sbr != NUL)
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
! colnr_T sbrlen = (colnr_T)MB_CHARLEN(p_sbr);
|
|
|
3ef2ca |
if (col >= sbrlen)
|
|
|
3ef2ca |
col -= sbrlen;
|
|
|
3ef2ca |
}
|
|
|
3ef2ca |
! if (numberextra > 0)
|
|
|
3ef2ca |
col = col % numberextra;
|
|
|
3ef2ca |
}
|
|
|
3ef2ca |
! if (col == 0 || col + size > (colnr_T)W_WIDTH(wp))
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
added = 0;
|
|
|
3ef2ca |
if (*p_sbr != NUL)
|
|
|
3ef2ca |
! added += vim_strsize(p_sbr);
|
|
|
3ef2ca |
if (wp->w_p_bri)
|
|
|
3ef2ca |
added += get_breakindent_win(wp, line);
|
|
|
3ef2ca |
|
|
|
3ef2ca |
--- 1178,1227 ----
|
|
|
3ef2ca |
added = 0;
|
|
|
3ef2ca |
if ((*p_sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && col != 0)
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
! colnr_T sbrlen = 0;
|
|
|
3ef2ca |
! int numberwidth = win_col_off(wp);
|
|
|
3ef2ca |
!
|
|
|
3ef2ca |
! numberextra = numberwidth;
|
|
|
3ef2ca |
col += numberextra + mb_added;
|
|
|
3ef2ca |
if (col >= (colnr_T)W_WIDTH(wp))
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
col -= W_WIDTH(wp);
|
|
|
3ef2ca |
numberextra = W_WIDTH(wp) - (numberextra - win_col_off2(wp));
|
|
|
3ef2ca |
! if (col >= numberextra && numberextra > 0)
|
|
|
3ef2ca |
col %= numberextra;
|
|
|
3ef2ca |
if (*p_sbr != NUL)
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
! sbrlen = (colnr_T)MB_CHARLEN(p_sbr);
|
|
|
3ef2ca |
if (col >= sbrlen)
|
|
|
3ef2ca |
col -= sbrlen;
|
|
|
3ef2ca |
}
|
|
|
3ef2ca |
! if (col >= numberextra && numberextra > 0)
|
|
|
3ef2ca |
col = col % numberextra;
|
|
|
3ef2ca |
+ else if (col > 0 && numberextra > 0)
|
|
|
3ef2ca |
+ col += numberwidth - win_col_off2(wp);
|
|
|
3ef2ca |
+
|
|
|
3ef2ca |
+ numberwidth -= win_col_off2(wp);
|
|
|
3ef2ca |
}
|
|
|
3ef2ca |
! if (col == 0 || col + size + sbrlen > (colnr_T)W_WIDTH(wp))
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
added = 0;
|
|
|
3ef2ca |
if (*p_sbr != NUL)
|
|
|
3ef2ca |
! {
|
|
|
3ef2ca |
! if (size + sbrlen + numberwidth > (colnr_T)W_WIDTH(wp))
|
|
|
3ef2ca |
! {
|
|
|
3ef2ca |
! /* calculate effective window width */
|
|
|
3ef2ca |
! int width = (colnr_T)W_WIDTH(wp) - sbrlen - numberwidth;
|
|
|
3ef2ca |
! int prev_width = col ? ((colnr_T)W_WIDTH(wp) - (sbrlen + col)) : 0;
|
|
|
3ef2ca |
! if (width == 0)
|
|
|
3ef2ca |
! width = (colnr_T)W_WIDTH(wp);
|
|
|
3ef2ca |
! added += ((size - prev_width) / width) * vim_strsize(p_sbr);
|
|
|
3ef2ca |
! if ((size - prev_width) % width)
|
|
|
3ef2ca |
! /* wrapped, add another length of 'sbr' */
|
|
|
3ef2ca |
! added += vim_strsize(p_sbr);
|
|
|
3ef2ca |
! }
|
|
|
3ef2ca |
! else
|
|
|
3ef2ca |
! added += vim_strsize(p_sbr);
|
|
|
3ef2ca |
! }
|
|
|
3ef2ca |
if (wp->w_p_bri)
|
|
|
3ef2ca |
added += get_breakindent_win(wp, line);
|
|
|
3ef2ca |
|
|
|
3ef2ca |
*** ../vim-7.4.578/src/screen.c 2015-01-07 19:04:25.299934570 +0100
|
|
|
3ef2ca |
--- src/screen.c 2015-01-14 19:27:46.428652958 +0100
|
|
|
3ef2ca |
***************
|
|
|
3ef2ca |
*** 2842,2847 ****
|
|
|
3ef2ca |
--- 2842,2850 ----
|
|
|
3ef2ca |
unsigned off; /* offset in ScreenLines/ScreenAttrs */
|
|
|
3ef2ca |
int c = 0; /* init for GCC */
|
|
|
3ef2ca |
long vcol = 0; /* virtual column (for tabs) */
|
|
|
3ef2ca |
+ #ifdef FEAT_LINEBREAK
|
|
|
3ef2ca |
+ long vcol_sbr = -1; /* virtual column after showbreak */
|
|
|
3ef2ca |
+ #endif
|
|
|
3ef2ca |
long vcol_prev = -1; /* "vcol" of previous character */
|
|
|
3ef2ca |
char_u *line; /* current line */
|
|
|
3ef2ca |
char_u *ptr; /* current position in "line" */
|
|
|
3ef2ca |
***************
|
|
|
3ef2ca |
*** 3759,3764 ****
|
|
|
3ef2ca |
--- 3762,3768 ----
|
|
|
3ef2ca |
n_extra = (int)STRLEN(p_sbr);
|
|
|
3ef2ca |
char_attr = hl_attr(HLF_AT);
|
|
|
3ef2ca |
need_showbreak = FALSE;
|
|
|
3ef2ca |
+ vcol_sbr = vcol + MB_CHARLEN(p_sbr);
|
|
|
3ef2ca |
/* Correct end of highlighted area for 'showbreak',
|
|
|
3ef2ca |
* required when 'linebreak' is also set. */
|
|
|
3ef2ca |
if (tocol == vcol)
|
|
|
3ef2ca |
***************
|
|
|
3ef2ca |
*** 4516,4524 ****
|
|
|
3ef2ca |
if (c == TAB && (!wp->w_p_list || lcs_tab1))
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
int tab_len = 0;
|
|
|
3ef2ca |
/* tab amount depends on current column */
|
|
|
3ef2ca |
tab_len = (int)wp->w_buffer->b_p_ts
|
|
|
3ef2ca |
! - vcol % (int)wp->w_buffer->b_p_ts - 1;
|
|
|
3ef2ca |
#ifdef FEAT_LINEBREAK
|
|
|
3ef2ca |
if (!wp->w_p_lbr || !wp->w_p_list)
|
|
|
3ef2ca |
#endif
|
|
|
3ef2ca |
--- 4520,4536 ----
|
|
|
3ef2ca |
if (c == TAB && (!wp->w_p_list || lcs_tab1))
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
int tab_len = 0;
|
|
|
3ef2ca |
+ long vcol_adjusted = vcol; /* removed showbreak length */
|
|
|
3ef2ca |
+ #ifdef FEAT_LINEBREAK
|
|
|
3ef2ca |
+ /* only adjust the tab_len, when at the first column
|
|
|
3ef2ca |
+ * after the showbreak value was drawn */
|
|
|
3ef2ca |
+ if (*p_sbr != NUL && vcol == vcol_sbr && wp->w_p_wrap)
|
|
|
3ef2ca |
+ vcol_adjusted = vcol - MB_CHARLEN(p_sbr);
|
|
|
3ef2ca |
+ #endif
|
|
|
3ef2ca |
/* tab amount depends on current column */
|
|
|
3ef2ca |
tab_len = (int)wp->w_buffer->b_p_ts
|
|
|
3ef2ca |
! - vcol_adjusted % (int)wp->w_buffer->b_p_ts - 1;
|
|
|
3ef2ca |
!
|
|
|
3ef2ca |
#ifdef FEAT_LINEBREAK
|
|
|
3ef2ca |
if (!wp->w_p_lbr || !wp->w_p_list)
|
|
|
3ef2ca |
#endif
|
|
|
3ef2ca |
*** ../vim-7.4.578/src/version.c 2015-01-14 19:00:33.842522901 +0100
|
|
|
3ef2ca |
--- src/version.c 2015-01-14 19:28:47.291982266 +0100
|
|
|
3ef2ca |
***************
|
|
|
3ef2ca |
*** 743,744 ****
|
|
|
3ef2ca |
--- 743,746 ----
|
|
|
3ef2ca |
{ /* Add new patch number below this line */
|
|
|
3ef2ca |
+ /**/
|
|
|
3ef2ca |
+ 579,
|
|
|
3ef2ca |
/**/
|
|
|
3ef2ca |
|
|
|
3ef2ca |
--
|
|
|
3ef2ca |
From "know your smileys":
|
|
|
3ef2ca |
O:-) Saint
|
|
|
3ef2ca |
|
|
|
3ef2ca |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
3ef2ca |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
3ef2ca |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
3ef2ca |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|