eteran / nedit-ng

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

reload pop-up issue #111

Open marilmanen opened 5 years ago

marilmanen commented 5 years ago

This is a strange issue.

I have a macro which modifies current file (running Perl script in xterm window) and as last command executes revert_to_saved(). After the macro is done (and has really executed the update_to_saved() subroutine) I get a "File modified externally" confirmation dialog and I don't think this should happen. The window content is already updated, so there's no point getting the external modification confirmation dialog.

Things get strange when I open Preferences/Default Settings/Customize Menus/Macro Menu (just open it) and run exactly the same macro from the same Macro drop-down list as I did previously. Now I don't get the false pop-up confirmation window anymore. How can the opened "Macro Commands" window have any impact on the external file modification check?

I have tried to create an example macro, but I have failed on that. The issue seems to have a partly random behavior or at least I have not been able to create a simple macro that would always reproduce the issue.

marilmanen commented 5 years ago

Some more debugging at it looks like the root cause might be that the external file change check is not disabled during macro execution, but it is disabled when the "Macro Commands" window is opened. I think that disabling external file change check during macro execution could solve my issue.

eteran commented 5 years ago

Interesting, OK, I'll look into it.

Thanks!

eteran commented 5 years ago

So I have gotten the spurious "file has changed" dialog a couple of times in personal usage, even with no macros involved... I will be looking into this issue. I imagine that this is a subtle issue.

marilmanen commented 4 years ago

I found a simple way to get false externally modified file notification.

Macro/Learn Keystrokes
a
Ctrl+S
<newline>
Macro/Finish Learn

If I keep running this macro several times by keeping Ctrl+K pressed, the pop-up message of "file modified externally" will eventually come. I tried couple of times and fastest message came after 32 repeats and slowest after 694 repeats. With old NEdit I'm not able to get the message even after 3000 repeats and I also don't remember ever seeing a false externally modified file notification in the old NEdit. Hopefully this helps to find the root cause of these false messages

marilmanen commented 4 years ago

I found a simpler way to reproduce the false externally modified file notification. Macro with accelerator Ctrl+Shift+T

save()
replace_all(" *$", "x", "regex")

With an existing empty start file, the macro will work two times, but third execution gives the "Save as" "bar has been modified by another program. ...." pop-up window. Depending on the delay on pressing the "continue" button I get or don't get a second pop-up window "File modified externally". After the third macro execution it's very difficult to get the false pop.up windows anymore (I have seen it only once), unless I remove all text from the file and start from empty file, then the false pop-up windows will come on the third macro execution again.

eteran commented 4 years ago

Awesome, thanks. I'll see if I can figure out what's triggering it and get a fix in there :-)