Mercurial > libervia-backend
changeset 1974:b34fdb44b7d4
primitivus: ignore paste if edit bar is not selected
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 27 Jun 2016 22:04:55 +0200 |
parents | eca59bc4e6c6 |
children | da6d1988dfcb 4c2f2234b71e |
files | frontends/src/primitivus/primitivus |
diffstat | 1 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/src/primitivus/primitivus Fri Jun 24 22:32:58 2016 +0200 +++ b/frontends/src/primitivus/primitivus Mon Jun 27 22:04:55 2016 +0200 @@ -419,12 +419,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