[pygtk] Searching and highlighting in pygtksourceview2
shanjitsingh at gmail.com
Wed Oct 6 02:58:39 WST 2010
I am new to working with pygtksourceview2.
I am trying to implement searching and highlighting in a display defined
It would be really very helpful if someone could help me out. I am done with
adding the Graphical part of it, its only the searching and highlighting
part which i am not able to grasp. Could someone please provide some
Following is the part of code written :
self._buffer = gtksourceview2.Buffer()
self.search_text = ' '
self._source_view = gtksourceview2.View(self._buffer)
#self._source_view.set_highlight_current_line(True) #FIXME: Ugly
.... *Some more irrelevant part of code....*
function is called when something is typed into the search box.*
self.search_text = text
buffer = self._buffer
start, end = buffer.get_bounds()
which should find bounds of the buffer.*(Not Sure, if applicable for the
iter = buffer.get_start_iter()
next = iter.forward_search(text, 0)
if next is None: break
start, end = next
*Highlighting Code comes here.
* iter = end
I would be thankful if someone could provide me pointers on how to implement
the searching and highlighting.
Shanjit Singh Jajmann
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pygtk