Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature to copy answer text to clipboard #297

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions socli/tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def make_frame(self):
footer=urwid.Pile([
QuestionURL(self.url),
UnicodeText(
u'\u2191: previous answer, \u2193: next answer, c:comments, o: open in browser, \u2190: back, '
u'\u2191: previous answer, \u2193: next answer, x: copy answer, c:comments, o: open in browser, \u2190: back, '
u'd: visit duplicated question, q: quit')
])
)
Expand All @@ -128,7 +128,7 @@ def make_frame(self):
footer=urwid.Pile([
QuestionURL(self.url),
UnicodeText(
u'\u2191: previous answer, \u2193: next answer, c:comments, o: open in browser, \u2190: back, '
u'\u2191: previous answer, \u2193: next answer, x: copy answer, c:comments, o: open in browser, \u2190: back, '
u'd: back to original question, q: quit')
])
)
Expand All @@ -145,7 +145,7 @@ def make_frame(self):
footer=urwid.Pile([
QuestionURL(self.url),
UnicodeText(
u'\u2191: previous answer, \u2193: next answer, c: comments, o: open in browser, '
u'\u2191: previous answer, \u2193: next answer, x: copy answer, c: comments, o: open in browser, '
u'\u2190: back, q: quit')
])
)
Expand Down Expand Up @@ -203,6 +203,10 @@ def keypress(self, size, key):
import webbrowser
display_header.event('browser', "Opening in your browser...")
webbrowser.open(self.url)
elif key in {'x', 'X'}:
import pyperclip
current_answer = self.answer_text.index
pyperclip.copy(self.answer_text.answers[current_answer])
elif key == 'left':
global question_post
global question_page
Expand Down
Loading