Bug 248772

Summary: sysutils/less: option "--mouse" breaks selecting/copying text in xterm.
Product: Ports & Packages Reporter: Ottavio Caruso <ottavio2006-usenet2012>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Open ---    
Severity: Affects Only Me CC: jharris, lwhsu
Priority: --- Flags: bugzilla: maintainer-feedback? (jharris)
Version: Latest   
Hardware: amd64   
OS: Any   

Description Ottavio Caruso 2020-08-20 08:54:25 UTC
% uname -a
FreeBSD FreeBSD 12.1-RELEASE-p8 FreeBSD 12.1-RELEASE-p8 GENERIC  amd64

I have installed less from ports:

% /usr/local/bin/less --version
less 551 (PCRE regular expressions)


Launching less with the "--mouse" option prevents selecting and copying text in xterm compliant terminals by the usual left-down-clicking.

How to replicate:

1) Install less from ports

2) /usr/local/bin/less /var/log/messages.

   Select a block of text by left-down-clicking: this work

3) /usr/local/bin/less --mouse /var/log/messages

   Select a block of text by left-down-clicking: doesn't work.

Workaround: selecting a block of text by [SHIFT] + left-down-clicking: works, but it is not expected behaviour.


Same thing happens if $PAGER is set to "/usr/local/bin/less --mouse".

My environment:

% setenv
USER=oc
LOGNAME=oc
HOME=/home/oc
SHELL=/bin/tcsh
BLOCKSIZE=K
MAIL=/var/mail/oc
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/oc/bin
TERM=xterm
HOSTTYPE=FreeBSD
VENDOR=amd
OSTYPE=FreeBSD
MACHTYPE=x86_64
SHLVL=1
PWD=/home/oc
GROUP=oc
HOST=FreeBSD
EDITOR=vi
PAGER=less
LESS=-i -m +Gg


Resetting $LESS to null doesn't solve the issue.
Comment 1 James French 2020-08-20 09:38:16 UTC
Upstream issue was reported 14th of Feb 2020.

https://github.com/gwsw/less/issues/47

The workaround suggested here is to hold down shift while selecting.

https://github.com/gwsw/less/issues/47#issuecomment-586270348

No comment upstream as to whether this was the intended behaviour or not, nor any pull requests to address it.