comparison src/ops.c @ 22699:e82579016863 v8.2.1898

patch 8.2.1898: command modifier parsing always uses global cmdmod Commit: https://github.com/vim/vim/commit/e10044015841711b989f9a898d427bcc1fdb4c32 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 24 20:49:43 2020 +0200 patch 8.2.1898: command modifier parsing always uses global cmdmod Problem: Command modifier parsing always uses global cmdmod. Solution: Pass in cmdmod_T to use. Rename struct fields consistently.
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Oct 2020 21:00:05 +0200
parents 9debc021e99e
children 6d50182e7e24
comparison
equal deleted inserted replaced
22698:28523bc9ee71 22699:e82579016863
202 NGETTEXT(msg_line_single, msg_line_plural, oap->line_count), 202 NGETTEXT(msg_line_single, msg_line_plural, oap->line_count),
203 oap->line_count, op, amount); 203 oap->line_count, op, amount);
204 msg_attr_keep((char *)IObuff, 0, TRUE); 204 msg_attr_keep((char *)IObuff, 0, TRUE);
205 } 205 }
206 206
207 if (!cmdmod.lockmarks) 207 if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
208 { 208 {
209 // Set "'[" and "']" marks. 209 // Set "'[" and "']" marks.
210 curbuf->b_op_start = oap->start; 210 curbuf->b_op_start = oap->start;
211 curbuf->b_op_end.lnum = oap->end.lnum; 211 curbuf->b_op_end.lnum = oap->end.lnum;
212 curbuf->b_op_end.col = (colnr_T)STRLEN(ml_get(oap->end.lnum)); 212 curbuf->b_op_end.col = (colnr_T)STRLEN(ml_get(oap->end.lnum));
941 } 941 }
942 942
943 msgmore(curbuf->b_ml.ml_line_count - old_lcount); 943 msgmore(curbuf->b_ml.ml_line_count - old_lcount);
944 944
945 setmarks: 945 setmarks:
946 if (!cmdmod.lockmarks) 946 if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
947 { 947 {
948 if (oap->block_mode) 948 if (oap->block_mode)
949 { 949 {
950 curbuf->b_op_end.lnum = oap->end.lnum; 950 curbuf->b_op_end.lnum = oap->end.lnum;
951 curbuf->b_op_end.col = oap->start.col; 951 curbuf->b_op_end.col = oap->start.col;
1214 1214
1215 curwin->w_cursor = oap->start; 1215 curwin->w_cursor = oap->start;
1216 check_cursor(); 1216 check_cursor();
1217 changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1, 0L); 1217 changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1, 0L);
1218 1218
1219 if (!cmdmod.lockmarks) 1219 if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
1220 { 1220 {
1221 // Set "'[" and "']" marks. 1221 // Set "'[" and "']" marks.
1222 curbuf->b_op_start = oap->start; 1222 curbuf->b_op_start = oap->start;
1223 curbuf->b_op_end = oap->end; 1223 curbuf->b_op_end = oap->end;
1224 } 1224 }
1327 1327
1328 if (!did_change && oap->is_VIsual) 1328 if (!did_change && oap->is_VIsual)
1329 // No change: need to remove the Visual selection 1329 // No change: need to remove the Visual selection
1330 redraw_curbuf_later(INVERTED); 1330 redraw_curbuf_later(INVERTED);
1331 1331
1332 if (!cmdmod.lockmarks) 1332 if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
1333 { 1333 {
1334 // Set '[ and '] marks. 1334 // Set '[ and '] marks.
1335 curbuf->b_op_start = oap->start; 1335 curbuf->b_op_start = oap->start;
1336 curbuf->b_op_end = oap->end; 1336 curbuf->b_op_end = oap->end;
1337 } 1337 }
1940 { 1940 {
1941 curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t)); 1941 curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t));
1942 #ifdef FEAT_PROP_POPUP 1942 #ifdef FEAT_PROP_POPUP
1943 propcount += count_props((linenr_T) (curwin->w_cursor.lnum + t), t > 0); 1943 propcount += count_props((linenr_T) (curwin->w_cursor.lnum + t), t > 0);
1944 #endif 1944 #endif
1945 if (t == 0 && setmark && !cmdmod.lockmarks) 1945 if (t == 0 && setmark && (cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
1946 { 1946 {
1947 // Set the '[ mark. 1947 // Set the '[ mark.
1948 curwin->w_buffer->b_op_start.lnum = curwin->w_cursor.lnum; 1948 curwin->w_buffer->b_op_start.lnum = curwin->w_cursor.lnum;
1949 curwin->w_buffer->b_op_start.col = (colnr_T)STRLEN(curr); 1949 curwin->w_buffer->b_op_start.col = (colnr_T)STRLEN(curr);
1950 } 1950 }
2086 currsize = (int)STRLEN(curr); 2086 currsize = (int)STRLEN(curr);
2087 } 2087 }
2088 2088
2089 ml_replace_len(curwin->w_cursor.lnum, newp, (colnr_T)newp_len, TRUE, FALSE); 2089 ml_replace_len(curwin->w_cursor.lnum, newp, (colnr_T)newp_len, TRUE, FALSE);
2090 2090
2091 if (setmark && !cmdmod.lockmarks) 2091 if (setmark && (cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
2092 { 2092 {
2093 // Set the '] mark. 2093 // Set the '] mark.
2094 curwin->w_buffer->b_op_end.lnum = curwin->w_cursor.lnum; 2094 curwin->w_buffer->b_op_end.lnum = curwin->w_cursor.lnum;
2095 curwin->w_buffer->b_op_end.col = (colnr_T)sumsize; 2095 curwin->w_buffer->b_op_end.col = (colnr_T)sumsize;
2096 } 2096 }
2403 // No change: need to remove the Visual selection 2403 // No change: need to remove the Visual selection
2404 redraw_curbuf_later(INVERTED); 2404 redraw_curbuf_later(INVERTED);
2405 2405
2406 // Set '[ mark if something changed. Keep the last end 2406 // Set '[ mark if something changed. Keep the last end
2407 // position from do_addsub(). 2407 // position from do_addsub().
2408 if (change_cnt > 0 && !cmdmod.lockmarks) 2408 if (change_cnt > 0 && (cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
2409 curbuf->b_op_start = startpos; 2409 curbuf->b_op_start = startpos;
2410 2410
2411 if (change_cnt > p_report) 2411 if (change_cnt > p_report)
2412 smsg(NGETTEXT("%d line changed", "%d lines changed", 2412 smsg(NGETTEXT("%d line changed", "%d lines changed",
2413 change_cnt), change_cnt); 2413 change_cnt), change_cnt);
2850 endpos = curwin->w_cursor; 2850 endpos = curwin->w_cursor;
2851 if (did_change && curwin->w_cursor.col) 2851 if (did_change && curwin->w_cursor.col)
2852 --curwin->w_cursor.col; 2852 --curwin->w_cursor.col;
2853 } 2853 }
2854 2854
2855 if (did_change && !cmdmod.lockmarks) 2855 if (did_change && (cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
2856 { 2856 {
2857 // set the '[ and '] marks 2857 // set the '[ and '] marks
2858 curbuf->b_op_start = startpos; 2858 curbuf->b_op_start = startpos;
2859 curbuf->b_op_end = endpos; 2859 curbuf->b_op_end = endpos;
2860 if (curbuf->b_op_end.col > 0) 2860 if (curbuf->b_op_end.col > 0)
3299 virtual_op = MAYBE; 3299 virtual_op = MAYBE;
3300 3300
3301 (void)call_func_retnr(p_opfunc, 1, argv); 3301 (void)call_func_retnr(p_opfunc, 1, argv);
3302 3302
3303 virtual_op = save_virtual_op; 3303 virtual_op = save_virtual_op;
3304 if (cmdmod.lockmarks) 3304 if (cmdmod.cmod_flags & CMOD_LOCKMARKS)
3305 { 3305 {
3306 curbuf->b_op_start = orig_start; 3306 curbuf->b_op_start = orig_start;
3307 curbuf->b_op_end = orig_end; 3307 curbuf->b_op_end = orig_end;
3308 } 3308 }
3309 } 3309 }