aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-08-20 12:24:34 -0400
committerJustin M. Keyes <justinkz@gmail.com>2014-08-20 12:24:34 -0400
commit118a31c24c7ce76da909026cd10a94feb88803bc (patch)
tree8bbd708d924ef68017949e4bf9b773d5d833b82d /src/nvim/ops.c
parentbbefc73c553d681f78f40df9d97ec89ae9b06520 (diff)
parent3b0f7fe59392138c886063b09e3cf41b25d53056 (diff)
downloadrneovim-118a31c24c7ce76da909026cd10a94feb88803bc.tar.gz
rneovim-118a31c24c7ce76da909026cd10a94feb88803bc.tar.bz2
rneovim-118a31c24c7ce76da909026cd10a94feb88803bc.zip
Merge pull request #691 from fmoralesc/master
Port vim's breakindent patch to neovim's codebase. (vim patches 7.4.338, 7.4.346, 7.4.352, 7.4.353, 7.4.370, 7.4.371, 7.4.388)
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 0bf338947b..0b0a913a95 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -350,7 +350,8 @@ static void shift_block(oparg_T *oap, int amount)
++bd.textstart;
}
for (; vim_iswhite(*bd.textstart); ) {
- incr = lbr_chartabsize_adv(&bd.textstart, (colnr_T)(bd.start_vcol));
+ // TODO: is passing bd.textstart for start of the line OK?
+ incr = lbr_chartabsize_adv(bd.textstart, &bd.textstart, (colnr_T)(bd.start_vcol));
total += incr;
bd.start_vcol += incr;
}
@@ -405,7 +406,7 @@ static void shift_block(oparg_T *oap, int amount)
non_white_col = bd.start_vcol;
while (vim_iswhite(*non_white)) {
- incr = lbr_chartabsize_adv(&non_white, non_white_col);
+ incr = lbr_chartabsize_adv(bd.textstart, &non_white, non_white_col);
non_white_col += incr;
}
@@ -429,7 +430,10 @@ static void shift_block(oparg_T *oap, int amount)
if (bd.startspaces)
verbatim_copy_width -= bd.start_char_vcols;
while (verbatim_copy_width < destination_col) {
- incr = lbr_chartabsize(verbatim_copy_end, verbatim_copy_width);
+ char_u *line = verbatim_copy_end;
+
+ // TODO: is passing verbatim_copy_end for start of the line OK?
+ incr = lbr_chartabsize(line, verbatim_copy_end, verbatim_copy_width);
if (verbatim_copy_width + incr > destination_col)
break;
verbatim_copy_width += incr;
@@ -2824,7 +2828,7 @@ do_put (
oldlen = (int)STRLEN(oldp);
for (ptr = oldp; vcol < col && *ptr; ) {
/* Count a tab for what it's worth (if list mode not on) */
- incr = lbr_chartabsize_adv(&ptr, (colnr_T)vcol);
+ incr = lbr_chartabsize_adv(oldp, &ptr, (colnr_T)vcol);
vcol += incr;
}
bd.textcol = (colnr_T)(ptr - oldp);
@@ -2854,7 +2858,7 @@ do_put (
/* calculate number of spaces required to fill right side of block*/
spaces = y_width + 1;
for (j = 0; j < yanklen; j++)
- spaces -= lbr_chartabsize(&y_array[i][j], 0);
+ spaces -= lbr_chartabsize(NULL, &y_array[i][j], 0);
if (spaces < 0)
spaces = 0;
@@ -4114,7 +4118,7 @@ static void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum, int i
prev_pstart = line;
while (bdp->start_vcol < oap->start_vcol && *pstart) {
/* Count a tab for what it's worth (if list mode not on) */
- incr = lbr_chartabsize(pstart, (colnr_T)bdp->start_vcol);
+ incr = lbr_chartabsize(line, pstart, (colnr_T)bdp->start_vcol);
bdp->start_vcol += incr;
if (vim_iswhite(*pstart)) {
bdp->pre_whitesp += incr;
@@ -4163,7 +4167,9 @@ static void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum, int i
while (bdp->end_vcol <= oap->end_vcol && *pend != NUL) {
/* Count a tab for what it's worth (if list mode not on) */
prev_pend = pend;
- incr = lbr_chartabsize_adv(&pend, (colnr_T)bdp->end_vcol);
+ // TODO: is passing prev_pend for start of the line OK?
+ // prehaps it should be "line"
+ incr = lbr_chartabsize_adv(prev_pend, &pend, (colnr_T)bdp->end_vcol);
bdp->end_vcol += incr;
}
if (bdp->end_vcol <= oap->end_vcol