1
0
forked from aniani/vim

patch 8.1.1000: indenting is off

Problem:    Indenting is off.
Solution:   Make indenting consistent and update comments. (Ozaki Kiichi,
            closes #4079)
This commit is contained in:
Bram Moolenaar 2019-03-09 11:23:58 +01:00
parent 9d7fdd403a
commit fd731b0e31
3 changed files with 149 additions and 141 deletions

View File

@ -1579,7 +1579,7 @@ vgetc(void)
{ {
mod_mask = 0x0; mod_mask = 0x0;
last_recorded_len = 0; last_recorded_len = 0;
for (;;) /* this is done twice if there are modifiers */ for (;;) // this is done twice if there are modifiers
{ {
int did_inc = FALSE; int did_inc = FALSE;
@ -1589,10 +1589,10 @@ vgetc(void)
#endif #endif
) )
{ {
/* no mapping after modifier has been read */ // no mapping after modifier has been read
++no_mapping; ++no_mapping;
++allow_keys; ++allow_keys;
did_inc = TRUE; /* mod_mask may change value */ did_inc = TRUE; // mod_mask may change value
} }
c = vgetorpeek(TRUE); c = vgetorpeek(TRUE);
if (did_inc) if (did_inc)
@ -1601,7 +1601,7 @@ vgetc(void)
--allow_keys; --allow_keys;
} }
/* Get two extra bytes for special keys */ // Get two extra bytes for special keys
if (c == K_SPECIAL if (c == K_SPECIAL
#ifdef FEAT_GUI #ifdef FEAT_GUI
|| c == CSI || c == CSI
@ -1611,8 +1611,8 @@ vgetc(void)
int save_allow_keys = allow_keys; int save_allow_keys = allow_keys;
++no_mapping; ++no_mapping;
allow_keys = 0; /* make sure BS is not found */ allow_keys = 0; // make sure BS is not found
c2 = vgetorpeek(TRUE); /* no mapping for these chars */ c2 = vgetorpeek(TRUE); // no mapping for these chars
c = vgetorpeek(TRUE); c = vgetorpeek(TRUE);
--no_mapping; --no_mapping;
allow_keys = save_allow_keys; allow_keys = save_allow_keys;
@ -1624,14 +1624,14 @@ vgetc(void)
c = TO_SPECIAL(c2, c); c = TO_SPECIAL(c2, c);
#if defined(FEAT_GUI_MSWIN) && defined(FEAT_MENU) && defined(FEAT_TEAROFF) #if defined(FEAT_GUI_MSWIN) && defined(FEAT_MENU) && defined(FEAT_TEAROFF)
/* Handle K_TEAROFF here, the caller of vgetc() doesn't need to // Handle K_TEAROFF here, the caller of vgetc() doesn't need to
* know that a menu was torn off */ // know that a menu was torn off
if (c == K_TEAROFF) if (c == K_TEAROFF)
{ {
char_u name[200]; char_u name[200];
int i; int i;
/* get menu path, it ends with a <CR> */ // get menu path, it ends with a <CR>
for (i = 0; (c = vgetorpeek(TRUE)) != '\r'; ) for (i = 0; (c = vgetorpeek(TRUE)) != '\r'; )
{ {
name[i] = c; name[i] = c;
@ -1644,33 +1644,34 @@ vgetc(void)
} }
#endif #endif
#if defined(FEAT_GUI) && defined(FEAT_GUI_GTK) && defined(FEAT_MENU) #if defined(FEAT_GUI) && defined(FEAT_GUI_GTK) && defined(FEAT_MENU)
/* GTK: <F10> normally selects the menu, but it's passed until // GTK: <F10> normally selects the menu, but it's passed until
* here to allow mapping it. Intercept and invoke the GTK // here to allow mapping it. Intercept and invoke the GTK
* behavior if it's not mapped. */ // behavior if it's not mapped.
if (c == K_F10 && gui.menubar != NULL) if (c == K_F10 && gui.menubar != NULL)
{ {
gtk_menu_shell_select_first(GTK_MENU_SHELL(gui.menubar), FALSE); gtk_menu_shell_select_first(
GTK_MENU_SHELL(gui.menubar), FALSE);
continue; continue;
} }
#endif #endif
#ifdef FEAT_GUI #ifdef FEAT_GUI
/* Handle focus event here, so that the caller doesn't need to // Handle focus event here, so that the caller doesn't need to
* know about it. Return K_IGNORE so that we loop once (needed if // know about it. Return K_IGNORE so that we loop once (needed
* 'lazyredraw' is set). */ // if 'lazyredraw' is set).
if (c == K_FOCUSGAINED || c == K_FOCUSLOST) if (c == K_FOCUSGAINED || c == K_FOCUSLOST)
{ {
ui_focus_change(c == K_FOCUSGAINED); ui_focus_change(c == K_FOCUSGAINED);
c = K_IGNORE; c = K_IGNORE;
} }
/* Translate K_CSI to CSI. The special key is only used to avoid // Translate K_CSI to CSI. The special key is only used to
* it being recognized as the start of a special key. */ // avoid it being recognized as the start of a special key.
if (c == K_CSI) if (c == K_CSI)
c = CSI; c = CSI;
#endif #endif
} }
/* a keypad or special function key was not mapped, use it like // a keypad or special function key was not mapped, use it like
* its ASCII equivalent */ // its ASCII equivalent
switch (c) switch (c)
{ {
case K_KPLUS: c = '+'; break; case K_KPLUS: c = '+'; break;
@ -1732,10 +1733,9 @@ vgetc(void)
case K_XRIGHT: c = K_RIGHT; break; case K_XRIGHT: c = K_RIGHT; break;
} }
/* For a multi-byte character get all the bytes and return the // For a multi-byte character get all the bytes and return the
* converted character. // converted character.
* Note: This will loop until enough bytes are received! // Note: This will loop until enough bytes are received!
*/
if (has_mbyte && (n = MB_BYTE2LEN_CHECK(c)) > 1) if (has_mbyte && (n = MB_BYTE2LEN_CHECK(c)) > 1)
{ {
++no_mapping; ++no_mapping;
@ -1749,11 +1749,12 @@ vgetc(void)
#endif #endif
) )
{ {
/* Must be a K_SPECIAL - KS_SPECIAL - KE_FILLER sequence, // Must be a K_SPECIAL - KS_SPECIAL - KE_FILLER
* which represents a K_SPECIAL (0x80), // sequence, which represents a K_SPECIAL (0x80),
* or a CSI - KS_EXTRA - KE_CSI sequence, which represents // or a CSI - KS_EXTRA - KE_CSI sequence, which
* a CSI (0x9B), // represents a CSI (0x9B),
* of a K_SPECIAL - KS_EXTRA - KE_CSI, which is CSI too. */ // or a K_SPECIAL - KS_EXTRA - KE_CSI, which is CSI
// too.
c = vgetorpeek(TRUE); c = vgetorpeek(TRUE);
if (vgetorpeek(TRUE) == (int)KE_CSI && c == KS_EXTRA) if (vgetorpeek(TRUE) == (int)KE_CSI && c == KS_EXTRA)
buf[i] = CSI; buf[i] = CSI;

View File

@ -1245,10 +1245,15 @@ do_execreg(
emsg(_(e_nolastcmd)); emsg(_(e_nolastcmd));
return FAIL; return FAIL;
} }
VIM_CLEAR(new_last_cmdline); /* don't keep the cmdline containing @: */ // don't keep the cmdline containing @:
/* Escape all control characters with a CTRL-V */ VIM_CLEAR(new_last_cmdline);
// Escape all control characters with a CTRL-V
p = vim_strsave_escaped_ext(last_cmdline, p = vim_strsave_escaped_ext(last_cmdline,
(char_u *)"\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", Ctrl_V, FALSE); (char_u *)"\001\002\003\004\005\006\007"
"\010\011\012\013\014\015\016\017"
"\020\021\022\023\024\025\026\027"
"\030\031\032\033\034\035\036\037",
Ctrl_V, FALSE);
if (p != NULL) if (p != NULL)
{ {
/* When in Visual mode "'<,'>" will be prepended to the command. /* When in Visual mode "'<,'>" will be prepended to the command.

View File

@ -779,6 +779,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1000,
/**/ /**/
999, 999,
/**/ /**/