summaryrefslogtreecommitdiffstats
path: root/src/edit.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2022-12-27 19:54:52 +0000
committerBram Moolenaar <Bram@vim.org>2022-12-27 19:54:52 +0000
commit87c1cbbe984e60582f2536e4d3c2ce88cd474bb7 (patch)
tree34257b73179d88eb605876661cb81ad37b4e2f30 /src/edit.c
parent56310d38d8e866085108c7b77b756f4373d5122a (diff)
patch 9.0.1105: code is indented too muchv9.0.1105
Problem: Code is indented too much. Solution: Use an early return. (Yegappan Lakshmanan, closes #11756)
Diffstat (limited to 'src/edit.c')
-rw-r--r--src/edit.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/src/edit.c b/src/edit.c
index 9e8346d1c2..85d59d1fb1 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -1664,49 +1664,49 @@ edit_putchar(int c, int highlight)
{
int attr;
- if (ScreenLines != NULL)
- {
- update_topline(); // just in case w_topline isn't valid
- validate_cursor();
- if (highlight)
- attr = HL_ATTR(HLF_8);
- else
- attr = 0;
- pc_row = W_WINROW(curwin) + curwin->w_wrow;
- pc_col = curwin->w_wincol;
- pc_status = PC_STATUS_UNSET;
+ if (ScreenLines == NULL)
+ return;
+
+ update_topline(); // just in case w_topline isn't valid
+ validate_cursor();
+ if (highlight)
+ attr = HL_ATTR(HLF_8);
+ else
+ attr = 0;
+ pc_row = W_WINROW(curwin) + curwin->w_wrow;
+ pc_col = curwin->w_wincol;
+ pc_status = PC_STATUS_UNSET;
#ifdef FEAT_RIGHTLEFT
- if (curwin->w_p_rl)
+ if (curwin->w_p_rl)
+ {
+ pc_col += curwin->w_width - 1 - curwin->w_wcol;
+ if (has_mbyte)
{
- pc_col += curwin->w_width - 1 - curwin->w_wcol;
- if (has_mbyte)
- {
- int fix_col = mb_fix_col(pc_col, pc_row);
+ int fix_col = mb_fix_col(pc_col, pc_row);
- if (fix_col != pc_col)
- {
- screen_putchar(' ', pc_row, fix_col, attr);
- --curwin->w_wcol;
- pc_status = PC_STATUS_RIGHT;
- }
+ if (fix_col != pc_col)
+ {
+ screen_putchar(' ', pc_row, fix_col, attr);
+ --curwin->w_wcol;
+ pc_status = PC_STATUS_RIGHT;
}
}
- else
+ }
+ else
#endif
- {
- pc_col += curwin->w_wcol;
- if (mb_lefthalve(pc_row, pc_col))
- pc_status = PC_STATUS_LEFT;
- }
+ {
+ pc_col += curwin->w_wcol;
+ if (mb_lefthalve(pc_row, pc_col))
+ pc_status = PC_STATUS_LEFT;
+ }
- // save the character to be able to put it back
- if (pc_status == PC_STATUS_UNSET)
- {
- screen_getbytes(pc_row, pc_col, pc_bytes, &pc_attr);
- pc_status = PC_STATUS_SET;
- }
- screen_putchar(c, pc_row, pc_col, attr);
+ // save the character to be able to put it back
+ if (pc_status == PC_STATUS_UNSET)
+ {
+ screen_getbytes(pc_row, pc_col, pc_bytes, &pc_attr);
+ pc_status = PC_STATUS_SET;
}
+ screen_putchar(c, pc_row, pc_col, attr);
}
#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
@@ -1782,11 +1782,11 @@ display_dollar(colnr_T col_arg)
void
undisplay_dollar(void)
{
- if (dollar_vcol >= 0)
- {
- dollar_vcol = -1;
- redrawWinline(curwin, curwin->w_cursor.lnum);
- }
+ if (dollar_vcol < 0)
+ return;
+
+ dollar_vcol = -1;
+ redrawWinline(curwin, curwin->w_cursor.lnum);
}
/*
@@ -2554,17 +2554,17 @@ set_last_insert(int c)
vim_free(last_insert);
last_insert = alloc(MB_MAXBYTES * 3 + 5);
- if (last_insert != NULL)
- {
- s = last_insert;
- // Use the CTRL-V only when entering a special char
- if (c < ' ' || c == DEL)
- *s++ = Ctrl_V;
- s = add_char2buf(c, s);
- *s++ = ESC;
- *s++ = NUL;
- last_insert_skip = 0;
- }
+ if (last_insert == NULL)
+ return;
+
+ s = last_insert;
+ // Use the CTRL-V only when entering a special char
+ if (c < ' ' || c == DEL)
+ *s++ = Ctrl_V;
+ s = add_char2buf(c, s);
+ *s++ = ESC;
+ *s++ = NUL;
+ last_insert_skip = 0;
}
#if defined(EXITFREE) || defined(PROTO)