-
Notifications
You must be signed in to change notification settings - Fork 762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search scrollback #189
Comments
Would be cool to fake what terminal emulator in vim does -- where you can pause the existing session CleanShot.2023-07-07.at.00.09.42.mp4 |
Looking forward to this feature - I missed it yesterday when I had a lot of output from a command and wanted to search for the word "fail". |
Kitty has a a pretty novel approach here that I've actually really enjoyed - This also lets you take advantage of the pager's features and can be tailored to a certain user's preference without minimal load on our side. |
FYI Ghostty has this too, bound to It works slightly differently than Kitty in that it puts the temp file path to the captured scrollback on the command line rather than opening it in a pager directly. |
Once we have search, searching via regex would be really nice to have. I've been finding myself search for |
One nice thing about Kitty's implementation is you can even use it as a program is actively running and potentially still outputting text; new text doesn't automatically get fed into your pager but you don't need to wait until a command finishes to use the pager functionality. I'm not immediately sure if that would be equivalent in behavior to
|
I'm used to screen/tmux behavior here: ctrl-A,[ puts you into 'scrollback mode' where you can then use the keyboard (vi-keys) to scroll up and down, and then even hilight some text and put it into a clipboard where you can then paste it with ctrl-A,]. I don't think it updates the buffer while scrolling, though... but I don't see why it couldn't just extend it downward. |
Personally I'd rather this stuck to OS-native conventions for search functionality as well as look and feel. I don't think implementation-specific idiosyncrasies are a good idea since a lot of folks will have differing preferences and expectations. The implementation along the lines of what's provided by Terminal.app or iTerm would be fine since that easily lets you search the scrollback buffer in a way that doesn't affect any additional output. |
@qwerasd205 Are you working on this now? I'd be happy to help out on the macOS UI front. (I mentioned this in Discord but just surfacing it here too since I rarely check over there.) |
I am working on laying some groundwork for this with a basic implementation of the search functionality - focused mainly on proper threading for the search and creating a good interface for the UI code to talk to with minimal coupling, so that in the future we can improve the performance of the search (if necessary) by changing the algorithm and/or data structures used for the searching. I'll open a draft PR once I've got the first "technically functioning" version of the code. Right now it's in too early of a state to really create UI for. |
Personally, "native" in a terminal means "vi-like" to me :) I also think kitty's approach is pretty flexible and can probably be used along side a more classic But why I actually wanted to comment is related to generic search, but a bit more specific: sometimes you actually see what you need on screen, but want to quickly copy/paste/execute it without a mouse. Back when I was using kitty I used hints a lot, and in tmux I use tmux-butler. Behind the scenes these use cases could be regex-searches constrained to the currently visible text, although obviously the UI would be quite different. Imho especially quickly opening links in the browser and copying paths to the prompt without a mouse is really useful. |
I wanted to file a feature request for something like Kitty Hints like @ferdinandyb mentioned. However, after a bit of searching, I figured this issue is a prerequisite for such a hinting system. |
Re:
Mitchell confirmed on Discord that this issue isn't a prerequisite for a "hints" feature - so I've gone ahead and created a separate issue to specifically discuss that feature request: |
I got sidetracked from this shortly after starting work on it, but to summarize the architecture I landed on for the search thread: Search ThreadData
Messages
Whenever the surface is notified of new search results, it updates its display accordingly, reading from the results list should be thread safe. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…creen_file`) (#5285) The current default keybinding on `Ctrl-Shift-J`/`Cmd-Shift-J` utilize [`write_scrollback_file`](https://ghostty.org/docs/config/keybind/reference#write_scrollback_file) which only captures text that's scrolled off-screen. This can be confusing, as I would expect it to capture everything on and off-screen. Per the docs, [`write_screen_file`](https://ghostty.org/docs/config/keybind/reference#write_screen_file) is the "Same as `write_scrollback_file` but writes the full screen contents" which is perfect to solve this problem and aligns exactly with the expected behavior. This change addresses the friction that people have reported in the discussions below and specifically coming from the [search scrollback feature discussion](#189), where `Ctrl-Shift-J`/`Cmd-Shift-J` is one of the interim decent workarounds but then you also have to figure out the extra intricacy to use `write_screen_file` instead of `write_scrollback_file`. Previous discussions: - #3652 - #3496 - #4911 - #4390 - #2363 (comment) - #189 (comment) - #2040 ### Workaround Before this PR is merged, you can achieve the same result by updating your Ghostty config: `.config/ghostty` ```sh # So we have more scrollback history (the size of the scrollback buffer in bytes) scrollback-limit = 100000000 # The default keybindings use `write_scrollback_file` but that only includes what is # offscreen. `write_screen_file` includes what's on screen and offscreen. keybind = ctrl+shift+j=write_screen_file:paste keybind = ctrl+shift+alt+j=write_screen_file:open ```
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Good replacement for the Apple Terminal, but too barebones to justify the switch from anything else for me: - no copy mode ghostty-org/ghostty#3488 - only a single tab is visible while sharing the Ghostty window ghostty-org/ghostty#692 - no Windows support ghostty-org/ghostty#2563 - no scrollback search ghostty-org/ghostty#189 This reverts commit 71f7167.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This is the PR--which should definitely not be used--of how I'm getting around it for now. I essentially added a new option to This is doesn't fully leverage the way that ghostty or termio expect you to launch this command, but it was more me getting familiar with the codebase in general. This allows the new keybind of ctrl + shift + f to open the scrollback in whatever you use as |
Specific designs aside, the big 2 use cases I have:
It's possible that these are better as separate actions/features, but that's how I use it today. Sometimes I want to find go something, sometimes I just want to draw my attention to certain strings while I run other stuff. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Please stop suggesting workarounds. There are enough of it in this thread. I believe there are situations where theses workarounds ( The only things I — and potentially other subscribers to this issue — am interested in this issue are contributions regarding the resolution. I would suggest closing the issue to discussion. /rant over, sorry |
This comment has been minimized.
This comment has been minimized.
Sorry, but I'm locking this conversation. There's hasn't been any productive conversation on this issue for a very long time. We won't forget about this feature, it's just not on the immediate roadmap. |
To be completely clear, it’s not on the “IMMEDIATE” roadmap (as noted in the prior comment). It’s absolutely on the roadmap and I even already started some it in a branch. But as a passion project, we prioritize working on whatever we want and this isn’t currently the priority. It’s high on the list but not like.. next release (“immediate”) priority at the time of this comment. This issue was closed because the comments haven’t been productive towards completing this. I outlined some suggestions for how this can be incrementally contributed. If someone comes along and implements this I’d be happy to take a look and probably speed up merging. Otherwise, if you aren’t doing the work, please respect the other volunteers on this project and be patient. We’ll get it it when we want. If this is a blocker for you, you can and should use another terminal. There are fantastic choices out there! |
A major missing feature is the ability to search scrollback, i.e.
cmd+f
on Mac,ctrl+F
on Linux. This issue can be implemented in multiple steps, not just one giant PR:src/terminal
(Naive search internals (core only) #2885)We can also support search only in certain modes as long as the apprt glue is all there for someone to come along and finish it up. For example, only macOS, Linux+GTK, etc.
The text was updated successfully, but these errors were encountered: