ncurses

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

梦想的初衷 提交于 2019-12-05 09:11:35
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 button events in my terminal. I've written a small ncurses program that goes something like this:

Change Terminal Font Size with C++

a 夏天 提交于 2019-12-05 05:42:39
I'm doing a small project for fun in C++ (in Ubuntu 11.04) and the program is text-based (all in the Gnome terminal). I'm using the ncurses library to change the font color, but I also want to print different sized text to the terminal, and can't figure out how to do that with ncurses. Is there a way to do this (perhaps with ncurses, or with a different library)? Ideally, I'd want it to be terminal-independent,, but if it's a solution that only works in Gnome, or only works in Ubuntu, or some other restriction like that then that's better than nothing! Thanks for your help as always. I've

Swift package manager unable to compile ncurses installed through Homebrew

强颜欢笑 提交于 2019-12-05 03:35: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"), .target(name: "NcursesExample", dependencies: ["Cncurses"]), ] ) Under the Sources directory I have a

cmake does non link ncurses

别说谁变了你拦得住时间么 提交于 2019-12-05 02:24:55
I am a total noob concerning cmake. My CMakeLists is really basic: cmake_minimum_required(VERSION 2.4.6) #set the default path for built executables to the "bin" directory set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) #set the default path for built libraries to the "lib" directory set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) #For the Curses library to load: SET(CURSES_USE_NCURSES TRUE) include_directories( "src/" ) add_subdirectory(src) when I make the linker does not find the ncurses commands and in the verbose mode of make I see that the compiler did not add the -lncurses.

ncurses api with the D Programming Language

旧时模样 提交于 2019-12-05 02:18:42
I am trying to teach myself AI using neural networks. Long story short, I wanted to create a simple graphic that would display what is happening in my program using ncurses. The tutorial that I am using is found here . I was under the impression that D was compatible with C and I could theoretically call C functions relatively easily. I find that not to be the case. I am a relatively novice programmer, so even the simplistic explanations are a little above my head. I found this here . D is designed to fit comfortably with a C compiler for the target system. D makes up for not having its own VM

NCurses and ESC,ALT keys

久未见 提交于 2019-12-05 02:14:58
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? 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 # otherwise -1 is sent (Escape) self.screen.nodelay(True) n = self.screen.getch() if n == -1: # Escape was pressed

Using ncurses to capture mouse clicks on a console application

流过昼夜 提交于 2019-12-05 02:11:25
I'm making a console application for unix platforms, and I'm using the curses (or ncurses) library to handle keyboard and mouse input. The problem is that I've found very little documentation on how exactly to use it for that, appart from this page and this one , which don't have very detailed examples. I've managed to capture the left click, but I can't get it to work for the right click because the options menu for the terminal emulator appears at the cursor location, but the event is not processed by the application. How can I avoid this and have the event captured in the application? I

Interrupt (n)curses getch on incoming signal

这一生的挚爱 提交于 2019-12-05 01:26:48
One of my programs uses ncurses for drawing a small tui. One of my goals is to make it rather portable to other curses implementations. This means that I want to catch a SIGWINCH issued by the terminal emulator on a resize operation myself and update my tui to adhere the changed geometry (and not depend on the resizing facilities of ncurses). Since POSIX (as far as I know) only allows access to sig_atomic_t variables within the signal handler, I set one to a different state. In the main loop, my program checks whether the state has changed and updates the tui if necessary. But now, I have the

php的redis.so扩展安装【PHP】

我的梦境 提交于 2019-12-05 00:26:56
一、资源准备,下载 不仅是redis.so,安装其他拓展的方式也类似 第一种方式: 下载:wget https://github.com/phpredis/phpredis/archive/develop.zip 解压:unzip develop.zip 进入目录:cd phpredis-develop 第二种方式: 找到PHP的安装目录 cd /usr/local/php/ext/pdo_sqlite/ (这里为啥用sqlite扩展,因为PHP安装包内不携带redis扩展) 如果/usr/local/php/ext/目录存在的拓展,都可以不用下载直接进入对应的安装包目录下 二、编译php扩展 1.在拓展目录中执行命令 usr/local/php/bin/phpize 或者 phpize 具体看你的PHP安装位置,和phpize命令的设置 2.执行命令 ./configure --with-php-config=/usr/local/php7/bin/php-config 不同拓展可能会有不同,此条命令适用于redis.so,其他没测 3.执行命令 make && make install 编译完成后屏幕会打印出拓展的位置,可以进行复制移动 三、拓展 1.修改php.ini文件,对应的拓展去掉冒号 extension=pdo_mysql extension=redis

Python curses not displaying colors, whereas C ncurses works fine

空扰寡人 提交于 2019-12-04 21:45:50
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 written because of the new line, but I can't see the text. I attempted various color pairs, but only 0, i.e