summaryrefslogtreecommitdiff
path: root/src/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/screen.c')
-rw-r--r--src/screen.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/screen.c b/src/screen.c
index b99948d..ab6989a 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -808,12 +808,10 @@ void term_screen_set_alternate(struct term *t, bool enabled)
}
}
-/* The caller has checked that requested is not negative. */
+/* The caller has checked that requested is in [0, TERM_SCROLLBACK_MAX]. */
static int scrollback_lines(int requested)
{
- if (requested == 0)
- return TERM_SCROLLBACK_DEFAULT;
- return requested > 1000000 ? 1000000 : requested;
+ return requested == 0 ? TERM_SCROLLBACK_DEFAULT : requested;
}
static atomic_int tables_state;
@@ -862,7 +860,8 @@ struct term *term_new(const struct term_options *opt)
return NULL;
if (opt->size.x < 0 || opt->size.y < 0 || opt->size.x > TERM_MAX_COLS)
return NULL;
- if (opt->scrollback < 0 || (unsigned)opt->cursor_style > TERM_CURSOR_BAR)
+ if (opt->scrollback < 0 || opt->scrollback > TERM_SCROLLBACK_MAX ||
+ (unsigned)opt->cursor_style > TERM_CURSOR_BAR)
return NULL;
const char *name = opt->name && *opt->name ? opt->name : "term";
if (!name_valid(name))