nushell: 0.90.1 regression: alt+d throws an error message

Describe the bug

When alt+d is pressed in the middle of a command line, it shows the error: cat: write error: Broken pipe. I have not redefined the key, so the default value is used:

╭──────────┬──────────────────────╮
│ mode     │ emacs                │
│ modifier │ KeyModifiers(ALT)    │
│ code     │ Char('d')            │
│ event    │ Edit([CutWordRight]) │
╰──────────┴──────────────────────╯

How to reproduce

  1. Type two characters, e.g. ‘ab’
  2. Move the cursor back one character using ctrl+b or Left
  3. Press alt+d

Expected behavior

Expected: b is erased, no error message Actual: b is erased with error message

Screenshots

image

Configuration

key value
version 0.90.1
branch makepkg
commit_hash c2992d5d8b8541b64e9fc1440ed2917fc9b757f7
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.75.0 (82e1608df 2023-12-21) (Arch Linux rust 1:1.75.0-2)
cargo_version cargo 1.75.0
build_time 2024-02-09 11:43:38 +00:00
build_rust_channel release
allocator mimalloc
features dataframe, default, extra, sqlite, trash, which, zip
installed_plugins

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Comments: 17 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Found the reason: I had wl-paste --watch cliphist store autostarted on login. I reinstalled the system but didn’t install the cliphist binary, so it was this command throwing errors. After installing cliphist it’s all fine.

But this reveals a much larger problem: every edit/cut in Nushell is now copied to the system clipboard. This is bad for a number of reasons:

  1. Convenience. Actions to put data into a clipboard (especially the system clipboard) must be explicit. If I edit a command line in a shell, I don’t want the pieces of the command to appear in my clipboard (and especially overwrite the previous value). If I’m using the clipboard history, I don’t want the real data to be buried under numerous random words/chars cut from a shell.
  2. Security: I could be dealing with some sensitive data on the command line, like passwords. For example, I copy a command containing a password from my notes into the command line, then I edit, removing the password, then press Enter. I think I’m safe because my password is not stored in the shell history, but I am not: the password is now in the system clipboard which is even worse.

I’m sure the “shift+navigation” feature can be useful, but changing the clipboard behavior this way is a disaster. If this feature can not be implemented without interacting with the system clipboard, then at least it should be configurable by a user and default to false, so a user will have to explicitly say “Yes, I realize the consequences and agree to copy anything cut in the shell to the system clipboard”.

Ugh, why are clipboard crates such a pain. lol.

No, if it was from history, then it would appear immediately after typing a. As I described, it happens specifically on alt+d. Also, this LANG= nu is to show how it looks in the english locale. My system locale is russian and the error message is also in russian which proves that it’s an external error indeed.

I wonder if it’s already been fixed?

I’ll try to build the latest master