Mercurial > vim
diff src/normal.c @ 12515:972ea22c946f v8.0.1136
patch 8.0.1136: W_WIDTH() is always the same
commit https://github.com/vim/vim/commit/0263146b5dbbb6c120ce2e7720256503b864425d
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 22 15:20:32 2017 +0200
patch 8.0.1136: W_WIDTH() is always the same
Problem: W_WIDTH() is always the same.
Solution: Expand the macro.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 22 Sep 2017 15:30:06 +0200 |
parents | 3f16cf18386c |
children | f62696bd1a9f |
line wrap: on
line diff
--- a/src/normal.c +++ b/src/normal.c @@ -4448,8 +4448,8 @@ nv_screengo(oparg_T *oap, int dir, long col_off1 = curwin_col_off(); col_off2 = col_off1 - curwin_col_off2(); - width1 = W_WIDTH(curwin) - col_off1; - width2 = W_WIDTH(curwin) - col_off2; + width1 = curwin->w_width - col_off1; + width2 = curwin->w_width - col_off2; if (width2 == 0) width2 = 1; /* avoid divide by zero */ @@ -4634,7 +4634,7 @@ nv_mousescroll(cmdarg_T *cap) int val, step = 6; if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) - step = W_WIDTH(curwin); + step = curwin->w_width; val = curwin->w_leftcol + (cap->arg == MSCR_RIGHT ? -step : +step); if (val < 0) val = 0; @@ -4886,7 +4886,7 @@ dozet: /* "zH" - scroll screen right half-page */ case 'H': - cap->count1 *= W_WIDTH(curwin) / 2; + cap->count1 *= curwin->w_width / 2; /* FALLTHROUGH */ /* "zh" - scroll screen to the right */ @@ -4903,7 +4903,7 @@ dozet: break; /* "zL" - scroll screen left half-page */ - case 'L': cap->count1 *= W_WIDTH(curwin) / 2; + case 'L': cap->count1 *= curwin->w_width / 2; /* FALLTHROUGH */ /* "zl" - scroll screen to the left */ @@ -4947,7 +4947,7 @@ dozet: else #endif getvcol(curwin, &curwin->w_cursor, NULL, NULL, &col); - n = W_WIDTH(curwin) - curwin_col_off(); + n = curwin->w_width - curwin_col_off(); if ((long)col + p_siso < n) col = 0; else @@ -8073,7 +8073,7 @@ nv_g_cmd(cmdarg_T *cap) oap->inclusive = FALSE; if (curwin->w_p_wrap && curwin->w_width != 0) { - int width1 = W_WIDTH(curwin) - curwin_col_off(); + int width1 = curwin->w_width - curwin_col_off(); int width2 = width1 + curwin_col_off2(); validate_virtcol(); @@ -8087,7 +8087,7 @@ nv_g_cmd(cmdarg_T *cap) * 'relativenumber' is on and lines are wrapping the middle can be more * to the left. */ if (cap->nchar == 'm') - i += (W_WIDTH(curwin) - curwin_col_off() + i += (curwin->w_width - curwin_col_off() + ((curwin->w_p_wrap && i > 0) ? curwin_col_off2() : 0)) / 2; coladvance((colnr_T)i); @@ -8139,7 +8139,7 @@ nv_g_cmd(cmdarg_T *cap) curwin->w_curswant = MAXCOL; /* so we stay at the end */ if (cap->count1 == 1) { - int width1 = W_WIDTH(curwin) - col_off; + int width1 = curwin->w_width - col_off; int width2 = width1 + curwin_col_off2(); validate_virtcol(); @@ -8171,7 +8171,7 @@ nv_g_cmd(cmdarg_T *cap) } else { - i = curwin->w_leftcol + W_WIDTH(curwin) - col_off - 1; + i = curwin->w_leftcol + curwin->w_width - col_off - 1; coladvance((colnr_T)i); /* Make sure we stick in this column. */ @@ -9565,7 +9565,7 @@ get_op_vcol( colnr_T start, end; if (VIsual_mode != Ctrl_V - || (!initial && oap->end.col < W_WIDTH(curwin))) + || (!initial && oap->end.col < curwin->w_width)) return; oap->block_mode = TRUE;