Hacker News new | ask | show | jobs
by CobrastanJorji 1331 days ago
The "closing the app after copying and before pasting" case is very interesting. Shows how even things that sound simple turn out to have very tricky edge cases as soon as you start optimizing and really thinking about how to implement them.

The clipboard manager solution seems okay, but copying everything immediately seems like it defeats a lot of the elegance of the design. Perhaps it'd be preferable if the original program held the clipboard until it was about to exit, at which point it would issue a "last call" sort of announcement so that a clipboard manager could optionally "take over" the clipboard. But that wouldn't capture crashes or any app that doesn't send such a signal, so perhaps the aggressive copying is more thorough. But if that's desirable, maybe always copying data to the window manager is the better choice. Presumably Windows is doing this?

1 comments

On Windows, when you Copy the program supplying the data decides whether to send the data to the clipboard manager straight away, or whether to defer. If it defers, then yes it does a "last call" on closing. If it crashes you lose the clipboard.

Some programs will ask you when you quit them if you want to keep the clipboard contents, if you'd copied a large amount of data.

Annoyingy, in Excel's case that question "Do you really want to quit? You have copied large amounts of data to the clipboard." even occurs when you have a single cell's worth in the clipboard. But that's also a confirmation question that no one really understands unless they understand how the clipboard works (or can work).
I just tested this on the latest desktop version of Excel on Windows 10, and I did not get the 'large amounts of data' warning with only a single cell copied in the clipboard (the cell contained the word 'foo'). Increasing the number of cells copied to a large number did cause the warning to appear. I did not investigate further to see exactly how many cells need to be copied to cause the warning to appear.
> in Excel's case that question "Do you really want to quit? You have copied large amounts of data to the clipboard." even occurs when you have a single cell's worth in the clipboard

That's not correct. You need to have quite a few cells in the clipboard for this to happen.

> But that's also a confirmation question that no one really understands

The dialog tells you exactly what it is asking for. It gives you three options: keep the app open, store the data in the clipboard, discard the data from the clipboard. I am not sure how a user could not understand what to do in that situation.

Most users know about copy paste, but have no idea what "the clipboard" is.
Doesn't Microsoft Office still have a button in the bottom-right of the Cut, Copy, Paste section of the Ribbon (subtitled "clipboard") that opens a big Clipboard side panel?
Oh, indeed. I misremembered then. Seems to be that way in my ancient version already as well.