mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
patch 9.0.1196: code is indented more than necessary
Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes #11813)
This commit is contained in:
committed by
Bram Moolenaar
parent
378e6c03f9
commit
e857598896
55
src/map.c
55
src/map.c
@@ -67,11 +67,11 @@ is_maphash_valid(void)
|
||||
static void
|
||||
validate_maphash(void)
|
||||
{
|
||||
if (!maphash_valid)
|
||||
{
|
||||
CLEAR_FIELD(maphash);
|
||||
maphash_valid = TRUE;
|
||||
}
|
||||
if (maphash_valid)
|
||||
return;
|
||||
|
||||
CLEAR_FIELD(maphash);
|
||||
maphash_valid = TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -581,8 +581,8 @@ do_map(
|
||||
// needs to be freed later (*keys_buf and *arg_buf).
|
||||
// replace_termcodes() also removes CTRL-Vs and sometimes backslashes.
|
||||
// If something like <C-H> is simplified to 0x08 then mark it as simplified
|
||||
// and also add a n entry with a modifier, which will work when
|
||||
// modifyOtherKeys is working.
|
||||
// and also add an entry with a modifier, which will work when using a key
|
||||
// protocol.
|
||||
if (haskey)
|
||||
{
|
||||
char_u *new_keys;
|
||||
@@ -1843,32 +1843,33 @@ vim_strsave_escape_csi(char_u *p)
|
||||
// illegal utf-8 byte:
|
||||
// 0xc0 -> 0xc3 0x80 -> 0xc3 K_SPECIAL KS_SPECIAL KE_FILLER
|
||||
res = alloc(STRLEN(p) * 4 + 1);
|
||||
if (res != NULL)
|
||||
if (res == NULL)
|
||||
return NULL;
|
||||
|
||||
d = res;
|
||||
for (s = p; *s != NUL; )
|
||||
{
|
||||
d = res;
|
||||
for (s = p; *s != NUL; )
|
||||
{
|
||||
if ((s[0] == K_SPECIAL
|
||||
if ((s[0] == K_SPECIAL
|
||||
#ifdef FEAT_GUI
|
||||
|| (gui.in_use && s[0] == CSI)
|
||||
#endif
|
||||
) && s[1] != NUL && s[2] != NUL)
|
||||
{
|
||||
// Copy special key unmodified.
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add character, possibly multi-byte to destination, escaping
|
||||
// CSI and K_SPECIAL. Be careful, it can be an illegal byte!
|
||||
d = add_char2buf(PTR2CHAR(s), d);
|
||||
s += MB_CPTR2LEN(s);
|
||||
}
|
||||
) && s[1] != NUL && s[2] != NUL)
|
||||
{
|
||||
// Copy special key unmodified.
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add character, possibly multi-byte to destination, escaping
|
||||
// CSI and K_SPECIAL. Be careful, it can be an illegal byte!
|
||||
d = add_char2buf(PTR2CHAR(s), d);
|
||||
s += MB_CPTR2LEN(s);
|
||||
}
|
||||
*d = NUL;
|
||||
}
|
||||
*d = NUL;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user