summaryrefslogtreecommitdiffstats
path: root/src/ops.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ops.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/ops.c b/src/ops.c
index eb75c34..eb8f64c 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -240,8 +240,8 @@ shift_line(
if (round) // round off indent
{
- i = count / sw_val; // number of 'shiftwidth' rounded down
- j = count % sw_val; // extra spaces
+ i = trim_to_int(count) / sw_val; // number of 'shiftwidth' rounded down
+ j = trim_to_int(count) % sw_val; // extra spaces
if (j && left) // first remove extra spaces
--amount;
if (left)
@@ -676,6 +676,7 @@ op_delete(oparg_T *oap)
&& !oap->block_mode
&& oap->line_count > 1
&& oap->motion_force == NUL
+ && (vim_strchr(p_cpo, CPO_WORD) != NULL)
&& oap->op_type == OP_DELETE)
{
ptr = ml_get(oap->end.lnum) + oap->end.col;
@@ -2673,6 +2674,8 @@ do_addsub(
int do_bin;
int do_alpha;
int do_unsigned;
+ int do_blank;
+ int blank_unsigned = FALSE; // blank: treat as unsigned?
int firstdigit;
int subtract;
int negative = FALSE;
@@ -2690,6 +2693,7 @@ do_addsub(
do_bin = (vim_strchr(curbuf->b_p_nf, 'b') != NULL); // "Bin"
do_alpha = (vim_strchr(curbuf->b_p_nf, 'p') != NULL); // "alPha"
do_unsigned = (vim_strchr(curbuf->b_p_nf, 'u') != NULL); // "Unsigned"
+ do_blank = (vim_strchr(curbuf->b_p_nf, 'k') != NULL); // "blanK"
if (virtual_active())
{
@@ -2813,8 +2817,13 @@ do_addsub(
&& (!has_mbyte || !(*mb_head_off)(ptr, ptr + col - 1))
&& !do_unsigned)
{
- negative = TRUE;
- was_positive = FALSE;
+ if (do_blank && col >= 2 && !VIM_ISWHITE(ptr[col - 2]))
+ blank_unsigned = TRUE;
+ else
+ {
+ negative = TRUE;
+ was_positive = FALSE;
+ }
}
}
@@ -2875,10 +2884,16 @@ do_addsub(
&& !visual
&& !do_unsigned)
{
- // negative number
- --col;
- negative = TRUE;
+ if (do_blank && col >= 2 && !VIM_ISWHITE(ptr[col - 2]))
+ blank_unsigned = TRUE;
+ else
+ {
+ // negative number
+ --col;
+ negative = TRUE;
+ }
}
+
// get the number value (unsigned)
if (visual && VIsual_mode != 'V')
maxlen = (curbuf->b_visual.vi_curswant == MAXCOL
@@ -2938,7 +2953,7 @@ do_addsub(
negative = FALSE;
}
- if (do_unsigned && negative)
+ if ((do_unsigned || blank_unsigned) && negative)
{
if (subtract)
// sticking at zero.