how to get a correctly sized window in ncurses

故事扮演 提交于 2020-02-06 09:07:45

问题


I am trying out ncurses programming in C on Linux (Mint) and am having a strange problem. I keep getting windows with the wrong number of columns for the first and final lines. For example, with this code found on StackOverflow

#include <ncurses.h>
int main(){
  initscr();

  WINDOW * win = newwin(10,50,10,10);
  box(win,0,0);
  wrefresh(win);

  wgetch(win);
  endwin();
  return 0;
}

I get this output:

          ┌─┐
          │                                                │
          │                                                │
          │                                                │
          │                                                │
          │                                                │
          │                                                │
          │                                                │
          │                                                │
          └─┘

As if the first and final lines are only three columns wide. If I add text to the window, using waddch, I can only add three characters to the top line as well.

Any help would be appreciated, I can't find examples of other people running into this issue on the web, but it's not the easiest thing to come up with a good search string for.


回答1:


Looks like you're using one of those xterm look-alikes, and running into their omission of repeat-character, noted a little over a year ago in the ncurses FAQ.



来源:https://stackoverflow.com/questions/51904557/how-to-get-a-correctly-sized-window-in-ncurses

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!