mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 15:21:47 +00:00
vim-patch:partial:9.0.1237: code is indented more than necessary (#21971)
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes vim/vim#11858)
6ec6666047
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
@@ -295,52 +295,54 @@ bool get_keymap_str(win_T *wp, char *fmt, char *buf, int len)
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
buf_T *old_curbuf = curbuf;
|
||||
win_T *old_curwin = curwin;
|
||||
char *s;
|
||||
buf_T *old_curbuf = curbuf;
|
||||
win_T *old_curwin = curwin;
|
||||
char *s;
|
||||
|
||||
curbuf = wp->w_buffer;
|
||||
curwin = wp;
|
||||
STRCPY(buf, "b:keymap_name"); // must be writable
|
||||
emsg_skip++;
|
||||
s = p = eval_to_string(buf, NULL, false);
|
||||
emsg_skip--;
|
||||
curbuf = old_curbuf;
|
||||
curwin = old_curwin;
|
||||
if (p == NULL || *p == NUL) {
|
||||
if (wp->w_buffer->b_kmap_state & KEYMAP_LOADED) {
|
||||
p = wp->w_buffer->b_p_keymap;
|
||||
} else {
|
||||
p = "lang";
|
||||
}
|
||||
curbuf = wp->w_buffer;
|
||||
curwin = wp;
|
||||
STRCPY(buf, "b:keymap_name"); // must be writable
|
||||
emsg_skip++;
|
||||
s = p = eval_to_string(buf, NULL, false);
|
||||
emsg_skip--;
|
||||
curbuf = old_curbuf;
|
||||
curwin = old_curwin;
|
||||
if (p == NULL || *p == NUL) {
|
||||
if (wp->w_buffer->b_kmap_state & KEYMAP_LOADED) {
|
||||
p = wp->w_buffer->b_p_keymap;
|
||||
} else {
|
||||
p = "lang";
|
||||
}
|
||||
if (vim_snprintf(buf, (size_t)len, fmt, p) > len - 1) {
|
||||
buf[0] = NUL;
|
||||
}
|
||||
xfree(s);
|
||||
}
|
||||
if (vim_snprintf(buf, (size_t)len, fmt, p) > len - 1) {
|
||||
buf[0] = NUL;
|
||||
}
|
||||
xfree(s);
|
||||
return buf[0] != NUL;
|
||||
}
|
||||
|
||||
/// Prepare for 'hlsearch' highlighting.
|
||||
void start_search_hl(void)
|
||||
{
|
||||
if (p_hls && !no_hlsearch) {
|
||||
end_search_hl(); // just in case it wasn't called before
|
||||
last_pat_prog(&screen_search_hl.rm);
|
||||
// Set the time limit to 'redrawtime'.
|
||||
screen_search_hl.tm = profile_setlimit(p_rdt);
|
||||
if (!p_hls || no_hlsearch) {
|
||||
return;
|
||||
}
|
||||
|
||||
end_search_hl(); // just in case it wasn't called before
|
||||
last_pat_prog(&screen_search_hl.rm);
|
||||
// Set the time limit to 'redrawtime'.
|
||||
screen_search_hl.tm = profile_setlimit(p_rdt);
|
||||
}
|
||||
|
||||
/// Clean up for 'hlsearch' highlighting.
|
||||
void end_search_hl(void)
|
||||
{
|
||||
if (screen_search_hl.rm.regprog != NULL) {
|
||||
vim_regfree(screen_search_hl.rm.regprog);
|
||||
screen_search_hl.rm.regprog = NULL;
|
||||
if (screen_search_hl.rm.regprog == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
vim_regfree(screen_search_hl.rm.regprog);
|
||||
screen_search_hl.rm.regprog = NULL;
|
||||
}
|
||||
|
||||
/// Check if there should be a delay. Used before clearing or redrawing the
|
||||
@@ -671,11 +673,13 @@ void clearmode(void)
|
||||
static void recording_mode(int attr)
|
||||
{
|
||||
msg_puts_attr(_("recording"), attr);
|
||||
if (!shortmess(SHM_RECORDING)) {
|
||||
char s[4];
|
||||
snprintf(s, ARRAY_SIZE(s), " @%c", reg_recording);
|
||||
msg_puts_attr(s, attr);
|
||||
if (shortmess(SHM_RECORDING)) {
|
||||
return;
|
||||
}
|
||||
|
||||
char s[4];
|
||||
snprintf(s, ARRAY_SIZE(s), " @%c", reg_recording);
|
||||
msg_puts_attr(s, attr);
|
||||
}
|
||||
|
||||
void get_trans_bufname(buf_T *buf)
|
||||
|
Reference in New Issue
Block a user