或许 vim 自己处理了一些东西吧。不喜欢别人的东西自己造个轮子(或者说特殊定制/优化)在开源/自由软件圈子里很正常。
我进一步找了一些证据:
1. libtinfo.so 的确是 ncurses库的一员
$ strings libtinfo.so.5 | sort | uniq | nl | grep -i mouse
342 get_mouse
643 key_mouse
644 KEY_MOUSE
952 mouse_info
1184 req_mouse_pos
1.1 apt show libtinfo5 (debian)
Package: libtinfo5
Source: ncurses (5.9+20140913-1) <------ [证据]
Description: shared low-level terminfo library for terminal handling
The ncurses library routines are a terminal-independent method of
updating character screens with reasonable optimization.
.
This package contains the shared low-level terminfo library.
而vim ldd结果中有libtinfo (jessie的官方编译vim)
2. 安装了ncurses 的 dev包之后搜索头文件,关键字mouse
$ grep -i mouse -r /usr/include | cut -d ':' -f 1 | sort | uniq
./curses.h
./cursesw.h
./dialog.h
./dlg_keys.h
./linux/adb.h
./linux/hid.h
./linux/input.h
./linux/sysctl.h
./linux/tiocl.h
./linux/tty.h
./term.h
./x86_64-linux-gnu/bits/ioctl-types.h
3. 这一段摘自 /usr/include/ncurses.h
1525 /* mouse interface */
1526
1527 #if NCURSES_MOUSE_VERSION > 1
1528 #define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5))
1529 #else
1530 #define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6))
1531 #endif
1532
1533 #define NCURSES_BUTTON_RELEASED 001L
1534 #define NCURSES_BUTTON_PRESSED 002L
1535 #define NCURSES_BUTTON_CLICKED 004L
1536 #define NCURSES_DOUBLE_CLICKED 010L
1537 #define NCURSES_TRIPLE_CLICKED 020L
1538 #define NCURSES_RESERVED_EVENT 040L
1539
1540 /* event masks */
1541 #define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1,
NCURSES_BUTTON_RELEASED)
1542 #define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1,
NCURSES_BUTTON_PRESSED)
1543 #define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1,
NCURSES_BUTTON_CLICKED)
1544 #define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1,
NCURSES_DOUBLE_CLICKED)
1545 #define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1,
NCURSES_TRIPLE_CLICKED)
1546
1547 #define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2,
NCURSES_BUTTON_RELEASED)
1548 #define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2,
NCURSES_BUTTON_PRESSED)
1549 #define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2,
NCURSES_BUTTON_CLICKED)
1550 #define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2,
NCURSES_DOUBLE_CLICKED)
真相究竟是什么呢?
On 08/01/15 14:58, Zhang Cheng wrote:
支
持鼠标不是ncurses干的事情。不过我没有研究过具体是怎么实现的,但是以下事实可以证明不是ncurses干的。