stevencohn / OneMore

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

Copy link to Paragraph can copy from the wrong instance of OneNote (as does XML view) #1563

Open jasonjac2 opened 1 month ago

jasonjac2 commented 1 month ago

Problem to Solve

I have 8 OneNote windows open. I use OM copy link to paragraph from a window. If there is another windows that has the same page open (which is often the case), the copy Link to Paragraph MAY copy the one from the wrong windows (not the one I am on).

The impact is the link has the wrong text and takes you to the wrong part of the page. This can be very confusing.

It does the same thing with the "XML viewer", i.e. the XML will show the selection as the one from the wrong window.

I haven't done any additional testing, but my assumption is, it is either using the first instance that has the correct page open (instead of the one with focus).

I think I noticed it a couple of versions ago, but only just realised when it happens as it take a certain set of circumstanced.

I have tried on 2 different PCs with different pages. You can show the problem with just 2 instances of OneNote.

Steps:

Environment (if applicable)

Version 6.5.1 with OneNote 16.0.17928.20114

Additional Context

THE FINE PRINT This is a hobby project that I started for myself. I'm happy to take requests and will promise to consider each one carefully but offer no guarantees that I will ultimately agree to their usefulness or have time to implement any of them. If OneNote offers a "close enough" work-around then I will probably reject the request - you've been warned!

jasonjac2 commented 1 month ago

I have added steps to the 1st post to make it clear how to reproduce.

jasonjac2 commented 1 month ago

I was just doing system documentation so had 2 virtual desktop (i.e. one W11 PC with 2 virtual desktops). I was on the 2nd desktop and was copying links to a para and then pasting into another instance. Because I was on the same page on the main virtual desktop, it kept copying the same link regardless of where I was on the page :-).

jasonjac2 commented 1 month ago

Have you managed to reproduce this / have you had time to look?

stevencohn commented 1 month ago

TBH I haven't tried. But TBH, I believe you and can envision exactly why it would happen. Solutions might include:

  1. Take advantage of a known ID on each page (the omID I've introduced in other areas) and rely on that for a unique page identifier instead of the OneNote pageId.
  2. Find a simpler way to identify the same page across instances or even machines
  3. Restrict command to single window instances; this is not the most user friendly
jasonjac2 commented 1 month ago

From your reply, I'm not sure I have described it quite right - is the issue clear? i.e. it is like when your command asks ON for the current page, it is given the wrong one. I am not sure how the system decides how to ask for a page.

I can't see 1 working as it is exactly the same page, it is just I invoked the "copy para to clipboard" from another instance. So it would have the same ID?

When a command is invoked, how does it know what page it was invoked from and how does it know which instance (which active window) it was invoked from?

stevencohn commented 1 month ago

Yes I can reproduce it

jasonjac2 commented 3 weeks ago

This has bitten me a few times in the last week..... I have been reviewing a large project and putting in links on various pages to various other pages to make it easier for a novice to consume. Having a bunch of pages open and editing, putting links all over the place. I realised that on another virtual desktop I had an instance on ON open and on the main page I was referencing. The outcome was a bunch of "random" links to the main page throughout the notes...... Just enough to convince a newbie I was off my rocker and trying to confuse them more :-).

Also, came across another expression of the project: #1585

Cheers for all the hard work.... still building up to setting the environment to build this.

jasonjac2 commented 2 weeks ago

Bitten again - Doing documentation for a project, one page with bits of development, project mgmt. Pulling together references for a meeting. All on muscle memory. Reviewed my list on links and one liners, only to find all the reference links pointed to the same para on the source page :-(.

Dev: Did refresh my fork and opened solution, got the first set of requirements, but wouldn't compile - as expected as I hadn't completed the pre-req's for compile..... but then ran out of time. As an aside where should i be looking for the "get the XML for the current page with this name", which is where I assume the issue lies.