This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nova
Recipients nova
Date 2020-01-28.09:43:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1580204589.93.0.986649856634.issue39475@roundup.psfhosted.org>
In-reply-to
Content
Package : python(v3.6.9)
Severity: normal

When a window object has been created using curses.newwin(), increasing
the terminal size produces the KEY_RESIZE events, but getmaxyx() returns
the previous terminal size. Only by decreasing the terminal size does it
return the correct terminal dimensions.

Attachment includes:
1. video demonstrating the effect

Following is the script to reproduce the effect:

import curses

def init_curses():
    curses.initscr()
    window = curses.newwin(curses.LINES - 1, curses.COLS, 0, 0)

    # window = curses.initscr()

    curses.raw()
    curses.noecho()
    curses.cbreak()
    window.keypad(True)

    return window

def restore_terminal(window):
    curses.noraw()
    curses.nocbreak()
    window.keypad(False)
    curses.echo()
    curses.endwin()

def main():
    try:
        window = init_curses()
        resize_no = 0
        maxy, maxx = window.getmaxyx()

        dimension_string = "resize_no: " + str(resize_no) + ". maxy: " + str(maxy) + "; maxx: " + str(maxx) + '\n'
        window.addstr(dimension_string)

        while True:
            ch = window.getch()
            window.clear()

            if ch == curses.KEY_RESIZE:
                resize_no += 1

                maxy, maxx = window.getmaxyx()
                dimension_string = "resize_no: " + str(resize_no) + ". maxy: " + str(maxy) + "; maxx: " + str(maxx) + '\n'
                window.addstr(dimension_string)


    finally:
        restore_terminal(window)

if __name__ == '__main__':
    main()
History
Date User Action Args
2020-01-28 09:43:09novasetrecipients: + nova
2020-01-28 09:43:09novasetmessageid: <1580204589.93.0.986649856634.issue39475@roundup.psfhosted.org>
2020-01-28 09:43:09novalinkissue39475 messages
2020-01-28 09:43:09novacreate