Mercurial > libervia-backend
comparison frontends/src/primitivus/primitivus @ 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 | 2c1a1b56dd22 |
children | da6d1988dfcb 2f97e58b6fa1 |
comparison
equal
deleted
inserted
replaced
1968:eca59bc4e6c6 | 1974:b34fdb44b7d4 |
---|---|
417 try: | 417 try: |
418 edit_bar = self.editBar | 418 edit_bar = self.editBar |
419 except AttributeError: | 419 except AttributeError: |
420 log.warning(u"Paste discarded: there is no edit bar yet") | 420 log.warning(u"Paste discarded: there is no edit bar yet") |
421 else: | 421 else: |
422 # XXX: if a paste is detected, we append it directly to the edit bar text | 422 if self.main_widget.focus == edit_bar: |
423 # so the use can check it and press [enter] if it's OK | 423 # XXX: if a paste is detected, we append it directly to the edit bar text |
424 buf_paste = u''.join(self.keysToText(input_)) | 424 # so the user can check it and press [enter] if it's OK |
425 pos = edit_bar.edit_pos | 425 buf_paste = u''.join(self.keysToText(input_)) |
426 edit_bar.set_edit_text(u'{}{}{}'.format(edit_bar.edit_text[:pos], buf_paste, edit_bar.edit_text[pos:])) | 426 pos = edit_bar.edit_pos |
427 edit_bar.edit_pos+=len(buf_paste) | 427 edit_bar.set_edit_text(u'{}{}{}'.format(edit_bar.edit_text[:pos], buf_paste, edit_bar.edit_text[pos:])) |
428 edit_bar.edit_pos+=len(buf_paste) | |
429 else: | |
430 # we are not on the edit_bar, | |
431 # so we treat pasted text as normal text | |
432 if extra is None: | |
433 extra = [] | |
434 extra.extend(input_) | |
428 if not extra: | 435 if not extra: |
429 return | 436 return |
430 input_ = extra | 437 input_ = extra |
431 ## end of paste detection/handling | 438 ## end of paste detection/handling |
432 | 439 |