summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-07-22 14:54:07 -0400
committerpommicket <pommicket@gmail.com>2022-07-22 14:54:07 -0400
commit35b1b0129e8791a9412173acf3756606d0cc397d (patch)
tree6e631f6382cabf4ad2522bf4386828aaabae3347 /menu.c
parent47a65f608f485af32d2df12be489146ad67839e1 (diff)
go syntax highlighting
also :goto-line now clamps numbers < 1 and > nlines instead of rejecting them
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/menu.c b/menu.c
index 6977552..dfb3db9 100644
--- a/menu.c
+++ b/menu.c
@@ -244,7 +244,9 @@ static void menu_update(Ted *ted) {
char *end;
long line_number = strtol(contents, &end, 0);
TextBuffer *buffer = ted->prev_active_buffer;
- if (line_number > 0 && *end == '\0' && line_number <= (long)buffer->nlines) {
+ if (*contents != '\0' && *end == '\0') {
+ if (line_number < 1) line_number = 1;
+ if (line_number > buffer->nlines) line_number = (long)buffer->nlines;
BufferPos pos = {(u32)line_number - 1, 0};
if (line_buffer->line_buffer_submitted) {