ncurses

Receiving key press and key release events in Linux terminal applications?

独自空忆成欢 提交于 2019-11-28 08:16:53
I would like to write a simple C program that will perform different actions based on both "key down" and "key up" events. This program will be run from inside rxvt . What library or mechanism should I use to access both key presses and releases? Is it true that reading /dev/tty will only provide key releases? Is this also true for termcap, terminfo, ncurses, and slang? Is there a way to achieve this from within a terminal application? The following links may be of some assistance in using the keyboard raw mode which will give you access to the keyboard events rather than just key releases.

How can I add “-with-python” options by building gvim/vim from source code in Windows

寵の児 提交于 2019-11-28 06:37:24
问题 I've tried to build vim/gvim from source code in windows for several days. And, the building actually works by both ways CygWin and WinGW . However, python wasn't "added" in my (g)vim.exe (it disabled pyflakes.vim ): :echo has('python') 0 Here is my commands: Cygwin: make -f Make_cyg.mak PYTHON=/cygdrive/c/Marslo/MyProgram/Python27 DYNAMIC_PTYHON=yes PYTHON_VER=27 PYTHON3=/cygdrive/c/Marslo/MyProgram/Python33 DYNAMIC_PYTHON3=yes PYTHON3_VER=33 FEATURES=huge IME=yes CPUNR=i686 ARCH=i686 GUI

curses-like library for cross-platform console app in python

佐手、 提交于 2019-11-28 05:54:50
I'm looking into developing a console application in python which should be able to run under Windows as well as Linux. For this, I'd really like to use a high-level console library like curses. However, as far as I know, curses is not available on Windows. What other options do I have? Unfortunately, using cygwin under Windows is not an option... Thanks for your help! ehempel There is a wcurses . I've never tried it but it may meet your needs. It sounds like it doesn't have full curses compatibility, but may be close enough. Also it might not be using the DOS terminal, but opening a GUI

Printing a Unicode Symbol in C

青春壹個敷衍的年華 提交于 2019-11-28 04:36:47
问题 I'm trying to print a unicode star character (0x2605) in a linux terminal using C. I've followed the syntax suggested by other answers on the site, but I'm not getting an output: #include <stdio.h> #include <wchar.h> int main(){ wchar_t star = 0x2605; wprintf(L"%c\n", star); return 0; } I'd appreciate any suggestions, especially how I can make this work with the ncurses library. 回答1: Two problems: first of all, a wchar_t must be printed with %lc format, not %c . The second one is that unless

What's the difference between -lcurses and -lncurses when compiling C using ncurses lib?

天涯浪子 提交于 2019-11-28 03:43:03
问题 I'm learning C and playing with the ncurses lib. I have seen references to both -lcurses and -lncurses but I have yet to find any differences (both work when compiling). Appreciate the help! 回答1: ncurses is an open-source clone of the original Unix curses library. libcurses.* usually points to libncurses.* to provide compatibility with the original library, so there would be no practical difference between using one over the other. If you do in fact have more than one 'curses-type' library

ncurses multi colors on screen

一曲冷凌霜 提交于 2019-11-28 03:16:10
问题 I want to make a menu with ncurses.h and more than one color. I mean something like this: ┌────────────────────┐ │░░░░░░░░░░░░░░░░░░░░│ <- color 1 │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ <- color 2 └────────────────────┘ But if I use init_pair() , attron() and attroff() the color of the whole screen is the same, and not like I've expected. initscr(); init_pair(0, COLOR_BLACK, COLOR_RED); init_pair(1, COLOR_BLACK, COLOR_GREEN); attron(0); printw("This should be printed in black with a red background!\n");

How do I get the 'clear' command in Cygwin?

≡放荡痞女 提交于 2019-11-28 02:39:11
I installed Cygwin, choosing a fairly minimal set of packages. In a terminal, I tried to do 'clear' to clear the terminal, but I get bash: clear: command not found How do I get this to work? Marnix Klooster Install the Cygwin package ncurses ; it is in the Utils category. Krishna Murthy This should do: alias clear='printf "\033c"' just use this shortcut: Alt+F8 and Ctrl-L to skip page Jared French It's nice to have the clear.exe program for bash script files, so: Windows Cygwin detail for clear.exe program command. Download Cygwin setupx86.exe or whatever it's call at http://cygwin.com/ Run it

How to make ncurses display UTF-8 chars correctly in C?

点点圈 提交于 2019-11-28 01:56:00
I have a program written in C using ncurses. It let user input and display it. It does not display correctly if user input utf8 chars. I saved the chars user inputed to a file. And I cat this file directly in Shell, it display correctly. I searched stackoverflow and google, and tried several methods, such as link with ncursesw, display incorrectly. And I ldd /usr/bin/screen : libncurses.so.5 => /usr/lib64/libncurses.so.5 screen can display what user input correctly. How to make ncurses display UTF-8 chars correctly ? What is the general way to display UTF-8 chars in C using ncurses? You need

getch and putchar not working without return

↘锁芯ラ 提交于 2019-11-28 01:44:50
I have been trying to get getch to work in another program with no success. So I have made the most basic program I can using getch the way I want it to work in the main program. I have researched the need for noecho , cbreak , initscr and nodelay , I have also tried using newscr() but to no success. The problem I am having is that the chars aren't being printed to the screen till I hit "enter", when they should be put to the screen every loop. Why is this happening? Also the cursor doesn't return to the left of the screen at the new line. eg. abc def ghi I have looked for the answer but am

How to use ANSI escape codes inside mvwprintw in ncurses?

痞子三分冷 提交于 2019-11-28 01:25:27
Is there a way to use ANSI escape codes inside mvwprintw ? mvwprintw(window, 0, 0,"%c[%dmCOLORED_TEXT!\n", 0x1B, 32);//doesn't work even though: printf("%c[%dmCOLORED_TEXT\n", 0x1B, 32); //works This would be for cases where using wattron / wattroff is not convenient; for example, when redirecting output from stdout of a process that outputs such escape codes. No. The only way to make that work would be to parse the string yourself, turning escape codes back into the appropriate curses commands, to issue along with your output. One thing you should realize is that those codes, although widely