diff options
author | Tom Tromey <tom@tromey.com> | 2022-01-08 19:37:38 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-04-15 11:38:13 -0600 |
commit | 111d19818a4a7c96c87e330c6c143fa03bb86819 (patch) | |
tree | 5b52ad936a731994daaccc43350daa83fe8cfd9e /gdb/utils.c | |
parent | 1f0f8b5d9d9053c4d164d01c6915c2e6b8c6ea48 (diff) | |
download | binutils-111d19818a4a7c96c87e330c6c143fa03bb86819.zip binutils-111d19818a4a7c96c87e330c6c143fa03bb86819.tar.gz binutils-111d19818a4a7c96c87e330c6c143fa03bb86819.tar.bz2 |
Handle "set height 1"
PR cli/17151 points out that "set height 1" has pathological behavior
in gdb. What I see is that gdb will endlessly print the pagination
prompt. This patch takes a simple and expedient approach to a fix:
pretend that the height is really 2.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17151
Diffstat (limited to 'gdb/utils.c')
-rw-r--r-- | gdb/utils.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gdb/utils.c b/gdb/utils.c index b7d5859..2465bf3 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1601,6 +1601,12 @@ pager_file::puts (const char *linebuffer) m_wrap_indent = 0; }); + /* If the user does "set height 1" then the pager will exhibit weird + behavior. This is pathological, though, so don't allow it. */ + const unsigned int lines_allowed = (lines_per_page > 1 + ? lines_per_page - 1 + : 1); + /* Go through and output each character. Show line extension when this is necessary; prompt user for new page when this is necessary. */ @@ -1613,7 +1619,7 @@ pager_file::puts (const char *linebuffer) it here. */ if (pagination_enabled && !pagination_disabled_for_command - && lines_printed >= lines_per_page - 1) + && lines_printed >= lines_allowed) prompt_for_continue (); while (*lineptr && *lineptr != '\n') @@ -1690,7 +1696,7 @@ pager_file::puts (const char *linebuffer) this loop, so we must continue to check it here. */ if (pagination_enabled && !pagination_disabled_for_command - && lines_printed >= lines_per_page - 1) + && lines_printed >= lines_allowed) { prompt_for_continue (); did_paginate = true; |