commit fd023d6dcfe6e03e12fdabd6465383bcc0d879a4 parent 9c16be32d75fbd94634f5f374317055559e64714 Author: Benno Schulenberg <bensberg@telfort.nl> Date: Tue, 6 Apr 2021 11:32:25 +0200 tweaks: put the most likely condition first, for a quicker return Also condense a comment. Diffstat:
M | src/utils.c | | | 10 | ++++------ |
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/utils.c b/src/utils.c @@ -349,14 +349,12 @@ char *free_and_assign(char *dest, char *src) return src; } -/* When not in softwrap mode, nano scrolls horizontally within a line in - * chunks (a bit smaller than the chunks used in softwrapping). Return the - * column number of the first character displayed in the edit window when the - * cursor is at the given column. Note that (0 <= column - - * get_page_start(column) < COLS). */ +/* When not softwrapping, nano scrolls the current line horizontally by + * chunks ("pages"). Return the column number of the first character + * displayed in the edit window when the cursor is at the given column. */ size_t get_page_start(size_t column) { - if (column + 2 < editwincols || ISSET(SOFTWRAP) || column == 0) + if (column == 0 || column + 2 < editwincols || ISSET(SOFTWRAP)) return 0; else if (editwincols > 8) return column - 6 - (column - 6) % (editwincols - 8);