comparison frontends/src/primitivus/primitivus @ 1975:da6d1988dfcb

merged main branch
author Goffi <goffi@goffi.org>
date Mon, 27 Jun 2016 22:49:36 +0200
parents 02d21a589be2 b34fdb44b7d4
children e6b51b7ff31f
comparison
equal deleted inserted replaced
1973:a9908e751c42 1975:da6d1988dfcb
401 try: 401 try:
402 edit_bar = self.editBar 402 edit_bar = self.editBar
403 except AttributeError: 403 except AttributeError:
404 log.warning(u"Paste discarded: there is no edit bar yet") 404 log.warning(u"Paste discarded: there is no edit bar yet")
405 else: 405 else:
406 # XXX: if a paste is detected, we append it directly to the edit bar text 406 if self.main_widget.focus == edit_bar:
407 # so the use can check it and press [enter] if it's OK 407 # XXX: if a paste is detected, we append it directly to the edit bar text
408 buf_paste = u''.join(self.keysToText(input_)) 408 # so the user can check it and press [enter] if it's OK
409 pos = edit_bar.edit_pos 409 buf_paste = u''.join(self.keysToText(input_))
410 edit_bar.set_edit_text(u'{}{}{}'.format(edit_bar.edit_text[:pos], buf_paste, edit_bar.edit_text[pos:])) 410 pos = edit_bar.edit_pos
411 edit_bar.edit_pos+=len(buf_paste) 411 edit_bar.set_edit_text(u'{}{}{}'.format(edit_bar.edit_text[:pos], buf_paste, edit_bar.edit_text[pos:]))
412 edit_bar.edit_pos+=len(buf_paste)
413 else:
414 # we are not on the edit_bar,
415 # so we treat pasted text as normal text
416 if extra is None:
417 extra = []
418 extra.extend(input_)
412 if not extra: 419 if not extra:
413 return 420 return
414 input_ = extra 421 input_ = extra
415 ## end of paste detection/handling 422 ## end of paste detection/handling
416 423