Hacker News new | ask | show | jobs
by eviks 5 days ago
> Undo should always mean: restore the state of the world (/of the system) to where it was before.

So if you copy and undo you want clipboard restored instead of undoing the previous app action??? Or should it maybe undo the mouse movement? Or text cursor movement? "State of the world" was the cursor in a different place after all

Such "absolutist" approach won't help you design a good system as that "always" depends on many different specifics

2 comments

Well, in fact a good principle is to limit side effects as much as possible. Copy or cut inside the same document should probably not involve the system clipboard at all. The system clipboard could be triggered/populated when the app goes out of focus for example.
Maybe internal registers are the primary way, though that prevents some niche cases like clipboard watchers (copied #hex color to clipboard, have an option to insert any other format).
Why stop there, move back the clock as well. And send requests to all the remote hosts to send our packets back.
One reason to stop there is because your examples are absurd, while mine aren't. The are already apps where you have undo stacks for selection and text cursor positioning, so coupling that with the "state of the world" is an option. But unfortunately absurdity doesn't offer any guidance just like shallow absolutes. Think harder