mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 14:34:52 +02:00
clipboard kitten: Dont set clipboard when getting clipboard
The previous behavior meant getting the clipboard would first empty it if STDIN was null or empty which can easily happen when run non-interactively. Fixes #6302
This commit is contained in:
@@ -99,7 +99,9 @@ func run_plain_text_loop(opts *Options) (err error) {
|
||||
stdin_is_tty := tty.IsTerminal(os.Stdin.Fd())
|
||||
var data_src io.Reader
|
||||
var tempfile *os.File
|
||||
if !stdin_is_tty {
|
||||
if !stdin_is_tty && !opts.GetClipboard {
|
||||
// we dont read STDIN when getting clipboard as it makes it hard to use the kitten in contexts where
|
||||
// the user does not control STDIN such as being execed from other programs.
|
||||
data_src, tempfile, err = preread_stdin()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -50,7 +50,7 @@ Read or write to the system clipboard.
|
||||
|
||||
This kitten operates most simply in :italic:`filter mode`.
|
||||
To set the clipboard text, pipe in the new text on :file:`STDIN`. Use the
|
||||
:option:`--get-clipboard` option to output the current clipboard text content to
|
||||
:option:`--get-clipboard` option to instead output the current clipboard text content to
|
||||
:file:`STDOUT`. Note that copying from the clipboard will cause a permission
|
||||
popup, see :opt:`clipboard_control` for details.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user