aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-23 09:57:07 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-23 10:00:53 -0400
commitfb68c97ce8950fdf598a0b7ff9be7cc3fa624f2e (patch)
treeb6aa7fc723facd160d3f6666284773063771ab69
parentd677ae5f6461dcd78f08caec2c4fa72e6e275137 (diff)
downloadrneovim-fb68c97ce8950fdf598a0b7ff9be7cc3fa624f2e.tar.gz
rneovim-fb68c97ce8950fdf598a0b7ff9be7cc3fa624f2e.tar.bz2
rneovim-fb68c97ce8950fdf598a0b7ff9be7cc3fa624f2e.zip
vim-patch:8.0.1043: warning for uninitialized variable
Problem: Warning for uninitialized variable. (John Marriott) Solution: Move code to check indent inside "if". https://github.com/vim/vim/commit/4ec86ddd77a89766e42bd0a6cfcf10af4c3d03b2
-rw-r--r--src/nvim/ops.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index f3661b2045..4d8403bee8 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -2014,7 +2014,7 @@ void op_insert(oparg_T *oap, long count1)
{
long ins_len, pre_textlen = 0;
char_u *firstline, *ins_text;
- colnr_T ind_pre, ind_post;
+ colnr_T ind_pre;
struct block_def bd;
int i;
pos_T t1;
@@ -2095,14 +2095,6 @@ void op_insert(oparg_T *oap, long count1)
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. */
@@ -2112,6 +2104,14 @@ void op_insert(oparg_T *oap, long count1)
if (oap->motion_type == kMTBlockWise) {
struct block_def bd2;
+ // if indent kicked in, the firstline might have changed
+ // but only do that, if the indent actually increased
+ const colnr_T 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) {