From 6dd58f0878a84fc051173dbb6843aeade52df123 Mon Sep 17 00:00:00 2001 From: Goffi Date: Thu, 21 Apr 2016 20:20:40 +0200 Subject: [PATCH] primitivus: paste is now detected, and put in edit bar, so use can check and validate it --- frontends/src/primitivus/primitivus | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/frontends/src/primitivus/primitivus b/frontends/src/primitivus/primitivus index 73801070..48a194bb 100755 --- a/frontends/src/primitivus/primitivus +++ b/frontends/src/primitivus/primitivus @@ -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':