ncurses to external shell and back messing with keys

后端 未结 2 553
梦如初夏
梦如初夏 2021-01-13 09:21

I have this ncurses application that is doing the standard recipe for temporarily dropping out of ncurses, running an external editor/shell/whatever, and then dropping back

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-13 09:48

    After rootling around a bit, I found a cargo culting solution: explicitly call keypad(1) after getting out the shell on stdscr. I have no idea why this works, but it does. I'll mark someone else's answer as yes if they can explain why. The current working theory is that keypad touches some sort of internal buffer and clears it.

    Scratch that:

    NCURSES_EXPORT(int)
    keypad(WINDOW *win, bool flag)
    {
        T((T_CALLED("keypad(%p,%d)"), win, flag));
    
        if (win) {
            win->_use_keypad = flag;
            returnCode(_nc_keypad(SP, flag));
        } else
            returnCode(ERR);
    }

提交回复
热议问题