@Stefan-Ozminski said in Hazardous blank operations operate on whole file when no selected text, need to evolve safer approach:
think the most unusual thing needed to make this last approach work would be to leave the menu open when “Require selected text for operation” or “Allow operation without selected text” is clicked
Hmm, that is a good point and I’d need think about if it’s possible without a lot of code within Notepad++. One of the things Windows offers to all applications is the availability to define menus. The part where the user can pull down a menu, select sub-menus, etc. is handled by Windows. When a menu option is selected Windows closes the menu, parent menu, etc. and then tells the application that someone has selected a menu item and which one it was. Menus and sub-menus are handled as separate “windows” that are layered on top of the application.
It’s possible for applications to to define what they call window message handlers. Custom window message handlers for the menu “windows” are not very common meaning there will be few good examples to use, particularly for something unusual such as keeping a holding a menu open while flags get enabled/disabled.