ncurses

Print Unicode characters in C, using ncurses

混江龙づ霸主 提交于 2019-12-01 06:25:06
问题 I have to draw a box in C, using ncurses; First, I have defined some values for simplicity: #define RB "\e(0\x6a\e(B" (ASCII 188,Right bottom, for example) I have compiled with gcc, over Ubuntu, with -finput-charset=UTF-8 flag. But, if I try to print with addstr or printw, I get the hexa code. What I`m doing wrong? 回答1: ncurses defines the values ACS_HLINE , ACS_VLINE , ACS_ULCORNER , ACS_URCORNER , ACS_LLCORNER and ACS_LRCORNER . You can use those constants in addch and friends, which should

Installing ncurses for ruby on Windows

*爱你&永不变心* 提交于 2019-12-01 05:24:53
问题 I am trying to install ncurses for ruby on windows. I have not installed ncurses before on my machine. I thought that having the "ruby devkit", it had asked for would be enough, but now I am being asked to specify options... I don't know which options to pick, or if I need to do/install other things for the gem to get installed: C:\Ruby193\Devkit>gem install ncurses -- --ruby=C:/Ruby193/bin/ruby --without-make-prog --without-opt-dir Temporarily enhancing PATH to include DevKit... Building

How do I reduce input lag in an NCurses C Application

纵饮孤独 提交于 2019-12-01 04:32:02
问题 I am getting major amounts of input lag when I run my application. More details: When I press 'w', 'a', 's', 'd' (My assigned input keys) the object moves however it continues to move for an extended period of time after the key has been released. The source code is below however small parts of the code have been cut out to shorten the questions however if the source code below does not compile I have all of the code up on github. https://github.com/TreeStain/DodgeLinuxGame.git Thankyou for

ncurses to external shell and back messing with keys

天大地大妈咪最大 提交于 2019-12-01 04:26:39
问题 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 to ncurses when it's done. This ~almost works, except that the first few keypresses that ncurses gets afterwards are obviously bogus; ncurses thinks ^[ and A are seen respectively if I press the up arrow twice. Anyone seen this behavior before and know what the magic incant to fix this is? If it helps any, this is the Ruby

curses in python getstr() while refreshing

社会主义新天地 提交于 2019-12-01 04:16:18
问题 I am writing a front end for a server application using the curses module. THe main windows returned by curses is divided into 2 sub-windows. The top half of the screen prints output from the server while the bottom line takes input with window.getstr(). Sometimes when I am entering text and the top half is updating the whole screen goes crazy with random characters replacing the existing characters. Is there a specific cause for this or is it a curses bug? 回答1: I'm guessing you are using a

Edit text using Python and curses Textbox widget?

喜欢而已 提交于 2019-11-30 20:01:02
Has anybody got a working example of using the curses.textpad.Textbox widget to edit existing text? This is, of course, in a Linux terminal (e.g. xterm). Found this there is several minutes import curses import curses.textpad stdscr = curses.initscr() # don't echo key strokes on the screen curses.noecho() # read keystrokes instantly, without waiting for enter to ne pressed curses.cbreak() # enable keypad mode stdscr.keypad(1) stdscr.clear() stdscr.refresh() win = curses.newwin(5, 60, 5, 10) tb = curses.textpad.Textbox(win) text = tb.edit() curses.beep() win.addstr(4,1,text.encode('utf_8')) I

How to get input from keyboard while doing other things at the same time?

孤人 提交于 2019-11-30 18:38:15
I'm using C (gcc) and ncurses, to make a program that will be monitoring data coming from the serial port. The program has a big while , where it reads the data coming from the port and at the same time, it prints that info in the screen... But the problem is here: How can it read input from my keyboard, (since getch() freezes the program until it gets an input) and at the same time read info coming from the port? Maybe I have to use another way (not the big while ), so ideas are welcome! make getch a non-blocking call using nodelay option. nodelay(stdscr,TRUE); More info can be found at http:

Building Vim from Source in Cygwin

余生颓废 提交于 2019-11-30 16:48:25
I am trying to build Vim from the source packages, under Cygwin, to enable Python support. I am following the instructions given here , but I'm hitting this error when I run the configure script: checking --with-tlib argument... empty: automatic terminal library selection checking for tgetent in -lncurses... no checking for tgetent in -ltermlib... no checking for tgetent in -ltermcap... no checking for tgetent in -lcurses... no no terminal library found checking for tgetent()... configure: error: NOT FOUND! You need to install a terminal library; for example ncurses. Or specify the name of the

ncurses and stdin blocking

為{幸葍}努か 提交于 2019-11-30 16:04:28
I have stdin in a select() set and I want to take a string from stdin whenever the user types it and hits Enter . But select is triggering stdin as ready to read before Enter is hit, and, in rare cases, before anything is typed at all. This hangs my program on getstr() until I hit Enter . I tried setting nocbreak() and it's perfect really except that nothing gets echoed to the screen so I can't see what I'm typing. And setting echo() doesn't change that. I also tried using timeout(0) , but the results of that was even crazier and didn't work. What you need to do is tho check if a character is

How to input a word in ncurses screen?

南笙酒味 提交于 2019-11-30 14:14:38
问题 I was trying to use raw_input() function first, but find it in compatible with ncurses. Then I tried window.getch() function, I can type and show characters on screen, but can't realize input. How can I input a word in ncurses and can use if statement to evaluate it? For example, I wanna realize this in ncurses : import ncurses stdscr = curses.initscr() # ???_input = "cool" # this is the missing input method I want to know if ???_input == "cool": stdscr.addstr(1,1,"Super cool!") stdscr