Mercurial > vim
comparison src/textformat.c @ 28773:d770568e6c98 v8.2.4911
patch 8.2.4911: the mode #defines are not clearly named
Commit: https://github.com/vim/vim/commit/249591057b4840785c50e41dd850efb8a8faf435
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 7 20:01:16 2022 +0100
patch 8.2.4911: the mode #defines are not clearly named
Problem: The mode #defines are not clearly named.
Solution: Prepend MODE_. Renumber them to put the mapped modes first.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 07 May 2022 21:15:06 +0200 |
parents | 7bbd859b2a48 |
children | d0241e74bfdb |
comparison
equal
deleted
inserted
replaced
28772:7b07ca0bb292 | 28773:d770568e6c98 |
---|---|
328 | 328 |
329 // Going to break the line, remove any "$" now. | 329 // Going to break the line, remove any "$" now. |
330 undisplay_dollar(); | 330 undisplay_dollar(); |
331 | 331 |
332 // Offset between cursor position and line break is used by replace | 332 // Offset between cursor position and line break is used by replace |
333 // stack functions. VREPLACE does not use this, and backspaces | 333 // stack functions. MODE_VREPLACE does not use this, and backspaces |
334 // over the text instead. | 334 // over the text instead. |
335 if (State & VREPLACE_FLAG) | 335 if (State & VREPLACE_FLAG) |
336 orig_col = startcol; // Will start backspacing from here | 336 orig_col = startcol; // Will start backspacing from here |
337 else | 337 else |
338 replace_offset = startcol - end_foundcol; | 338 replace_offset = startcol - end_foundcol; |
347 if (startcol < 0) | 347 if (startcol < 0) |
348 startcol = 0; | 348 startcol = 0; |
349 | 349 |
350 if (State & VREPLACE_FLAG) | 350 if (State & VREPLACE_FLAG) |
351 { | 351 { |
352 // In VREPLACE mode, we will backspace over the text to be | 352 // In MODE_VREPLACE state, we will backspace over the text to be |
353 // wrapped, so save a copy now to put on the next line. | 353 // wrapped, so save a copy now to put on the next line. |
354 saved_text = vim_strsave(ml_get_cursor()); | 354 saved_text = vim_strsave(ml_get_cursor()); |
355 curwin->w_cursor.col = orig_col; | 355 curwin->w_cursor.col = orig_col; |
356 if (saved_text == NULL) | 356 if (saved_text == NULL) |
357 break; // Can't do it, out of memory | 357 break; // Can't do it, out of memory |
426 first_line = FALSE; | 426 first_line = FALSE; |
427 } | 427 } |
428 | 428 |
429 if (State & VREPLACE_FLAG) | 429 if (State & VREPLACE_FLAG) |
430 { | 430 { |
431 // In VREPLACE mode we have backspaced over the text to be | 431 // In MODE_VREPLACE state we have backspaced over the text to be |
432 // moved, now we re-insert it into the new line. | 432 // moved, now we re-insert it into the new line. |
433 ins_bytes(saved_text); | 433 ins_bytes(saved_text); |
434 vim_free(saved_text); | 434 vim_free(saved_text); |
435 } | 435 } |
436 else | 436 else |
1141 } | 1141 } |
1142 (void)set_indent(indent, SIN_CHANGED); | 1142 (void)set_indent(indent, SIN_CHANGED); |
1143 } | 1143 } |
1144 | 1144 |
1145 // put cursor on last non-space | 1145 // put cursor on last non-space |
1146 State = NORMAL; // don't go past end-of-line | 1146 State = MODE_NORMAL; // don't go past end-of-line |
1147 coladvance((colnr_T)MAXCOL); | 1147 coladvance((colnr_T)MAXCOL); |
1148 while (curwin->w_cursor.col && vim_isspace(gchar_cursor())) | 1148 while (curwin->w_cursor.col && vim_isspace(gchar_cursor())) |
1149 dec_cursor(); | 1149 dec_cursor(); |
1150 | 1150 |
1151 // do the formatting, without 'showmode' | 1151 // do the formatting, without 'showmode' |
1152 State = INSERT; // for open_line() | 1152 State = MODE_INSERT; // for open_line() |
1153 smd_save = p_smd; | 1153 smd_save = p_smd; |
1154 p_smd = FALSE; | 1154 p_smd = FALSE; |
1155 insertchar(NUL, INSCHAR_FORMAT | 1155 insertchar(NUL, INSCHAR_FORMAT |
1156 + (do_comments ? INSCHAR_DO_COM : 0) | 1156 + (do_comments ? INSCHAR_DO_COM : 0) |
1157 + (do_comments && do_comments_list | 1157 + (do_comments && do_comments_list |