celynw / editmonaco

A really powerful and intuitive beets plugin to edit metadata
0 stars 0 forks source link

Always show diff #1

Closed celynw closed 2 months ago

celynw commented 3 months ago

Use the monaco editor's diff, to make it easy to see what's changed, without checking against the DB, and instead of showing the diff in the CLI as the built-in edit plugin does.

celynw commented 3 months ago

This is trickier than expected. Monaco has a built-in diff which is great, but we'll have problems if lines are dectected as moved. For example

hello
world
foo
bar
hello
world

foo

gives

 hello
 world
+
 foo
-bar

rather than the desired line-by-line diff:

 hello
 world
-foo
+
foo
celynw commented 2 months ago

I think the solution is to show a side-by-side diff for every column. I will definitely need to make horizontal navigation as easy as possible. How about a monaco minimap, but horizontally?

I suppose that I don't need to show a diff for unchanged columns (how do I easily and quickly detect this? Is it quick to change out the editor to a diff editor?).

I could do with a quick toggle too, to enable/disable the diff editors/editor for a specified column.

celynw commented 2 months ago

This has been implemented in e230093e8ca3241dd71b4dbab33f66845d4bfb7f. Each column has two editors: a normal one and a diff one. If there are changes, the diff editor is shown, otherwise the normal one. It immediately switches between them, transferring the cursor position