ncurses

How to implement proper mouse support in a terminal / terminfo entry?

余生长醉 提交于 2019-12-07 06:00:55
问题 I've implemented a terminal emulator and a corresponding terminfo entry that allows me to run ncurses programs like emacs , mc (midnight commander) or tig (git browser). I want to add mouse support to the terminal , most notably to position the cursor in emacs by clicking into the window. After a lot of googling and some help on stackoverflow I learned about the required terminfo fields (most notably kmous ) and control (e.g. \E[?1000h ) and "key" ( \E[M... ) sequences and implemented mouse

using ncurses in a virtual terminal

那年仲夏 提交于 2019-12-07 04:44:16
问题 I'm new to Linux and virtual terminals as well as to Curses, so please forgive me if this description isn't clear as it could be. I'm trying to use Curses on Fedora 12 to output status information to a virtual terminal (you know one of the terminals you can get to by pressing ctrl-alt-Fx). When I start up my application on one of the virtual terminals ($TERM=linux), the lines for the boxes come out as the characters 'j', 'q', 'k'....(and a few other characters). Yet when I start it within a

[LINUX]利用Ncursesw编写支持中文的终端程序

本秂侑毒 提交于 2019-12-07 02:54:42
1. Ncursesw库的安装与使用 Ncurses库的安装(Ubuntu): 查看相关软件包 sudo apt-cache search ncursesw 安装ncursew必须软件包 sudo apt-get install libncurses5 libncurses5-dbg libncurses5-dev 使用Ncursesw库时,需要包含头文件 ncurses.h,没错,头文件没有改变。相应地,相关函数的使用也没有改变。 然而,在编译源文件时,采用选项-lncursesw替代原用-lncurses。 2. 使程序支持中文字符 在调用initscr()函数前,需要首先调用setlocale(LC_ALL,"")设置终端环境。具体请参见 man 3 setlocale 在man page中,我们还可以知道,为了使用setlocale这个函数,需要包含头文件locale.h。 如果没有这个头文件,可尝试安装libicu-dev软件包。 演示: #include <ncurses.h> #include <locale.h> int main(void) { setlocale(LC_ALL,""); initscr(); attron(A_BOLD); printw("成功支持中文字符"); attroff(A_BOLD); refresh(); getch();

Swift package manager unable to compile ncurses installed through Homebrew

最后都变了- 提交于 2019-12-06 23:43:07
问题 I'm trying to use ncurses in a library using Swift Package Manager and I'd like to use a specific version of ncurses, not the one included in OS X. To do so I installed a more recent version (6.1) using Homebrew. This is how my Package.swift looks like: // swift-tools-version:5.0 import PackageDescription let package = Package( name: "NcursesExample", products: [ .executable(name: "NcursesExample", targets: ["NcursesExample"]), ], dependencies: [ ], targets: [ .systemLibrary(name: "Cncurses")

NCurses and ESC,ALT keys

a 夏天 提交于 2019-12-06 19:44:54
问题 I have a problem with NCurses ... i need to handle all keys like Esc , Alt + F etc. Problem is that the codes are similar... i.e: Esc - 27 Alt + A - 27 65 As an example there is double code for Alt + [key] combination what similar to Esc key... Any ideas how handle that? 回答1: Here is an example for python: key = self.screen.getch() if key == ord('q'): # quit go = False elif key == 27: # Esc or Alt # Don't wait for another key # If it was Alt then curses has already sent the other key #

Python curses not displaying colors, whereas C ncurses works fine

喜你入骨 提交于 2019-12-06 16:17:47
问题 I can't seem to get the Python curses module to display colors, whereas the ncurses C library works fine. Here is a simple script that should work: import curses def main(stdscr): if not curses.has_colors(): raise stdscr.addstr("Hello world\n", curses.color_pair(curses.COLOR_RED)) stdscr.addstr("Press any key to exit.\n") stdscr.refresh() while stdscr.getch() == -1: pass if __name__ == '__main__': curses.wrapper(main) I can only see "Press any key to exit.". I know "Hello world" is being

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

本小妞迷上赌 提交于 2019-12-06 12:18:38
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? 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... 来源: https://stackoverflow.com/questions/5117171/output-a-nice-block-character-with-ncurses-and-c

ncurses trapping extended keys (Control-left, Shift-Function etc)

风流意气都作罢 提交于 2019-12-06 11:34:28
I am trying to trap Control-Left, Shift-F10 etc in my ruby programs. Normally, using just getch I get a list of ints such as 27,91,50,50,126 which works. However I fear these may be system or terminal dependent. After googling I found about use_extended_names, tigetstr etc. I found a C program using these which discovers the keycodes at run time (by Thomas Dickey). I run it and it seems to discover extended keys, but then the getch in the same program still gives me the usual list of ints such as [27,91,53,68] for C-left which I am getting anyway. I expect to get one return value, the one it

Errors building R-packages for conda

蓝咒 提交于 2019-12-06 11:21:50
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://cran.r-project.org/ Writing recipe for rafalib Done The build command runs into errors conda build r

Printing double-size characters with Ncurses

ぐ巨炮叔叔 提交于 2019-12-06 06:34:34
Many terminal emulators (xterm, Konsole) support double-size characters . Ncurses does not support this and as far as I know, ncurses will not print escape characters (\033 will be unescaped and printed in clear text). Is it possible at all to print double-size characters in a ncurses application? The "double-size" character capability you refer to is set by the following ANSI sequences (found here ): ESC # 3 DEC double-height line, top half (DECDHL) ESC # 4 DEC double-height line, bottom half (DECDHL) The \e#3 attribute makes the terminal switch character sets to one which only contains the