Support select all
Ubuntu terminal has a select all command (not bound to a key by default). ChatGPT and I can't figure out a combination of actions that would accomplish this in Wezterm. At a lower level I don't see methods on pane or window that would allow manipulating the selection. Am I missing something?
See also: https://github.com/wezterm/wezterm/discussions/2026
I couldn't figure it out either FWIW. It seems that the selection API generally (over at https://wezterm.org/config/lua/keyassignment/index.html#available-key-assignments) operates with the mouse cursor in ind/
Q: what about using CompleteSelection and then starting the selection somehow?
A: In WezTerm, `CompleteSelection` **only finalizes an existing selection**—it does not start or expand a selection. There is currently **no API to programmatically start a selection at an arbitrary location** from Lua. All selection actions (`SelectTextAtMouseCursor`, `CompleteSelection`, etc.) operate on user-initiated selections or the mouse cursor.
**Summary:**
- `CompleteSelection` finishes a selection, but you must already have one.
- There is no Lua API to start or expand a selection programmatically.
- The only way to "select all" programmatically is to use `get_text_from_region` and copy to clipboard (not visually select).
**Recommendation:**
If your goal is to let the user quickly copy all scrollback, use the `get_text_from_region` + `copy_to_clipboard` approach (as in your commented-out code).
If you want visual selection, you must do it manually with the mouse or keyboard.
Let me know if you want the copy-to-clipboard binding re-added or further help!
Here's the solution... https://github.com/wezterm/wezterm/discussions/2026#discussioncomment-13293640
You're welcome.
Thanks! I ended up using that, altho it doesn't provide the visual feedback to be 100% equivalent
My pleasure.
"Select All" without automatic "clipboard copy" can be useful in another context as well: When you want to visually demarcate "before" from "after".
Example:
- Enter a long-running process such as
tail -f - When you want to mark that "I've seen everything so far", press Cmd+A and see the selection around all text
- Go away and come back. When more text has scrolled, the visual "selection" will have moved up and you can see that unselected text is "new", while selected text is "old" from before.
"Select All" without automatic "clipboard copy" can be useful in another context as well: When you want to visually demarcate "before" from "after".
That's a way I never heard of ^^ For your example I usually just press enter a bunch of times to have a visual separator (and sometimes type in a comment to remind me what I'm trying to do, to better understand the logs afterward)
For your example I usually just press enter a bunch of times to have a visual separator (and sometimes type in a comment to remind me what I'm trying to do, to better understand the logs afterward)
Thanks, yes, I have started doing this as well. I've seen some developers triple click a line with their mouse, too--so the single highlighted line in the terminal represents "what I saw last time".