stevencohn / OneMore

A OneNote add-in with simple, yet powerful and useful features
Mozilla Public License 2.0
2.63k stars 223 forks source link

Search without Replace #1084

Open rd836 opened 1 year ago

rd836 commented 1 year ago

This is similar to my #561, and likely others. (E.g., #972.)

Some of us want to simply search, and not replace, or do anything else.

The Microsoft products, like Excel and Word, along with other programs like Notepad++, have the Replace function on a separate tab than Find, which helps to avoid unintentional replacements.

Can something similar be done with OneMore? If they both have to be in one dialog box, can there at least be a checkbox to turn on or off the replacement function?

Some of us might be confused by trying to figure out if an empty Replace field means "do nothing" or replace with nothing, which is actually deleting.

hollowheights commented 1 week ago

Did this get implemented? I was wondering exactly the same thing today

stevencohn commented 1 week ago

No it has not yet

cspotcode commented 2 days ago

...might be confused...

I almost got caught by this, but thankfully was wise enough to try it on a test page first.

I have used OneMore's "Search and Move or Copy" as an alternative UI to search for pages matching a query. Could regexp be added to that dialog? Maybe not, since it appears to use OneNote's Windows Search. But it already has a nice UI for listing matched pages and letting you click each to navigate.

My dream wishlist, I would love to be able to:

stevencohn commented 2 days ago

That's been my dream as well. Would require replacing Windows Search with some other engine... Lucene, CoreSearch, .Lifti, ... ?

cspotcode commented 2 days ago

I had a crazy thought: what if someone hooked the OneNote process to intercept all its COM calls to Windows Search API and replace with their own implementation. But that's so far beyond my abilities, probably requires Detours(?) and is such a huge jump in complexity. Would have to be its own project.

stevencohn commented 2 days ago

I didn't state that correctly. I didn't mean replace the Windows Search engine. I meant that OneMore would have its own search engine and would ignore Windows Search. The built-in Ctrl-F and Ctrl-E would still hook into Windows Search; and Windows Search would still index OneNote content (unless you remove OneMore from the Windows Search Control Panel)

And yes, I'm afraid your idea might be crazy. :-) It could very likely break Windows while OneNote is running!

cspotcode commented 2 days ago

Oh, sorry, you were clear, I understood what you meant.

My (crazy) reason for hooking OneNote process was to reuse the existing search UI, keep its tight UI integration. But thinking about it again, that's not desirable: OneNote's built-in search UI is fundamentally limited.

You raised a good point about Ctrl-F and Ctrl-E: Ctrl-E uses Windows Search, but Ctrl+F does not. I say this because Ctrl+E search will sometimes return zero results yet will yellow-highlight matches in the current page. So they seem like two separate mechanisms.

So if Ctrl+F is already doing its own thing, then we can't get the yellow highlights on a regexp search.


It could very likely break Windows

Yeah maybe. I had imagined hooking the OneNote process so it doesn't actually call Windows Search, passes the request to different API. But not hook Windows Search itself. But I'm out of my depth w/hooking.


Anyway... full replacement search would be cool. I'll keep tinkering on https://github.com/stevencohn/OneMore/issues/1659#issuecomment-2466459979, share if I build anything useful.