mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 15:08:35 +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:
@@ -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
|
||||
|
Reference in New Issue
Block a user