diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-09-02 23:28:54 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-09-02 23:28:54 +0200 |
commit | 4ec86ddd77a89766e42bd0a6cfcf10af4c3d03b2 (patch) | |
tree | 7e54844f1f1237b9a0e4b1c98dee98c0bed7645b /src/ops.c | |
parent | 9f45ccd1bf2d2de979d252fdd7e5c9eb3fa6cceb (diff) | |
download | vim-git-4ec86ddd77a89766e42bd0a6cfcf10af4c3d03b2.tar.gz |
patch 8.0.1043: warning for uninitialized variablev8.0.1043
Problem: Warning for uninitialized variable. (John Marriott)
Solution: Move code to check indent inside "if".
Diffstat (limited to 'src/ops.c')
-rw-r--r-- | src/ops.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -2597,14 +2597,6 @@ op_insert(oparg_T *oap, long count1) && LT_POS(curbuf->b_op_start_orig, t1)) oap->start = curbuf->b_op_start_orig; - /* if indent kicked in, the firstline might have changed - * but only do that, if the indent actually increased */ - ind_post = (colnr_T)getwhitecols_curline(); - if (curbuf->b_op_start.col > ind_pre && ind_post > ind_pre) - { - bd.textcol += ind_post - ind_pre; - bd.start_vcol += ind_post - ind_pre; - } /* If user has moved off this line, we don't know what to do, so do * nothing. * Also don't repeat the insert when Insert mode ended with CTRL-C. */ @@ -2615,6 +2607,15 @@ op_insert(oparg_T *oap, long count1) { struct block_def bd2; + /* If indent kicked in, the firstline might have changed + * but only do that, if the indent actually increased. */ + ind_post = (colnr_T)getwhitecols_curline(); + if (curbuf->b_op_start.col > ind_pre && ind_post > ind_pre) + { + bd.textcol += ind_post - ind_pre; + bd.start_vcol += ind_post - ind_pre; + } + /* The user may have moved the cursor before inserting something, try * to adjust the block for that. */ if (oap->start.lnum == curbuf->b_op_start_orig.lnum && !bd.is_MAX) |