vim-patch:8.0.1043: warning for uninitialized variable

Problem:    Warning for uninitialized variable. (John Marriott)
Solution:   Move code to check indent inside "if".
4ec86ddd77
This commit is contained in:
Jan Edmund Lazo 2018-08-23 09:57:07 -04:00
parent d677ae5f64
commit fb68c97ce8

View File

@ -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) {