如何配置VSCode集成终端以捕获ncurses鼠标事件?

问题描述

我目前正在使用Dan Gookin's Guide to Ncurses Programming,并且在VSCode集成终端中运行时,我的程序无法接收ncurses鼠标事件。这在外部终端中按预期工作。但是,VSCode terminal dependency似乎声称支持鼠标事件。

这是我正在运行的完整程序。集成终端能够捕获换行键以退出程序,但是鼠标事件不会像其他终端那样记录。

#include <ncurses.h>

int main()
{
    initscr();

    if (!NCURSES_MOUSE_VERSION)
    {
        addstr("Mouse Functions Unavailable.\n");
        refresh();
        getch();
        goto done;
    }

    noecho();
    keypad(stdscr,TRUE);
    mousemask(ALL_MOUSE_EVENTS,NULL);

    while (true)
    {
        int ch = getch();
        if (ch == KEY_MOUSE)
        {
            MEVENT mort;
            getmouse(&mort);
            move(0,0);
            clrtoeol();
            printw("%d\t%d",mort.y,mort.x);
            refresh();
            continue;
        }
        if (ch == '\n')
            break;
    }

done:
    endwin();
    return 0;
}


解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)