Repository navigation
Configurable word separators for selection, and the OSC terminator on OscReceived - #188
Conversation
JohnCampionJr
left a comment
There was a problem hiding this comment.
Pre-merge review (Codex), for the PR author
One should-fix finding: configured word expansion still stops at a wide character's continuation cell, so it does not honor the separator list and disagrees with keyboard word selection in the dependent control PR.
Checked option defaults/copying, separator caching and code-point decoding, OSC terminator propagation and constructor compatibility, and interaction with the checksum option. The combined core PRs passed 212 filtered tests. A focused reproduction failed for both CJK and an unlisted emoji. No finding in the OSC terminator addition.
912005e to
e7363f4
Compare
JohnCampionJr
left a comment
There was a problem hiding this comment.
Pre-merge review follow-up (Codex), for the PR author
Rechecked the post-review delta at e7363f4. Resolved: the retained CJK/emoji reproductions now select the whole word from either side. The added separator/continuation tests pass, including the default-rule CJK case. No new findings in this delta. The combined filtered core run passed 231 tests.
Why
A terminal host built on XTerm.NET (Confetty, a Ghostty-style terminal) needs two things the emulator doesn't expose yet:
SelectionManager.IsWordCharis private and fixed to letters, digits and_, so~/src/foo-bar.txtselects asfoo. Ghostty'sselection-word-charslets the user choose, and a host's own keyboard word motion should agree with the mouse, which it can't do while the rule is private.OscReceivedshould reply in the terminator the program used (BEL or ST), as the terminal's own replies already do. The parser knows; the event doesn't say.API
TerminalOptions.WordSeparators(string?)nullnullkeeps today's rule exactly. Given a string, every character not in it is part of a word (Ghostty's meaning), so.,-and/join a path unless listed. Each code point counts on its own, including ones outside the BMP. Copied by the options' copy constructor andClone. Read on every expansion, so a change applies to the next double-click.SelectionManager.IsWordChar(string?)OscReceivedEventArgs.EndedWithBelfalsefalse.One thing a host should know: blank cells hold a space rather than nothing, so a separator list without the space joins words across a gap of blank cells. Ghostty's default list (
\t '"│`|:;,()[]{}<>$) includes the space.Backward compatible
Purely additive. With
WordSeparatorsunset the word rule is the oneIsWordCharapplied before, andOscReceivedEventArgs' existing constructor and members are unchanged. Neither touches the print path. The separator set is parsed only when the option changes and consulted only by word expansion;EndedWithBelreads a flag the parser already keeps, once per OSC.Tests
WordSeparatorsTests(8): the default rule; a listed separator ending a word while unlisted punctuation joins it; Ghostty's default list on apath:line; a separator outside the BMP; blank cells as spaces; a change applying to the next double-click, including from one list to another; the public rule;Clone.OscTerminatorTests(4): BEL, ST, each sequence reporting its own, and the old constructor.Mutation passes caught all 10 mutants:
WordSeparators: the null fallback, the separator check, code-point decoding of the cell and of the list, the cache rebuild, the empty-cell rule, and the copy constructor. The first pass had one survivor (a separator set that never rebuilt); the test now switches between two lists and kills it.EndedWithBel: the terminator not passed, always BEL, and the argument not stored.tomlm/Iciclecreek.Avalonia.Terminal#212 builds on this: the control's keyboard word selection calls the now-public
IsWordChar, so it needs a release with this change.🤖 Generated with Claude Code