mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
fix(tui): use iterm2 word characters for fullscreen double-click selection (#11340)
- add iterm2's default word characters (`+ \ ~ _ .`) to fullscreen
double-click selection
([source](7f4ff73972/sources/Settings/iTermPreferences.m (L743)))
- `~/...`, `~/.pi/...`, `~\...`, `foo+bar` now select whole
- add regression cases for `~`, `.`, `\`, `+`
- fixes #10980
This commit is contained in:
parent
bc73eb8b15
commit
ff68964715
3 changed files with 10 additions and 2 deletions
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed fullscreen double-click selection splitting paths and tokens at `~`, `.`, `\`, and `+`. Word characters now match iTerm2's defaults ([#10980](https://github.com/earendil-works/pi/issues/10980))
|
||||
|
||||
## [1.4.0] - 2026-10-21
|
||||
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -81,8 +81,9 @@ const MAX_CACHED_OFFSCREEN_KITTY_DECODED_BYTES = 64 * 1024 * 1024;
|
|||
const DOUBLE_CLICK_INTERVAL_MS = 500;
|
||||
const COPY_ERROR_FLASH_DURATION_MS = 5000;
|
||||
// Regular mode delegates double-click selection to the terminal emulator. Fullscreen owns mouse selection,
|
||||
// so mirror common terminal word-selection behavior by keeping paths and kebab-case tokens whole.
|
||||
const TERMINAL_WORD_SELECTION_JOINERS = new Set(["/", "-"]);
|
||||
// so it uses iTerm2's default "characters considered part of a word" set:
|
||||
// https://github.com/gnachman/iTerm2/blob/7f4ff739721f95d0b93003d8701c4523a7edf261/sources/Settings/iTermPreferences.m#L743
|
||||
const TERMINAL_WORD_SELECTION_JOINERS = new Set(["/", "-", "+", "\\", "~", "_", "."]);
|
||||
const wordSegmenter = getWordSegmenter();
|
||||
|
||||
interface CachedKittyImage {
|
||||
|
|
|
|||
|
|
@ -1544,6 +1544,9 @@ describe("TuiAltScreen", () => {
|
|||
for (const { line, needle } of [
|
||||
{ line: "extensions/starline/fixed-editor/compositor.ts", needle: "starline" },
|
||||
{ line: "earendil-works/pi-tui", needle: "works" },
|
||||
{ line: "~/.pi/agent/settings.json", needle: "agent" },
|
||||
{ line: "~\\Documents\\pi", needle: "Documents" },
|
||||
{ line: "foo+bar", needle: "bar" },
|
||||
]) {
|
||||
const copied: string[] = [];
|
||||
const terminal = new RecordingTerminal(80, 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue