primitivus: paste is now detected, and put in edit bar, so use can check and validate it

This commit is contained in:
Goffi 2016-04-21 20:20:40 +02:00
commit 6dd58f0878

View file

@ -361,6 +361,23 @@ class PrimitivusApp(QuickApp, InputHistory):
def inputFilter(self, input_, raw):
if self.__saved_overlay and input_ != a_key['OVERLAY_HIDE']:
return
if len(input_) > 1: # XXX: it may be needed to increase this value if buffer
# or other things result in several chars at once
# (e.g. using Primitivus through ssh). Need some testing
# and experience to adjust value.
log.debug(u"Paste detected")
try:
edit_bar = self.editBar
except AttributeError:
log.warning(u"Paste discarded: there is no edit bar yet")
else:
# XXX: if a paste is detected, we append it directly to the edit bar text
# so the use can check it and press [enter] if it's OK
buf_paste = u''.join((unichr(k) for k in raw))
edit_bar.set_edit_text(u'{}{}'.format(edit_bar.edit_text, buf_paste))
return
for i in input_:
if isinstance(i,tuple):
if i[0] == 'mouse press':