fix searching and make it use regexps. Roberto Aguilar
This commit is contained in:
commit
00a887dd91
|
@ -1,6 +1,8 @@
|
||||||
terminator 0.96:
|
terminator 0.96:
|
||||||
* Unity support for opening new windows (Lucian Adrian Grijincu)
|
* Unity support for opening new windows (Lucian Adrian Grijincu)
|
||||||
* Fix searching with infinite scrollback (Julien Thewys #755077)
|
* Fix searching with infinite scrollback (Julien Thewys #755077)
|
||||||
|
* Fix searching on Ubuntu 10.10 and 11.04, and implement searching
|
||||||
|
by regular expression (Roberto Aguilar #709018)
|
||||||
|
|
||||||
terminator 0.95:
|
terminator 0.95:
|
||||||
* Add a configuration option to enable a DBus server
|
* Add a configuration option to enable a DBus server
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
import gobject
|
import gobject
|
||||||
|
import re
|
||||||
|
|
||||||
from translation import _
|
from translation import _
|
||||||
from config import Config
|
from config import Config
|
||||||
|
@ -26,6 +27,7 @@ class Searchbar(gtk.HBox):
|
||||||
config = None
|
config = None
|
||||||
|
|
||||||
searchstring = None
|
searchstring = None
|
||||||
|
searchre = None
|
||||||
searchrow = None
|
searchrow = None
|
||||||
|
|
||||||
searchits = None
|
searchits = None
|
||||||
|
@ -117,6 +119,7 @@ class Searchbar(gtk.HBox):
|
||||||
if searchtext != self.searchstring:
|
if searchtext != self.searchstring:
|
||||||
self.searchrow = self.get_vte_buffer_range()[0]
|
self.searchrow = self.get_vte_buffer_range()[0]
|
||||||
self.searchstring = searchtext
|
self.searchstring = searchtext
|
||||||
|
self.searchre = re.compile(searchtext)
|
||||||
|
|
||||||
self.reslabel.set_text(_("Searching scrollback"))
|
self.reslabel.set_text(_("Searching scrollback"))
|
||||||
self.next.set_sensitive(True)
|
self.next.set_sensitive(True)
|
||||||
|
@ -132,11 +135,11 @@ class Searchbar(gtk.HBox):
|
||||||
self.reslabel.set_text(_('No more results'))
|
self.reslabel.set_text(_('No more results'))
|
||||||
return
|
return
|
||||||
buffer = self.vte.get_text_range(self.searchrow, 0,
|
buffer = self.vte.get_text_range(self.searchrow, 0,
|
||||||
self.searchrow, -1,
|
self.searchrow+1, 0,
|
||||||
self.search_character)
|
self.search_character)
|
||||||
|
|
||||||
index = buffer.find(self.searchstring)
|
matches = self.searchre.search(buffer)
|
||||||
if index != -1:
|
if matches:
|
||||||
self.search_hit(self.searchrow)
|
self.search_hit(self.searchrow)
|
||||||
self.searchrow += 1
|
self.searchrow += 1
|
||||||
return
|
return
|
||||||
|
@ -153,11 +156,11 @@ class Searchbar(gtk.HBox):
|
||||||
self.reslabel.set_text(_('No more results'))
|
self.reslabel.set_text(_('No more results'))
|
||||||
return
|
return
|
||||||
buffer = self.vte.get_text_range(self.searchrow, 0,
|
buffer = self.vte.get_text_range(self.searchrow, 0,
|
||||||
self.searchrow, -1,
|
self.searchrow+1, 0,
|
||||||
self.search_character)
|
self.search_character)
|
||||||
|
|
||||||
index = buffer.find(self.searchstring)
|
matches = self.searchre.search(buffer)
|
||||||
if index != -1:
|
if matches:
|
||||||
self.search_hit(self.searchrow)
|
self.search_hit(self.searchrow)
|
||||||
self.searchrow -= 1
|
self.searchrow -= 1
|
||||||
return
|
return
|
||||||
|
@ -187,6 +190,7 @@ class Searchbar(gtk.HBox):
|
||||||
"""Trap and re-emit the end-search signal"""
|
"""Trap and re-emit the end-search signal"""
|
||||||
self.searchrow = 0
|
self.searchrow = 0
|
||||||
self.searchstring = None
|
self.searchstring = None
|
||||||
|
self.searchre = None
|
||||||
self.reslabel.set_text('')
|
self.reslabel.set_text('')
|
||||||
self.emit('end-search')
|
self.emit('end-search')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue