# HG changeset patch # User Goffi # Date 1467060576 -7200 # Node ID da6d1988dfcb07453c41c429dddc95ebe8244398 # Parent a9908e751c4268b9cda063eb735fc869a6a51947# Parent b34fdb44b7d4417bd78d1882215b3943dd7912a9 merged main branch diff -r a9908e751c42 -r da6d1988dfcb frontends/src/primitivus/primitivus --- a/frontends/src/primitivus/primitivus Mon Jun 27 22:37:51 2016 +0200 +++ b/frontends/src/primitivus/primitivus Mon Jun 27 22:49:36 2016 +0200 @@ -403,12 +403,19 @@ 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(self.keysToText(input_)) - pos = edit_bar.edit_pos - edit_bar.set_edit_text(u'{}{}{}'.format(edit_bar.edit_text[:pos], buf_paste, edit_bar.edit_text[pos:])) - edit_bar.edit_pos+=len(buf_paste) + if self.main_widget.focus == edit_bar: + # XXX: if a paste is detected, we append it directly to the edit bar text + # so the user can check it and press [enter] if it's OK + buf_paste = u''.join(self.keysToText(input_)) + pos = edit_bar.edit_pos + edit_bar.set_edit_text(u'{}{}{}'.format(edit_bar.edit_text[:pos], buf_paste, edit_bar.edit_text[pos:])) + edit_bar.edit_pos+=len(buf_paste) + else: + # we are not on the edit_bar, + # so we treat pasted text as normal text + if extra is None: + extra = [] + extra.extend(input_) if not extra: return input_ = extra