I copied my password to the clipboard! Can you delete it?
In a lucid moment, I decide that the password should better not remain in the clipboard after its use. Since this happens to me often, I could use a program to remove the clipboard contents.
If your system has several clipboards, you can write the program for any one of them. The only requirement is that it must be possible for the user to copy and paste text using that clipboard.
If your clipboard keeps a history of recent copied entries, assume the most recent entry.
If your answer is specific to an operating system or clipboard, indicate it in the title of your post, together with the used language.
The clipboard is guaranteed to contain text when your program is run. You can either delete the contents from the clipboard, or overwrite it with something else (not necessarily text). The only requirement is that after running the program, pasting from the clipboard will not produce the original text.
If you choose to overwrite with some fixed or randomly chosen text, you can assume that the previous clipboard contents are different from that text, so the password is effectively removed. In other words, disregard the possibility that the filler text coincides with the password.
The program should not have any side-effects like restarting the system, closing programs, shutting down the computer, or freezing it. After your program is run, the user should be able to keep using the computer as normal, only with the password removed from the clipboard. Also, standard loopholes are forbidden.
Shortest code in bytes wins.
Well, on my computer I can access the last ~10 I copied/selected, but I can imagine that number being different on different systems. I don't know if this matters at all, so that's why I asked.
"Disregard the possibility that the filler text coincides with the password." Solution: ` `, 0 bytes. Overwrites the password with itself.
@Challenger5 but that's only _If you choose to overwrite with some fixed or randomly chosen text_
The very worst part about this question is that I can completely relate to the intro story despite knowing that it's satirical. ...so, keepass, huh? Should look into that...
Excel, 1 keystroke
Works because Excel, uniquely, always has a selection. Probably works in other spreadsheet applications too. As opposed to the other joking entries, Excel answers are actually somewhat frequent on PPCG.
Isn't this 2 keystrokes? "A keystroke is a single press of a key on a keyboard. Each key press is a keystroke." http://www.computerhope.com/jargon/k/keystroke.htm
I'm not sure it's really valid to score by keystrokes. Also, since you say _As opposed to the other joking entries_, I interpret that as you admitting this is not an actually valid answer. So I won't accept it even if it's the shortest one. If you can point me to some relevant meta-post establishing the validity of keystrokes as scoring method, I will happily accept this submission
@LuisMendo Your in-between-lines analysis is correct, but now that I actually took the time ro research on Meta: https://codegolf.meta.stackexchange.com/a/4817/43319 would seem to indicate that it is acceptable, as opposed to "Windows" which isn't an editor.
@Adám My understanding it that that meta-post refers to a hypothetical "editor golf" _challenge category_, not to using the number of keystrokes as a scoring method for "code golf" challenges. I've pinged Doorknob and Dennis to know their opinion