eteran / nedit-ng

a Qt5 port of the NEdit using modern C++14
GNU General Public License v2.0
96 stars 26 forks source link

new macro entry cannot be discarded #294

Closed tksoh closed 3 years ago

tksoh commented 3 years ago

Running commit 959597a9c1bf2ad07aae3ec34667b0f6b2f82dca, on Windows 10.

The macro editor somehow refuses to discard the new macro entryI accidentally added:

  1. click 'New' to add New Item
  2. click on other entry on the macro list
  3. NG prompts a dialog to discard or keep. Click on discard.
  4. NG prompts another dialog asking to enter macro commands

2021-01-25 14_46_35-Macro Commands

2021-01-25 14_47_06-Macro Commands

tksoh commented 3 years ago

BTW, the only way to get out from the dialog loop is to enter some commands or delete the new item.

Also, after deleting the new entry (still blank), if I add another new entry (still leave it blank), I could click on other entry without any of the discard entry and enter macro command dialogs.

grege2 commented 3 years ago

Hi, this is kind of the same on my Mac build. (Which is from the default download of 18 Jan). If you start a "new" macro with New, and then click on some other macro in the list, I get a slightly erroneous dialog sequence. But I seem to be able to get out of it ok with just Delete of the unwanted macro. Once by some combo I even got two empty New macros, I think. But some sensible Quit and Delete actions seem to clean it all up. There doesn't seem to be a fatal hazard that gets the macro system corrupted. I don't know .. it "feels" like there are a lot of pathways out of "New Macro" and they're not all totally tied down, but nothing leads to a fatal situation. It's a very complicated Dialog, our friend "Macro Dialog", maybe it's ok if some weird user choices lead to an unexpected step or two ??

tksoh commented 3 years ago

Once by some combo I even got two empty New macros, I think.

I believe I saw this too, but I didn't try to recreate it, yet.

eteran commented 3 years ago

Interesting, I'll take a look.

Frankly, I'd like to for 6.1 change how "new" entries are handled.

Basically, I don't like that new items are by default, invalid.

So I am considering when you click new, that maybe a dialog would pop up asking you to fill in all fields, and the new item is only created if you fill out that dialog sensibly.

Otherwise, no new item is created.

eteran commented 3 years ago

Yea, this is definitely a bug. Good find!

Adding this to the 6.0 milestone.

eteran commented 3 years ago

Same issue with all 3 dialogs of similar type (Macros, Shell, Window Background Menu)

tksoh commented 3 years ago

I am slightly confused. I imagine if we click on Discard, NG could just delete the 'New Item' entry from the list, as if we click Delete. No?

eteran commented 3 years ago

Indeed, it should ... but it does not ;-)

And surprisingly, the code to handle this corner case of discard meaning "delete" is a little more nuenced than one might expect.

The code currently takes discard to mean "ignore any changes to the entry"... but we want the entry to cease to exist. I have a few ideas about how to handle it elegantly, we'll see how it goes.

eteran commented 3 years ago

OK, I have a plan for how to fix this in a way that will work very well, I'm a bit busy work-wise, so I may not be able to tackle it until the weekend. Stay tuned ;-)

eteran commented 3 years ago

@tksoh @grege2 After FOREVER, I finally have a fix in for this one. Sorry that it took so long. I was originally planning an elaborate state machine that would push and pop states of the dialog so we could have a universal undo/redo for it... but that just ended up being so much overkill.

In the end, just a tiny bit of extra logic did the trick!

Please re-open if the issue or a variation of it still persists.

tksoh commented 3 years ago

That's great. Would try it soon.

grege2 commented 3 years ago

@eteran Thanks Evan, I will check it as soon as I rebuild my Nedit. Cheers.