ncurses

Ncurses and Resizing window

假如想象 提交于 2019-12-08 09:08:54
问题 I tried to enter text at the bottom of window and print it on the top. I did this. But when I resize the window, cursor is attached to the bottom of the window and when I type the text, symbols do not echo on the screen. How fix it? Sorry for my English. my code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ncurses.h> #include <termios.h> #include <sys/ioctl.h> #include <signal.h> WINDOW* txt_win; WINDOW* msg_win; void sig_winch(int in) { struct winsize size; ioctl

color not ended in curses

久未见 提交于 2019-12-08 07:39:00
问题 I am recently working on a game project using the curses library, and I used color-related functions like start_color() , init_color() and init_pair() . The color works well in my project, but once its used, the colors in other TUI applications like vim will go wrong. For example: When I first edit some part of my code, it is like this: This is vim with colorscheme slate , and it looks good. However, when I run my code and exit and edit the code again, it become something like this: Note: I

How to effectively debug a multi-threaded curses client-server application with gdb?

こ雲淡風輕ζ 提交于 2019-12-08 02:26:55
问题 I'm writing a small client/server application that uses ncurses as TUI toolkit on the clients. The clients are multithreaded, there is a thread that is used to communicate with the server(via sockets) and a thread that handles the UI. I discovered a bug and I'd like to step through the instructions of the clients to see where the problem lies 1 . Simply running the clients in gdb doesn't work because gdb uses the same terminal as the client, hence the output is all messed up and this makes it

Output a nice “block” character with ncurses and C++?

▼魔方 西西 提交于 2019-12-08 01:41:12
问题 I'm writing a console app in c++ using ncurses and I'd like to output a solid ascii block. It'd basically tape up all of the area that would normally be reserved for white space of a normal character. Is there an ASCII character I'm missing or a library function I haven't seen in the manual? 回答1: ASCII is only 7-bit. If you are willing to go with 8-bit, there is the Code Page 437: http://en.wikipedia.org/wiki/Code_page_437 Then there is Unicode, which opens a whole new world of characters...

Errors building R-packages for conda

吃可爱长大的小学妹 提交于 2019-12-07 22:54:59
问题 I am having a tough time installing R-packages that are not available in the Anaconda repositories. My attempts so far can be found here How to install R-packages not in the conda repositories?. Currently, I am trying to build the R-package rafalib for conda by following the instructions from this article under the heading Building a conda R package . The first part works fine. conda skeleton cran rafalib Out: Tip: install CacheControl to cache the CRAN metadata Fetching metadata from http:/

Ncurses program exits when terminal resized

て烟熏妆下的殇ゞ 提交于 2019-12-07 14:45:42
问题 When i resize my terminal window, the below program exits. Why and how can stop it? #include <ncurses.h> #include <unistd.h> int main () { initscr (); printw ("Some text\n"); refresh (); sleep (100); endwin (); return 0; } 回答1: I found the answer here When terminal has resized, the SIGWINCH signal raises and program exits. Here is the solution: #include <ncurses.h> #include <unistd.h> #include <signal.h> int main () { initscr (); signal (SIGWINCH, NULL); printw ("Some text\n"); refresh ();

Ncurses/C/C++: Using getstr() and preventing overflow (There must be a better way to do this)

断了今生、忘了曾经 提交于 2019-12-07 12:08:18
问题 I am currently jumping into my first full C++ project and I've run into a hitch with Ncurses. getstr() requires a char array as input, but with this, there is no way to prevent buffer overflow. Lets pretend I'm using this input to get a name. My code would then be the following: int main(){ char* nameTemp = new char[160]; initscr(); getstr(nameTemp); endwin(); delete nameTemp; return 0; } But what happens if the user decides to use more than 160 characters for his name? I get an error and the

using curses with raw_input in python

ε祈祈猫儿з 提交于 2019-12-07 11:38:23
问题 In my python linux console application I use curses to handle displaying of data. At the same time I'd like to have an input line to enter commands, pretty much in good ol' irssi-style. With default curses getch() I'd have to do a lot of coding just to get the basic funcionality of raw_input function - arrow keys to move cursor / browse through the input history. Is there a simple way to get such behavior working with curses, as it captures input events and I can't just use functions that

Cannot link ncurses while compiling vim

馋奶兔 提交于 2019-12-07 08:13:45
问题 I'm trying to compile vim 7.3 in home directory. As a terminal library, I installed ncurses in ~/lib/ncurses/ncurses-5.9 with --with-shared option. After setting set path = ( ~/lib/ncurses/ncurses-5.9/bin/ $path ) setenv LD_LIBRARY_PATH ~/lib/ncurses/ncurses-5.9/lib/:$LD_LIBRARY_PATH I tried to configure vim with ./configure --enable-multibyte --prefix=/home/******/apps/vim/vim73 or ./configure --enable-multibyte --prefix=/home/******/apps/vim/vim73 --with-tlib=ncurses however it failes while

Python3 + Curses: How to press “q” for ending program immediately?

放肆的年华 提交于 2019-12-07 07:42:56
问题 When I run the following sample code and press just "q", it'll ends properly, but if I pressed any other characters "for instance many breaks and a lot of other characters" and then press "q" it'll not exit, how can I solve this? import curses, time def main(sc): sc.nodelay(1) while True: sc.addstr(1, 1, time.strftime("%H:%M:%S")) sc.refresh() if sc.getch() == ord('q'): break time.sleep(1) if __name__=='__main__': curses.wrapper(main) 回答1: Pressing other keys cause time.sleep(1) call, you