Skip to content

Commit

Permalink
Mouse copying in VSCode and IntelliJ
Browse files Browse the repository at this point in the history
Selecting text now works by default with these terminals.
  • Loading branch information
walles committed May 6, 2024
1 parent 52cf51f commit f1e8866
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MOUSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Most terminals support this capability, see [Selection workarounds for `scroll`
- `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
`terminalHasArrowKeysEmulation()` function in
`screen.go`](https://github.com/walles/moar/blob/master/twin/screen.go).

The reason these tradeoffs exist is that if `moar` requests mouse events from the terminal,
Expand Down
10 changes: 10 additions & 0 deletions twin/screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,16 @@ func terminalHasArrowKeysEmulation() bool {
return true
}

// VSCode 1.89.0, tested on macOS 14.4, May 6th, 2024
if os.Getenv("TERM_PROGRAM") == "vscode" {
return true
}

// IntelliJ IDEA CE 2023.2.2, tested on macOS 14.4, May 6th, 2024
if os.Getenv("TERM_PROGRAM") == "JetBrains-JediTerm" {
return true
}

return false
}

Expand Down

0 comments on commit f1e8866

Please sign in to comment.