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:
zeertzjq
2023-01-24 08:43:51 +08:00
committed by GitHub
parent dbb6c7f1b8
commit fa12b9ca2b
11 changed files with 559 additions and 491 deletions

View File

@@ -142,16 +142,16 @@ void grid_putchar(ScreenGrid *grid, int c, int row, int col, int attr)
/// Also return its attribute in *attrp;
void grid_getbytes(ScreenGrid *grid, int row, int col, char *bytes, int *attrp)
{
size_t off;
grid_adjust(&grid, &row, &col);
// safety check
if (grid->chars != NULL && row < grid->rows && col < grid->cols) {
off = grid->line_offset[row] + (size_t)col;
*attrp = grid->attrs[off];
schar_copy(bytes, grid->chars[off]);
if (grid->chars == NULL || row >= grid->rows || col >= grid->cols) {
return;
}
size_t off = grid->line_offset[row] + (size_t)col;
*attrp = grid->attrs[off];
schar_copy(bytes, grid->chars[off]);
}
/// put string '*text' on the window grid at position 'row' and 'col', with