GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Shrinking wincon vertically only generates a single KEY_RESIZE · Issue #26 · wmcbrine/PDCurses Closed DescriptionOn at least Windows 10, shrinking a console window by dragging the lower horizontal edge of the window upwards only generates a single initial Here's what's happening:
Resizing the terminal horizontally clears up the issue. I'm guessing the console buffer is reallocated internally in that case. The following patch makes the behavior more robust for wincon, but might be incorrect for other platforms (or have other issues), so I'm submitting it more as an RFC. You still get scrollbars if you drag the lower edge quickly upwards, but it's a big improvement nonetheless. diff --git a/pdcurses/initscr.c b/pdcurses/initscr.c index 95f23fe..4e42038 100644 --- a/pdcurses/initscr.c +++ b/pdcurses/initscr.c @@ -300,7 +300,15 @@ int resize_term(int nlines, int ncols) { PDC_LOG(("resize_term() - called: nlines %d\n", nlines)); - if (!stdscr || PDC_resize_screen(nlines, ncols) == ERR) + if (!stdscr) + return ERR; + + if (!(nlines || ncols)) { + nlines = PDC_get_rows(); + ncols = PDC_get_columns(); + } + + if (PDC_resize_screen(nlines, ncols) == ERR) return ERR; SP->lines = PDC_get_rows(); diff --git a/wincon/pdcscrn.c b/wincon/pdcscrn.c index daef0e3..3b52041 100644 --- a/wincon/pdcscrn.c +++ b/wincon/pdcscrn.c @@ -525,33 +525,30 @@ int PDC_resize_screen(int nlines, int ncols) SMALL_RECT rect; COORD size, max; - if (nlines || ncols) - { - if (nlines < 2 || ncols < 2) - return ERR; + if (nlines < 2 || ncols < 2) + return ERR; - max = GetLargestConsoleWindowSize(pdc_con_out); + max = GetLargestConsoleWindowSize(pdc_con_out); - rect.Left = rect.Top = 0; - rect.Right = ncols - 1; + rect.Left = rect.Top = 0; + rect.Right = ncols - 1; - if (rect.Right > max.X) - rect.Right = max.X; + if (rect.Right > max.X) + rect.Right = max.X; - rect.Bottom = nlines - 1; + rect.Bottom = nlines - 1; - if (rect.Bottom > max.Y) - rect.Bottom = max.Y; + if (rect.Bottom > max.Y) + rect.Bottom = max.Y; - size.X = rect.Right + 1; - size.Y = rect.Bottom + 1; + size.X = rect.Right + 1; + size.Y = rect.Bottom + 1; - _fit_console_window(pdc_con_out, &rect); - SetConsoleScreenBufferSize(pdc_con_out, size); - _fit_console_window(pdc_con_out, &rect); - SetConsoleScreenBufferSize(pdc_con_out, size); - SetConsoleActiveScreenBuffer(pdc_con_out); - } + _fit_console_window(pdc_con_out, &rect); + SetConsoleScreenBufferSize(pdc_con_out, size); + _fit_console_window(pdc_con_out, &rect); + SetConsoleScreenBufferSize(pdc_con_out, size); + SetConsoleActiveScreenBuffer(pdc_con_out); PDC_flushinp(); -- 2.14.1 (Are those duplicated Here's the interface of my application. Wanting to drag the lower edge of the window is very natural, but currently messes up scrolling if the window is made smaller. Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |