[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature: where terminal reports mouse click to bash, support positio

From: Koichi Murase
Subject: Re: Feature: where terminal reports mouse click to bash, support positioning the cursor accordingly
Date: Mon, 18 Jan 2021 14:01:42 +0800

2021年1月18日(月) 12:32 IFo Hancroft <lists@ifohancroft.com>:
> What you want (the ability to reposition the cursor in the terminal
> with a mouse click) can be done with just the terminal itself.

I think Mike wanted to move the current text insertion point in
Readline (or, in other words, the command line of Bash) but not just
move the current cursor position in the terminal.  If the terminal
just moves its cursor position without sharing the information with
the application (i.e., Bash in this case), the result would be just
broken rendering.

So, this does have something to do with Bash or any text editors
working in terminals.  In fact, recent versions of Emacs and Vim
supports mouse using the mouse escape sequences of terminals.  A
terminal application (such as Bash or text editors) could receive from
the terminal the mouse events encoded in terminal sequences, move its
internal cursor position, render the updated text content and move
the terminal cursor position by sending escape sequences to the

There has been some attempt to support the mouse in zsh:


but I think this implementation is not robust.  For example, I think
this doesn't work when there are wide characters in the command line
or the text content doesn't fit into a single terminal line.

Actually, there is some practical problem of supporting mouse by
shells: the shell is not a full-screen terminal application so that
it cannot handle the mouse events that occurred outside the command
line.  So, one needs to compromise with some features or integrate
something like terminal multiplexers in the shell to manage all the
terminal contents in the shell.  There were some discussions in Oil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]