ncurses

How to keep the terminal from scrolling

浪尽此生 提交于 2019-12-25 05:44:02
问题 I am writing a simple program in C++ to be run in a terminal window. I would like the output text to be locked in position on the screen. Instead of each new line appearing at the bottom of the screen and pushing everything up, I would like to be able to change a line of text or some characters in a line of text, while keeping other lines above and below it static. I know I have seen this done in terminal, and I believe it was done with C++, but I can't find any documentation on it. I cannot

Python curses TypeError when exiting wrapper

﹥>﹥吖頭↗ 提交于 2019-12-25 04:24:28
问题 I'm running Mac OS X 10.9.5 and when wrapping my main() function with curses.wrapper I'm getting the following error after my program exits successfully: Traceback (most recent call last): File "test.py", line 42, in <module> wrapper(main(SCREEN)) File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/curses/__init__.py", line 94, in wrapper return func(stdscr, *args, **kwds) TypeError: 'NoneType' object is not callable Some amplifying code: if __name__ == "__main__": #

Changing Color Definitions ncurses C

ぃ、小莉子 提交于 2019-12-25 04:11:53
问题 I am learning ncurses and I have made a little program and I want to fill my window with a color. I want to fill it with a Red color but the default COLOR_RED is to bright and drives you crazy :) Here is what I tried. WINDOW *wnd = initscr(); start_color(); init_color(COLOR_RED, 184, 142, 12); init_pair(1, COLOR_WHITE, COLOR_RED); wbkgd(wnd, COLOR_PAIR(1)); refresh(); How can I use a modified color ? P.S : The code makes the background still the old COLOR_RED , not my modified one. 回答1: init

Unicode Box Drawing characters not printed in Ruby

落爺英雄遲暮 提交于 2019-12-24 20:01:31
问题 I work on a game in Ruby. It uses ncurses to draw window contents and refresh the screen. This all works fine on macOS, where I develop the stuff. But on Linux, I cannot get anything besides plain ASCII to print when interfacing with ncurses either from Ruby or plain C . For example, I get this output: Hello, world! M-b~U~TM-b~U~PM-b~U~WM-b~U~QM-b~U~QM-b~U~ZM-b~U~PM-b~U~]M-b~U~_M-b~T~@M-b~UM-" Instead of what I put into the source: Hello, world! ╔═╗║║╚═╝╟─╢ File encoding is UTF-8, env or

Creating a dynamic menu in ncurses

百般思念 提交于 2019-12-24 18:30:13
问题 I have been attempting to create a dynamic menu in ncurses for some time now and finally had some success. However I was concerned that the manner in which I am achieving this is risky. Below is my code: void ListBox::CreateMenu() { my_items = (ITEM **) calloc(2,sizeof(ITEM *)); char * choices[] = {"Search Results", (char *) NULL}; my_items[0] = new_item(choices[0], (char *) NULL); my_items[1] = new_item((char *) NULL, (char *) NULL); my_menu = new_menu((ITEM**) my_items); set_menu_win(my

Refresh Behaviour (nCurses)

给你一囗甜甜゛ 提交于 2019-12-24 16:54:35
问题 I recently was studying ncurses and a doubt just hit me: What EXACTLY does the refresh function does? I searched a little about it, read some tutorials and even a documentation and my conclusion was that it "refreshes" the actual screen with the format done on the "buffer screen" (it just updates the output on the screen). Doing some tests I clearly realized I was wrong since the output appeared with and without the refresh function! Below there's a simple program I did just to test it and I

C ncurses prevent resize

牧云@^-^@ 提交于 2019-12-24 13:23:55
问题 I am starting to learn how to use ncurses right now, and I do some calculations based on the number of lines and columns when the program starts. It would be too much work for me to do dynamic calculation to manage the display, so I would need to find a way to block the resize of the shell during the execution, is this possible ? 回答1: There is certainly no portable or general-purpose way of blocking display size changes. Specific terminal emulators might offer this feature, but I don't know

ncurses support for italics?

梦想与她 提交于 2019-12-24 11:59:13
问题 Some terminals, such as urxvt, support display text in italics via the sitm and ritm terminfo entries: echo `tput sitm`italics`tput ritm` I'd like to use this in an application I've got which wants to render real italics into the console. Unfortunately the application is ncurses-based, and ncurses doesn't seem to have a attribute for italics --- it's got a whole bunch, including invisible text (which I'm sure is useful for something), but no italics. Does anyone know of a way to trick ncurses

Ncurses place cursor in correct panel

时光毁灭记忆、已成空白 提交于 2019-12-24 08:24:57
问题 I am making an application which has several windows, each contained inside of a panel. One of these windows in particular must take input from the keyboard. I also need to be able to detect special keys like the F keys and the arrow keys. My current application is doing this currently. However the cursor is not in the proper location even after I call wmove(my_wins[1], 3, 2) . How do I move the cursor to be in the proper panel at the proper location? I would like the terminal cursor to be in

How to detect screen resize events coming from ncurses in QNX?

安稳与你 提交于 2019-12-24 03:25:37
问题 I can not configure to receive events about changing the size of the terminal using ncurses QNX Momentics. I am using Putyy as a terminal and data is transmitted through the COM port. My question is how to realize the reception of screen change events when using a remote terminal? FILE* fcons = fopen("/dev/ser1", "r+"); SCREEN* term = newterm("xterm-r5", fcons, fcons); int y = 0, x = 0; //if(y < 24 || x < 80) // resizeterm(24, 80); flushinp(); main_scr = newwin(24, 80, 0, 0); head_scr =