Bug 248772 - sysutils/less: option "--mouse" breaks selecting/copying text in xterm.
Summary: sysutils/less: option "--mouse" breaks selecting/copying text in xterm.
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-20 08:54 UTC by Ottavio Caruso
Modified: 2023-04-30 11:23 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (jharris)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.
Comment 2 Robert Clausecker freebsd_committer freebsd_triage 2023-04-30 11:23:17 UTC
That's just how terminal emulators work.  When the program running in the terminal requests to access the mouse, the terminal emulator assumes that it'll take care of text selection and copy/paste within the program.  The terminal emulator's own text selection/copy/paste mechanism is then only accessible by clicking shift.  There's nothing wrong with less here.