suzdraws / mintty

Automatically exported from code.google.com/p/mintty
0 stars 0 forks source link

Searching the scrollback #85

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Another Terminal.app feature that seems rather useful: the ability to
search the scrollback. Ctrl+/ is used to initiate that there.

Original issue reported on code.google.com by andy.koppe on 4 Apr 2009 at 7:52

GoogleCodeExporter commented 9 years ago

Original comment by andy.koppe on 7 Jun 2009 at 7:51

GoogleCodeExporter commented 9 years ago
This would indeed be also very benefitial...

Original comment by rol...@onevision.com on 28 Oct 2009 at 11:54

GoogleCodeExporter commented 9 years ago

Original comment by andy.koppe on 28 Oct 2009 at 8:14

GoogleCodeExporter commented 9 years ago
I'm afraid I'm unlikely to find the tuits for this anytime soon. Sorry. Patches 
thoughtfully considered.

Running GNU screen inside mintty can does scrollback search, although of course 
that's not quite the same as having it directly in the terminal.

Original comment by andy.koppe on 28 Aug 2010 at 8:42

GoogleCodeExporter commented 9 years ago
I'd love to see this implemented similar to that found in Terminator: Search 
and highlight with clickable indicators somewhere in the window (Terminator 
puts them with the scroll bar)

Original comment by nuskooler on 15 Aug 2011 at 5:06

GoogleCodeExporter commented 9 years ago
I attempted it here, https://github.com/akngo/mintty/compare/scrollback_search. 
Sadly, there are still a lot of issues left, but it feels like a good stopping 
point to get your input/feedback. I have to also preface that this is my first 
attempt at Win32 programming. I am quite a noob at C, would love to get 
feedback.

Implemented:
- Alt + F (others are taken) to open a search box
- Highlights search results using ATTR_REVERSE
- Detect queries that straddle a linewrap
- Alt + F or Escape to hide the search control when it is focused

Issues/Not implemented:
- I used chars instead of wchars for the search because I can't get multibyte 
string search to work.
- Queries are limited to 80 characters
- Will not work if queries are longer than width of terminal
- Default hotkeys do not work when the edit control is active
- Not sure what will happen if text gets scrolled out of the scrollback or 
terminal gets reset
- Will not highlight new text that appears after a search has been done
- Text with different color will have different search highlight
- I probably forgot to free memory somewhere :)

Original comment by anhk...@gmail.com on 2 Jun 2012 at 9:38

GoogleCodeExporter commented 9 years ago
I fixed a couple bugs and added some additional improvements, the same link 
above will give a diff to the current trunk (r1275). For convenience, I am 
attaching an svn diff here, but this may become outdated.

Implemented
- Search control box sticks to the bottom right of the terminal when resized.
- Queries resulting in no matches will turn red.
- Automatically scroll to the last matching result.
- Search results now are highlighted with its own bg/fg colors (from config).

Needs fix/improvement
- No way to scroll up/down to next/previous result (buttons and/or (shift) 
enter).
- Better font for the search box.
- Sometimes keys are not registered after hiding control box.

Original comment by anhk...@gmail.com on 8 Jun 2012 at 7:46

Attachments:

GoogleCodeExporter commented 9 years ago
I'm at a good stopping point, it does not make sense for me to continue and add 
features that are not within your vision for this feature. It works fine for my 
daily use, for the most part. Below is a combined list from the previous two 
posts plus the latest changes:

Implemented
- Alt + F (others are taken) to open a search box
- Highlights search results using ATTR_REVERSE
- Detect queries that straddle a linewrap
- Alt + F or Escape to hide the search control when it is focused
- Search control box sticks to the bottom right of the terminal when resized
- Queries resulting in no matches will turn red
- Automatically scroll to the last matching result
- Search results now are highlighted with its own bg/fg colors (from config)
- Enter/Shift + Enter in search box goes to previous/next result
- Current result (from pushing enter) have a different bg color to indicate 
"cursor"
- Prevent beeps on search/hide of search box
- When going to previous/next search result, it will now only scroll if the 
result is off of the screen
- On focus, previous search text is highlighted

Needs fix/improvement
- I used chars instead of wchars for the search because I can't get multibyte 
string search to work
- Queries are limited to 80 characters
- Will not work if queries are longer than width of terminal
- Default hotkeys do not work when the edit control is active
- Not sure what will happen if text gets scrolled out of the scrollback or 
terminal gets reset
- Will not highlight new text that appears after a search has been done
- Better font for the search box
- Sometimes keys are not registered after hiding control box

Original comment by anhk...@gmail.com on 12 Jun 2012 at 6:25

Attachments:

GoogleCodeExporter commented 9 years ago
Just a quick note to say that I've had a very brief look and it looks rather 
promising. Great job working out mintty's internals sufficiently to implement 
this.

Unfortunately my spare time is very limited at the moment, so it might be a 
little while until I get round to review it properly.

Just one comment: I don't think we can use Alt+F for this, because that's 
commonly used in terminal programs, e.g. for moving the cursor forward by a 
word in bash and emacs. How about Alt+F3, since F3 is a common shortcut for 
search? Additionally, Ctrl+Shift+F when the Ctrl+Shift+letter shortcuts are 
enabled; we'd just need to move the Fullscreen function elsewhere.

Original comment by andy.koppe on 12 Jun 2012 at 7:48

GoogleCodeExporter commented 9 years ago
Thank you :).

I had no idea that Alt+F is taken, I am obviously clueless. I have changed the 
github fork to use Alt+F3. Since it's a small change, I will not upload another 
patch file. I can also add support for Ctrl + Shift + F later, but that's up to 
you.

Original comment by anhk...@gmail.com on 13 Jun 2012 at 7:40

GoogleCodeExporter commented 9 years ago
Since you're so motivated to work on this stuff (which is great), maybe you
could solve this one too :)

Issue 84: Selecting text with the
keyboard<http://code.google.com/p/mintty/issues/detail?id=84>

Original comment by thiago...@gmail.com on 15 Jun 2012 at 12:33

GoogleCodeExporter commented 9 years ago
I have a few other things on my plate right now, but will take a look at that 
when I am finished with them.

Original comment by anhk...@gmail.com on 17 Jun 2012 at 5:34