frontends (primitivus): new command :search <pattern>

This commit is contained in:
souliane 2014-10-04 10:26:10 +02:00
commit e34a9a77e4

View file

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from sat.core.i18n import _
from sat.core.i18n import _, D_
from sat_frontends.primitivus.constants import Const as C
from sat.core import log_config
log_config.satConfigure(C.LOG_BACKEND_STANDARD, C)
@ -145,6 +145,15 @@ class EditBar(sat_widgets.ModalEdit):
win.clearHistory()
if limit > 0:
win.historyPrint(size=limit, profile=self.app.profile)
elif command == 'search':
pattern = " ".join(args)
if not pattern:
self.app.notif_bar.addMessage(D_("Please specify the globbing pattern to search for"))
win = self.app.chat_wins[JID(self.app.contact_list.selected).bare]
win.clearHistory()
win.printInfo(D_("Results for searching the globbing pattern: %s") % pattern, timestamp=0)
win.historyPrint(size=C.HISTORY_LIMIT_NONE, search=pattern, profile=self.app.profile)
win.printInfo(D_("Type ':history <lines>' to reset the chat history"))
else:
return
self.set_edit_text('')