Skip to content

Commit

Permalink
Uniformize clipboard messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
aadcg committed Jun 25, 2024
1 parent 032e53a commit 4692524
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion source/buffer.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ proceeding."
(define-command copy-url ()
"Save current URL to clipboard."
(copy-to-clipboard (render-url (url (current-buffer))))
(echo "~a copied to clipboard." (render-url (url (current-buffer)))))
(echo "~s copied to clipboard." (render-url (url (current-buffer)))))

(define-command copy-title ()
"Save current page title to clipboard."
Expand Down
2 changes: 1 addition & 1 deletion source/color.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"Copy the color as hex #XXXXXX string."
(let ((hex (cl-colors2:print-hex (first colors))))
(ffi-buffer-copy (current-buffer) hex)
(echo "Copied ~a to clipboard!" hex)))
(echo "~s copied to clipboard." hex)))
(lambda-command copy-as-rgb* (colors)
"Copy the color as CSS rgb() function string."
(let ((rgb (cl-colors2:print-css-rgb/a (first colors))))
Expand Down
2 changes: 1 addition & 1 deletion source/foreign-interface.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ Should return the copied text or NIL, if something goes wrong."

(sera:lret ((input (if text-provided-p text (copy))))
(copy-to-clipboard input)
(echo "Text copied: ~s" input)))))
(echo "~s copied to clipboard." input)))))

(define-ffi-generic ffi-buffer-paste (buffer &optional text)
"Paste the last clipboard entry into BUFFER.
Expand Down
2 changes: 1 addition & 1 deletion source/mode/prompt-buffer.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ Only available if `prompter:enable-marks-p' is non-nil."
(text (str:join +newline+ (reverse props))))
(unless (str:emptyp text)
(trivial-clipboard:text text)
(echo "Copied ~s to clipboard." text))))
(echo "~s copied to clipboard." text))))

(define-command-prompt paste (prompt-buffer)
"Paste clipboard text to input."
Expand Down
7 changes: 4 additions & 3 deletions source/renderer/gtk.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2097,9 +2097,10 @@ As a second value, return the current buffer index starting from 0."
(progn
(webkit:webkit-web-view-execute-editing-command
(gtk-object gtk-buffer) webkit2:+webkit-editing-command-copy+)
(calispel:! channel t))
(calispel:! channel t)
(echo "~s copied to clipboard." text))
(calispel:! channel nil)))
(lambda (e) (echo-warning "Cannot copy: ~a" e)))
(lambda (e) (echo-warning "~s failed to copy to clipboard." e)))
(if (calispel:? channel)
(trivial-clipboard:text)
nil))))
Expand All @@ -2113,7 +2114,7 @@ As a second value, return the current buffer index starting from 0."
(trivial-clipboard:text text))
(webkit:webkit-web-view-execute-editing-command
(gtk-object gtk-buffer) webkit2:+webkit-editing-command-paste+)))
(lambda (e) (echo-warning "Cannot paste: ~a" e))))
(lambda (e) (echo-warning "~s failed to paste to clipboard." e))))

(defmethod ffi-buffer-cut ((gtk-buffer gtk-buffer))
(let ((channel (nyxt::make-channel 1)))
Expand Down

0 comments on commit 4692524

Please sign in to comment.