From 8ec3df792a1003ef263fc0a12fc061755277c993 Mon Sep 17 00:00:00 2001 From: Johan Walles Date: Tue, 19 Dec 2023 09:20:02 +0100 Subject: [PATCH] Use "select" as a term for selecting text This is a better term, as pointed out by @postsolar in #173 --- MOUSE.md | 8 ++++---- moar.1 | 6 +++--- moar.go | 8 ++++---- twin/screen.go | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/MOUSE.md b/MOUSE.md index 4a23639..7c63e89 100644 --- a/MOUSE.md +++ b/MOUSE.md @@ -5,8 +5,8 @@ - `scroll` makes `moar` process mouse events from your terminal, thus enabling mouse scrolling work, but disabling the ability to select text with mouse in the usual way. Selecting text will require using your terminal's capability to bypass mouse protocol. Most terminals support this capability, see [Selection workarounds for `scroll` mode](#mouse-selection-workarounds-for-scroll-mode) for details. -- `mark` makes `moar` not process mouse events. This makes selecting and copying text work, but scrolling might not be possible, depending on your terminal and its configuration. -- `auto` uses `mark` on terminals where we know it won't break scrolling, and +- `select` makes `moar` not process mouse events. This makes selecting and copying text work, but scrolling might not be possible, depending on your terminal and its configuration. +- `auto` uses `select` on terminals where we know it won't break scrolling, and `scroll` on all others. [The white list lives in the `mouseTrackingRecommended()` function in `screen.go`](https://github.com/walles/moar/blob/master/twin/screen.go). @@ -15,9 +15,9 @@ The reason these tradeoffs exist is that if `moar` requests mouse events from th it should process _all_ mouse events, including attempts to select text. This is the case with every console application. However, some terminals can send "fake" arrow key presses to applications which _do not_ request processing mouse events. -This means that on those terminals, you will be better off using `--mousemode mark` option, given that you also have this feature enabled (it's usually on by default). +This means that on those terminals, you will be better off using `--mousemode select` option, given that you also have this feature enabled (it's usually on by default). With this setup, both scrolling and text selecting in the usual way will work. -To check whether this could work, simply run `moar` with option `--mousemode mark` and see if scrolling still works. +To check whether this could work, simply run `moar` with option `--mousemode select` and see if scrolling still works. ## Mouse Selection Workarounds for `scroll` Mode diff --git a/moar.1 b/moar.1 index 3998a67..a0af774 100644 --- a/moar.1 +++ b/moar.1 @@ -45,9 +45,9 @@ Print debug logs after exiting, less verbose than Scrolls automatically to follow piped input, just like .B tail \-f .TP -\fB\-\-mousemode\fR={\fBauto\fR | \fBmark\fR | \fBscroll\fR} -Guarantee marking text with the mouse works but maybe not mouse scrolling. -Or guarantee mouse scrolling works but marking requiring extra effort. +\fB\-\-mousemode\fR={\fBauto\fR | \fBselect\fR | \fBscroll\fR} +Guarantee selecting text with the mouse works but maybe not mouse scrolling. +Or guarantee mouse scrolling works but selecting text requiring extra effort. Details here: https://github.com/walles/moar/blob/master/MOUSE.md .TP \fB\-\-no\-clear\-on\-exit\fR diff --git a/moar.go b/moar.go index b78ab2f..eaa3ca0 100644 --- a/moar.go +++ b/moar.go @@ -245,13 +245,13 @@ func parseMouseMode(mouseMode string) (twin.MouseMode, error) { switch mouseMode { case "auto": return twin.MouseModeAuto, nil - case "mark": - return twin.MouseModeMark, nil + case "select", "mark": + return twin.MouseModeSelect, nil case "scroll": return twin.MouseModeScroll, nil } - return twin.MouseModeAuto, fmt.Errorf("Valid modes are auto, mark and scroll") + return twin.MouseModeAuto, fmt.Errorf("Valid modes are auto, select and scroll") } func pumpToStdout(inputFilename *string) error { @@ -408,7 +408,7 @@ func main() { flagSet, "mousemode", twin.MouseModeAuto, - "Mouse mode: auto, mark or scroll: https://github.com/walles/moar/blob/master/MOUSE.md", + "Mouse mode: auto, select or scroll: https://github.com/walles/moar/blob/master/MOUSE.md", parseMouseMode, ) diff --git a/twin/screen.go b/twin/screen.go index ae6a3e6..2cb5adc 100644 --- a/twin/screen.go +++ b/twin/screen.go @@ -17,10 +17,10 @@ type MouseMode int const ( MouseModeAuto MouseMode = iota - // Don't capture mouse events. This makes marking with the mouse work. On + // Don't capture mouse events. This makes selecting with the mouse work. On // some terminals mouse scrolling will work using arrow keys emulation, and // on some not. - MouseModeMark + MouseModeSelect // Capture mouse events. This makes mouse scrolling work. Special gymnastics // will be required for marking with the mouse to copy text. @@ -142,7 +142,7 @@ func NewScreenWithMouseModeAndColorType(mouseMode MouseMode, terminalColorCount if mouseMode == MouseModeAuto { screen.enableMouseTracking(!terminalHasArrowKeysEmulation()) - } else if mouseMode == MouseModeMark { + } else if mouseMode == MouseModeSelect { screen.enableMouseTracking(false) } else if mouseMode == MouseModeScroll { screen.enableMouseTracking(true)