Skip to content

Commit

Permalink
added ctrl+z for paste
Browse files Browse the repository at this point in the history
  • Loading branch information
Nokse22 committed Sep 18, 2024
1 parent 192e9e2 commit 3634e6c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,14 @@ def on_paste_action(self, *args):
def callback(clipboard, res, data):
text = clipboard.read_text_finish(res)
text_buffer = self.text_view.get_buffer()
text_buffer.set_text(text)

start = text_buffer.get_start_iter()
end = text_buffer.get_end_iter()
text_buffer.begin_user_action()
text_buffer.delete(start, end)
text_buffer.insert(start, text)
text_buffer.end_user_action()

data = {}
clipboard.read_text_async(None, callback, data)

Expand Down

0 comments on commit 3634e6c

Please sign in to comment.