jcoplien / trygve

The trygve language project - Building a DCI-centric language from the ground up
GNU General Public License v2.0
103 stars 15 forks source link

ciscoheat:window-preferences creates UX "surprise" #131

Closed jcoplien closed 1 year ago

jcoplien commented 1 year ago

The changes in ciscoheat:window-preferences violate common UX conventions. The feature sets an expectation that the screen position / content on exit will be the same on a subsequent invocation as it was left when last exiting the IDE. Please change the feature so that the editor pane restores the content that was last loaded into the editor. It is that — and not the content that was last saved to disk — that is central to the locus attention.

Your decision to restore the window state is based on the writing of the current file to the file system, rather than writing file content to the window. By coincidence there are times when the window state at exit reflects that saved file state. At exit the saved state should reflect the window state as it was left when exiting,

The use case is much larger than the code has accommodated.

  1. If I start the editor and do not modify the edit window content, and then exit, a new invocation should restore the editing window to display the same file as was displayed during the first invocation.

  2. If I start the editor and do modify the edit window content, and make no changes between saving the file and exiting, an immediately subsequent invocation should restore the editing window to display the same file as was displayed during the first invocation.

  3. If I start the editor and do modify the edit window content, and then exit before saving, an immediately subsequent invocation should restore the editing window to display the same file as was displayed during the first invocation. This is a simplification. A better solution would set the “current file” to be what it was on exit and would restore the window to its content at the previous exit. We can leave that to the future.

  4. There should be special default behavior if the file being viewed at exit is not available on the immediately subsequent invocation (e.g., if the user changes folder or the file is removed in the interim).

  5. You should consider whether the file that is restored should be retrieved from a path relative to the current directory, or whether you save a full pathname and restore from that path. Right now I am not sure it will work if I save a file, exit the IDE, change working folder and restart the IDE.

  6. In addition to these, top line alignment and cursor position should be saved on exit and restored on an immediately subsequent invocation,

jcoplien commented 1 year ago

The major change is a set of improvements to save editor context across invocations to give the feel of a "modeless" editor. The WWW input pane, file system path input pane, and editing window content are preserved. The editing positional context is more or less preserved: preerving the exact cursor position is futile because the cursor is normally not visible when the editing window does not have focus, and clicking on the editing window to restore it to focus changes the cursor position...

To test the change, some testing logic and Golds had to be updated.

In addition, the version number and copyright notice have been changed in all source files to reflect the new version.

ciscoheat commented 1 year ago

Nice work, I've updated the binaries on fulloo.info. Note that when building, #128 is required for most people to be able to run trygve, since there aren't any user-friendly OpenJDK downloads for version 18.