@@ -21,6 +21,7 @@
from pygments import lexers
from pygments import token as Token
+import pyperclip
import urwid
import urwid_readline
@@ -390,6 +391,14 @@ def keypress(self, size: Tuple[int, int], key: str) -> Optional[str]:
self._update_highlighting()
self.change_focus(size, self.highlighting)
return None
+ if key == 'meta c':
+ if self.highlighting == -1:
+ return None
+ widget = self.history[self.highlighting].original_widget
+ text = widget.get_text()[0]
+ LOGGER.info('Text is %s', text)
+ pyperclip.copy(text)
+ return None
# Remove highlighting if someother key is pressed
if self.highlighting != -1:
This commit adds a feature that enables use to copy messages from the TUI after highlighting the message in the history box using up/down arrow keys and pressing alt-c. Signed-off-by: G S Niteesh Babu <niteesh.gs@gmail.com> --- python/qemu/aqmp/aqmp_tui.py | 9 +++++++++ 1 file changed, 9 insertions(+)