-
Notifications
You must be signed in to change notification settings - Fork 616
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. |
That's a good point. I've opened a discussion for a new feature request here: #4870 |
For folks wanting to highlight and not lose surrounding context, follow output streams, etc. - you can take a look at |
or just |
Those are one-off. Can't re-search if the input isn't saved. |
this is just a workaround for those missing search just to highlight words before sending screenshots |
Any workarounds to cmd + f for searching for words in previous stdout that you can recommend for mac user? |
I use fzf: |
This config below opens your previous output and makes it searchable in your default text editor (I use Sublime). This has been working well for me. cmd+f = Open your entire scrollback history in a text editor so you can search cmd+shift+f = Open whatever you have selected in your scrollback history in a text editor
Update: Switched to using |
Is there an ETA for this feature by any chance? |
@pioz the ETA is the time that you can fix the bug by yourself; if you don't know how, wait with patient without asking when it will be ready. :) this is an open source terminal with no remuneration. Sorry for the hard response btw. |
@andoniabedul Yes, absolutely, I completely agree with you. I only asked to check if there might be any updates, as this feature is quite important to me. Let’s say that a simple "there's no ETA currently" might have come across as a bit kinder, but it's all good nonetheless. Thanks for the information! |
I have loved using Ghostty for the last several weeks, but the lack of scrollback searching is forcing me back to iTerm2. Hope to be back soon! :) |
The good enough workaround is : #189 (comment) |
I haven’t explored this workaround in depth yet, but using |
Agreed, I think opening it with |
Do we need native pagination at all? Why should each terminal emulator implement its own pagination, scrollback, search, etc., with its own design preferences? We already have lots of pagination tools like less, more, bat, pg, most, etc., and lots of editors that have view mode like vim, emacs, neovim, etc. Personally, I would rather press a key combination and see my scrollback opened in my neovim with all my plugins, in which I have full control over the content, and the key bindings are all already in my muscle memory. That's what I was doing in Kitty for years. If one prefers another pagination tool, they can open it in that tool, and we don't need to re-implement a semi-vim or semi-emacs for this purpose. One could set it in the configuration, and it can use |
That’s your preference, and it’s fine. But there are others who prefer having a native search feature. That doesn’t prevent your workflow from still working, it’s just another option. |
…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 ```
Ghostty whole gimmick (or well, one of the main ones) is that it's supposed to feel native to the OS it's running under and I don't think that requiring use of a pager for search and scrolling gives you that. It perhaps feels native to the shell (piping between tools is very natural) but not to the OS which, if it were any other app, would give you a regular scroll and search functionalities. |
keybind: unknown error error.InvalidAction |
This only opened output into Text editor, This is a hack not actual feature we wanted |
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.
Opening the scrollback buffer hasn't worked well for me, as most of the time when I'm wanting to search for specific output, it's during a running process, such as a Rails server, or Scrapy run. It adds a more dissonance to the process. I kept getting burned in situations where it was hard or impossible to reasonably check something compared to iTerm and had to switch back for now. I hate to ask for features in an open source project; it would be cool if there was a feature bounty or something. I'd put a tip in the tip jar for this. Let me know if there's somewhere I can put some money where my mouth is; perhaps others would follow. |
good point, I would join. |
You may not realize it, but this is primarily the work of one incredible individual. Mitchell likely has enough financial security for the rest of his life and even for his children’s future (I believe). Unfortunately, this means we can’t motivate him to take action simply by offering to pay for it. At this point, it’s all about time and priorities, and unless Mitchell finds someone else willing and able to take on this work, progress may remain limited. |
Mitchell is very aware of the importance of this feature and will solve it in a perfectly appropriate way that fits in with his ghostty design language and UX. He's focusing on stability and bug fixes for v1.1 and then will focus on this possibly for the version following that. Nothing left for us to do except be patient or open a PR ;) |
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 |
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: