terminator need to highlight search string

Bug #271487 reported by Sam Williams on 2008-09-17
This bug affects 61 people
Affects Status Importance Assigned to Milestone
terminator (Ubuntu)

Bug Description

Binary package hint: terminator

Terminator is a wonderful tool that is getting really close to being perfect for my needs. I would like to suggest that in addition to allowing people to search through their scroll buffer, which is a wonderful feature, could you please highlight the search string. I realize that each string that is located is moved to the first line of the display text, but it would be very useful, particularly on long lines of code or log output.

Distributor ID: Ubuntu
Description: Ubuntu intrepid (development branch)
Release: 8.10
Codename: intrepid

Package: terminator
Status: install ok installed
Priority: optional
Section: misc
Installed-Size: 936
Maintainer: Terminator Developers <email address hidden>
Architecture: all
Version: 0.10.1
Depends: gconf2, libgtk2.0-bin, python, python-central (>= 0.6.7), python-gconf, python-vte
Recommends: python-xdg, xdg-utils
Description: Multiple GNOME terminals in one window
 Terminator is a little project to produce an efficient way of
 filling a large area of screen space with terminals.

Related branches

Chris Jones (cmsj) wrote :

Assigning to Tom for a comment on the feasibility of this.

Changed in terminator:
assignee: nobody → tom.hurst
importance: Undecided → Wishlist
status: New → Confirmed
Chris Jones (cmsj) on 2008-09-25
Changed in terminator:
importance: Undecided → Wishlist
status: New → Confirmed
chantra (chantra) wrote :

I was looking at this, and I think the solution would be to use http://ruby-gnome2.sourceforge.jp/hiki.cgi?Vte%3A%3ATerminalAccessible

and http://www.pygtk.org/docs/pygtk/class-atktext.html

With http://www.pygtk.org/docs/pygtk/class-atktext.html#method-atktext--get-bounded-ranges we should be able to get the chunks of tet for this specific terminal, send we can highlight (setting the selection).

Jordan Callicoat (monkeesage) wrote :

It seems that the vte.Terminal.ref_accessible method is the way to get the atk object with python. However, it returns a atk.NoOpObject which means that there are method collisions (atk.Selection.add_selection shadows atk.Text.add_selection, for example). And, in my limited tests, all of the methods are broken (get_text always returns None, get_character_at_offset always returns \0, get_bounded_ranges dies with the cryptic "error return without exception set"). So I'm not sure if the accessibility interface is incomplete in VTE, or the python bindings are botched, or I'm using it incorrectly--but something is screwy with it (the ruby bindings didn't work either--they threw Vte-CRITICALs when I tried to call any method on the atk object returned from ref_accessible--same thing when I manually instantiated a Vte::TerminalAccessible).

Chris Jones (cmsj) on 2013-01-30
Changed in terminator (Ubuntu):
assignee: Thomas Hurst (tom.hurst) → nobody
Pavel Sokolov (hacker-cb) wrote :

It is very difficult to use terminator without higlighting search string.
What about this bug?
Can anybody fix it?

Rafał Gałka (gizmo-rafal) wrote :

+1 on this

Nikhil Kale (nskale) wrote :

Would really love to have this feature

Matt Hughes (hughesm02) wrote :

I'm unable to use the find feature without this.

vierja (javiermateria) wrote :

This is an essential feature. Really need to add this.

polcar (polcar) wrote :

Really need this!

Jonathan (joroy2) wrote :

+1. This is an essential feature.

Ahmed Kamal (a-abdelfatah) wrote :

really it is needed !

Mohamed Nasmin (nasminmora) wrote :

+1 it is needed.

Highlighting is done by vte, it can't highlight more than 1 match at a time. I _think_ search is also handled by vte and at most 1 match per logical line is returned.

Adding this feature would require extending vte's capabilities. I'm open to that, let's hope vte's main developer is also willing to accept this. Plus we need someone to implement it, I can't promise I'll have time.

Hijacking the accessibility framework doesn't sound right to me at all.

@Egmont: The bug is asking for highlighting of a string, not necessarily all of them at once, because right now the search has no highlight, making it hard for the eye to find the text.

I did some digging through how the search works in GNOME Terminator, and realised that for some reason the implementation in Terminator does it's own searching through the buffer rather than simply using the vte gregex/next/previous stuff. It's quite a chunk of code and I'd like to/will fix it, but it's not a five minute job. Once we start using that built-in function, then we will get highlighting, and it will simplify that whole section of Python code.

Of course it would be nice to highlight all matches at once like "less". Having said that, can I make a sly request (ulterior motives ;-) that rather than just extending vte to highlight the search matches, a generic API way to adjust formatting of any part of the scrollback buffer text temporarily is created as part of it? ClusTerm (v.old Perl program that also used vte) used to have a highlight differences feature. It worked by copying the text out, and then overwriting text with new attributes, which is really ugly and buggy.

@all the +1, me too, etc comments : Please don't do that. At the very top there is a link for indicating that this affects you. If you can't contribute useful information, or code, there is no need to post a comment.

I had no clue Terminator had its own implementation for search; makes sense now.

As for the highlight API: Do you mean something that from Terminator you want to specify things like "row 8 columns 10-12 should be italic; columns 13-20 should change to yellow background..."? I guess this should always be a temporary override for the attributes; once revoked via the API, the cells would get back to their previous attributes. Are we on the same page so far?

It's an interesting question that we should probably think about.

There are some questions to figure out. Would it allow attr changes for the currently visible part only, and in that case would the app (e.g. Terminator) continuously recompute and let Vte know what to highlight, each time you drag the scrollbar? Or would it allow to specify attributes for the entire scrollback region? In the latter case, would you allow to define only a couple of them (so that all of them easily fit in memory) or as much as you wish (in which case they'd need to be stored on disk along with the scrollback - sounds pretty hopeless)? What would happen to the attributes when the onscreen contents change? If you make it an API, you need to provide reasonable answers for these questions (that is, a detailed specification to go for).

Something that sounds reasonable to me at this moment is to work on the visible bits only and somehow Vte should notify the app each time the contents in a line change so that the app can update what to paint. Or maybe the other way around: the app could register a hook which Vte calls back: "hey I'm about to paint this line, do you want to override some of the attributes?"

This sounds like a more generic approach to the current regex/dingu feature, whereas it wouldn't be the app telling Vte the rules via a quite limited API, but rather the app looking at the entire screen (or at least an entire logical line) and deciding on its own (using arbitrarily complex logic) what to do and only telling the final result to Vte.

An example where this could be useful is to implement grouping digits by 3 onscreen either via colors, or via ticks after every 3rd digit, as brainstormed in these sibling tickets:

Maybe the mouse position could also be reported to the app, and the whole regex matching removed from vte and let the app implement it. Or implement whatever it wants. It would the app - seeing the contents of the entire logical line, plus knowing if the mouse is over one of its cells, knowing which modifier keys are pressed etc. - deciding which cells to underline, which to color differently, whether to change the mouse pointer shape; using either the same regex stuff that we have in vte right now, or any arbitrarily more complex logic as it wishes.

@Egmont: Wow, that's a lot of food for thought, very interesting ideas, and almost certainly the subtleties of the best methods within libvte would be beyond my limited understanding.

Yes, your second paragraph nailed it with respect to my naive view of what I'd like. However this is getting way beyond what this bug is actually about, so let's move this discussion elsewhere, to somewhere more appropriate. What do you think? A new bug here, a blueprint here, a bug against libvte in it's bugzilla? I think this might be the rare occasion where a blueprint is actually useful :-D

vte bug would be the best place. Feel free to submit the request with your own wording, or I'll do it in a couple of days. Note, however, that probably no work will happen on this for quite a few years - it might be a nice idea, but given our limited resources, I doubt any of us would jump right on it.

I'll make a piece of code to futz it like ClusTerm did that is so horrible it will guilt trip you into doing it sooner just to eradicate such atrocities ;-)

I was digging around this tonight, and it's a bad news, good news, situation.

Bad news: The vte search methods are not exposed in the pygtk bindings. Probably because the GLib regex class isn't exposed either, which they depend on.

Good news: Due to GTK3 using Introspection, it looks like they are both exposed there. So this cannot be fixed in trunk, but can be in GTK3 branch.

I'll assign this item to the Terminator 2.0 milestone.

Changed in terminator:
milestone: none → 2.0
Alan Tsui (alanlun516) wrote :

Just an encouragement.

Changed in terminator:
milestone: 2.0 → 2.1
Arthur (arthurz) wrote :

Hopefully we'll get this feature through!

+1 would like to see it also :D

Kevin Leo (dr0p) wrote :

Just an encouragement. +1

yosefrow (yosefrow) wrote :

Thanks for the amazing work you've done so far. As a person who depends on Terminator for his Sanity at work, this feature would improve my quality of life immensely.

This is THE feature that is missing ! +1 :)

OK, So here's a provisional patch (#26). There's some bugs to it though, and I'm a bit too tired to figure them out right now.
1) First match does not get highlighted
2) First match does not disable the previous button
3) When clicking down through the matches, then back up to the first, the scrolling jumps to the bottom.
I think these are all related to the clunky method used to detect if there's a next/previous match.

The attachment "Partial fix" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch

Fix committed in rev 1773.

I abandoned the search ahead and back that was causing me grief. The positioning in the scrollback buffer was getting very messed up. The code h cleaner now, and the behaviour matches gnome-terminal. It would be nice if there was a way of finding out if there were matched before/after the current highlight without having to perform mickey mouse searches, but this is the hand the API has dealt. Deal with it ;-)

Changed in terminator:
status: Confirmed → Fix Committed

Encouragement note! This is the only reason I had to go back-and-forth between different terminal alternatives.

Can we please do the 2.1 Bale release?

Krasi (krasi-georgiev) wrote :

+1 , this is super usefull!

Krasi (krasi-georgiev) wrote :


To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.