【问题标题】:wborder issues(error,problem) in ncurseswncursesw 中的 wborder 问题(错误、问题)
【发布时间】:2022-01-10 20:44:30
【问题描述】:

嗨,在我分配 ncurses 期间,我将头文件 ncurses.h 更改为 ncursesw/curses.h 以使用 korean_utf-8。

问题是,在我更改标题后,我由 wborder() 制作的窗口边框崩溃(=未对齐,不正确的顺序),如下所示:

在我创建新窗口并刷新后,它变得更糟,如下图所示

希望有人可以帮助我。我花了很长时间才找到这个问题,但我没有找到合适的。我猜是因为链接头 ncurses 到 ncursesw 发生了一些事情。

//header before I include : #include <ncurses.h>
//header i changed: 
#include <ncursesw/curses.h>
#include <locale.h>
//I also add setlocale(LC_TYPE,ko_KR.utf-8");


void insert_page() {
    vector<WINDOW *> contents;
    contents.push_back(newwin(30, 75, 0, 0));
    wbkgd(contents[0], COLOR_PAIR(1));
    contents.push_back(subwin(contents[0], 25, 35, 3, 3));
    wborder(contents[1], 0, 0, 0, 0, 0, 0, 0, 0);
    contents.push_back(subwin(contents[0], 25, 35, 3, 39));
    wborder(contents[2], 0, 0, 0, 0, 0, 0, 0, 0);
    wrefresh(contents[0]);
    wgetch(contents[0]);
}
void test_page() {
    vector<WINDOW *> contents;
    contents.push_back(newwin(30, 75, 0, 0));
    wbkgd(contents[0], COLOR_PAIR(1));
    contents.push_back(subwin(contents[0], 20, 35, 3, 3));
    wborder(contents[1], 0, 0, 0, 0, 0, 0, 0, 0);
    contents.push_back(subwin(contents[0], 20, 35, 3, 38));
    wborder(contents[2], 0, 0, 0, 0, 0, 0, 0, 0);
    contents.push_back(subwin(contents[0], 3, 25, 24, 26));
    wborder(contents[3], 0, 0, 0, 0, 0, 0, 0, 0);
    wrefresh(contents[0]);
}

【问题讨论】:

  • 这不是C而是C++(使用了向量),所以请去掉C标签。
  • 您应该共享原始标题和差异,以便我们可以具体说明更改的内容。也不要在 C++ 问题中标记 C。
  • sry,我改了,谢谢
  • 代码片段太不完整以至于无法猜测。见MCVE。关于更改标题的评论暗示您没有更改示例中使用的库。
  • @ThomasDickey 感谢您的评论。由于我英语不好,您能解释一下我没有更改示例中使用的库的含义吗?我将标题 ncurses.h 更改为 ncursesw/curses.h 谢谢

标签: c++ variable-assignment ncurses


【解决方案1】:

我解决了我的问题!分享我的经验希望有人能得到帮助。

在我写问题之前,我已经检查了所有建议的评论(如编译时检查 lncursesw 或 setlocale 等),我的问题只是将 ncurses.h 更改为 ncursesw/ncurses.h 头文件。

我的回答是这样的。如果你想清晰地绘制新窗口,擦除和刷新 在绘制新窗口之前已经绘制了窗口。感谢所有 cmets :)

【讨论】:

  • 请编辑您的答案以获得更好的可读性(例如分段)。
猜你喜欢
  • 2019-03-08
  • 2016-02-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-10-03
  • 2015-05-25
相关资源
最近更新 更多