NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/55482: [libcurses] slk_restore() does not restore the slk screen



>Number:         55482
>Category:       lib
>Synopsis:       [libcurses] slk_restore() does not restore the slk screen
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 11 17:40:00 +0000 2020
>Originator:     Naman Jain
>Release:        NetBSD 9.0
>Organization:
IIT Kanpur
>Environment:
NetBSD localhost 9.0 NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
slk_restore() always returns ERR and hence soft label keys are not restored without doing an explicit refresh.
>How-To-Repeat:
#include <curses.h>
#include <assert.h>

int main() {

    slk_init(0);
    initscr();
    slk_set(1, "first", 0); 
    slk_refresh();
    getch();

    slk_clear();
    slk_refresh();
    getch();

    int err = slk_restore();
    assert(err == OK);  // this assertion fails

    getch();
    endwin();
    return 0;
}

>Fix:
This is probably due to the last label. If this loop is run for only 7/8 labels (https://github.com/NetBSD/src/blob/d889a17013661731f516efa8105dce1e145ffcbe/lib/libcurses/slk.c#L829), it executes well and restores successfully. So, the problem is related to the handling of the last character.



Home | Main Index | Thread Index | Old Index