milkey-mouse / edit

Cross-platform Rust library for invoking & waiting for the system text editor
Creative Commons Zero v1.0 Universal
43 stars 8 forks source link

Add support for notepad++ #6

Open mainrs opened 3 years ago

mainrs commented 3 years ago

I've opened an issue over at their repository, so once that gets added we could add back support for notepad++. https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9680

milkey-mouse commented 3 years ago

At that linked issue:

One can use a feature of the operating system for this, e.g. from cmd.exe, start /wait notepad++.exe

I wonder if this works with all the other editors on Windows. Perhaps the -w flags aren't necessary at all and we can just start every editor that way.

mainrs commented 3 years ago

At least on Windows it should work. Although I wonder: wouldn't that mean that a terminal window pops up? Which wouldn't be the case for GUI apps with a dedicated flag?

milkey-mouse commented 3 years ago

I don't think a terminal window necessarily pops up. IIRC there is a flag to prevent that, but I'm not aware of the details of how Rust's process::Command invokes CreateProcess.

I don't have a Windows machine readily available for testing at the moment, but if someone wants to test e.g. EDITOR="start /wait code" cargo run they can check if this would work.

nikitalita commented 3 years ago

At that linked issue:

One can use a feature of the operating system for this, e.g. from cmd.exe, start /wait notepad++.exe

I wonder if this works with all the other editors on Windows. Perhaps the -w flags aren't necessary at all and we can just start every editor that way.

This doesn't work on notepad++. I attempted start /wait it in many different configurations, it still doesn't block and immediately returns.

milkey-mouse commented 3 years ago

OK, good to know all that effort finding program-specific "wait for close" flags isn't for nought. :laughing: