GNU screen mouse limitation

gnome-terminal, gnu-screen, ubuntu, vim

Solution

After searching for GNU screen sgr support I came across a patch! Here are the steps I used to apply the patch to screen on Ubuntu 14.04. (I've modified that patch to work with the source files downloaded from apt-get here)

Pull down the screen source from apt-get:

apt-get source screen

`cd` into the source directory and install the patch:

patch -p1 < screen-sgr-patch.diff

Integrate local changes made by the patch:

dpkg-source --commit

Build the new `.deb` files:

dpkg-buildpackage -us -uc

(NOTE: it may complain about missing build dependencies but just install any of them using `apt-get` and run `dpkg-buildpackage` again)

Install the patched screen package (you'll find this beside the source directory):

dpkg -i screen_<version>_<arch>.deb

Problem

My typical development environment is running a GNU screen session with vim in a full screen terminal (typically gnome-terminal). The problem I've run into is that the mouse pointer is not interpreted correctly when clicking on a character in vim beyond around the 223rd character in the terminal. I have tried the solution to another question (adding `set ttymouse=sgr` to my `.vimrc`), and this solves the problem for running vim directly in the terminal but the limitation with the mouse still exists when using vim inside a screen session.

Original source

Related problems