Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible Minor bug in Ctrl + Del #5

Open
GitHubRulesOK opened this issue Feb 13, 2020 · 13 comments
Open

Possible Minor bug in Ctrl + Del #5

GitHubRulesOK opened this issue Feb 13, 2020 · 13 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@GitHubRulesOK
Copy link

Whilst testing CTRL + DEL in continuous page mode and page 1 is partly visible say just a few %
It works correctly on page 2 however page counter is set to Page 1 and is difficult to reset to current page 2 without using page up and down

The consequence is I can add more / replace highlights to still visible page 2 but correction by re-deletion wipes hard-earned highlights on page 1

@nod5 nod5 added bug Something isn't working documentation Improvements or additions to documentation labels Feb 13, 2020
@nod5
Copy link
Owner

nod5 commented Feb 13, 2020

Known issue. I will document it better, at least.

I'd like to also fix it. But so far I've come up with no solution that wouldn't involve more edits to SumatraPDF C++ source.

Background: When a highlight is created with Awe can reliably parse both its page number and rectangle corner coordinates from the SMX file. But for Ctrl + Del and D and E (and related mouse shortcuts) HighlightJump (non-experimental mode) reads the page number from the go to control in SumatraPDF toolbar. Then the issue you describe can happen in continous page mode.

A difficulty here is that when exactly during scroll the page number changes in the go to control depends on the zoom level. With zoom 6400% scrolling down shifts page number when about half the window height is covered by pixels from the next page, I think. But if we instead zoom out a lot and scroll down then the page number changes as soon as any part of the topmost visible page is scrolled out of view.

For D and E my goal is to make HighlightJump always act on the page/position under the mouse.

For Ctrl+Del it is less clear what the goal should be in some continous page mode cases. For example if we zoom out a lot, what would it make sense for Ctrl+Del to do? Erase highlights on

  • only the page reported by the go to control
  • the page under the mouse
  • all pages fully in view
  • all pages fully or partially in view

@nod5
Copy link
Owner

nod5 commented Feb 14, 2020

Readme now documents this as a known issue.

@GitHubRulesOK
Copy link
Author

GitHubRulesOK commented Feb 15, 2020

There is a dirty fix for this issue, but not sure how well it could be implemented, since you need to send c before the user actions and then c again after.

The idea is that using the c toggle you can force user to page mode but it will disturb their page position so you would need to hold and reapply current position to scroll to, and that is probably easier said than done ?

Perhaps just simpler to tell users highlighting and its erasure work best in page mode only

@nod5
Copy link
Owner

nod5 commented Feb 15, 2020

Perhaps just simpler to tell users highlighting and its erasure work best in page mode only

Yes, unfortunately.

At least until there are SumatraPDF source edits to better expose page data.
For example if the "m" notification was changed to something like "Cursor position: 51,0 x 273,5 pt x 45" where "45" is pagenumber. Or a Windows Message method to return the pagenumber under the mouse out the external applications.

@GitHubRulesOK
Copy link
Author

Just a new twist on this one
When using book mode with page 10 on left and 11 on right then attempting to erase highlights on 11 will clearly just remove them from 10 :-)
Checking the .smx it shows them added to 11 so could switch to single page and remove them that way.

@nod5
Copy link
Owner

nod5 commented Feb 18, 2020

I have experimental methods to reliably get exact pagenumber under mouse working. But that requires SumatraPDF C++ source edits.

@GitHubRulesOK
Copy link
Author

GitHubRulesOK commented Feb 19, 2020

@nod5
The following replacement in the settings file may give you one or two ideas
`

ExternalViewers [
	[
		CommandLine = C:\windows\system32\cmd.exe /k echo FullFileName = "%1" Page = %p
		Name = &Test command
		Filter = *.*
	]
	[
		CommandLine = C:\windows\system32\Notepad.exe "%1.Page%p.txt"
		Name = Notepad the Notes for &This page
		Filter = *.*
	]
	[
		CommandLine = C:\windows\system32\Notepad.exe "%1.smx"
		Name = Notepad the .sm&X
		Filter = *.*
	]
]

`
Open a file then look at the new file options

@nod5
Copy link
Owner

nod5 commented Feb 19, 2020

Just a new twist on this one [...] When using book mode

Yes, that is the same underlying issue. HighlightJump in non-experimental mode reads whatever page SumatraPDF shows in/next to the Toolbar's go to control.

If in "book view" and "show pages continuously" is unchecked then I think we could check the mouse position and if on the right half of the window add +1 to get the page number under the mouse. But: I see no silent way to detect if "show pages continuously" if checked or unchecked. Further complication: Book view sometimes shows only one page e.g. when at the first page, and that can be tricky to detect. I think edits to the SumatraPDF source changes is the only way to make progress on this wrong page issue.

The following replacement in the settings file may give you one or two ideas

Not sure I follow. Is that from the advanced settings file? Or from somewhere else?

@GitHubRulesOK
Copy link
Author

GitHubRulesOK commented Feb 19, 2020

Yes substitute the default empty entry in SumatraPDF-settings.txt with the example above or see an example use in https://forum.sumatrapdfreader.org/t/advanced-tips-add-your-own-notes/2688/2

The page (with the same issue about focus) and full file name are exposed to external apps unfortunatly not the current scroll position or current selection those are all needed as requested say in https://forum.sumatrapdfreader.org/t/feature-request-emit-status/149

@nod5
Copy link
Owner

nod5 commented Feb 25, 2020

Issue now fixed in experimental mode (requires SumatraPDF c++ source edits). E and D always apply to the page and position under the mouse. Ctrl+Delete and quick jump shortcuts works in the following way: If only one page is visible or if only one page is >50% visible then HighlightJump operates on that page. If more than one page is >50% visible then the user is prompted to pick a page by clicking.

@GitHubRulesOK
Copy link
Author

Nod5 good news however I tried compiling in the recent past and

  1. It takes some time to work out what's needed to compile with little confidence the binary is valid
  2. VStudio ate my slow laptop performance, constantly updating in the background, even when inactive
  3. The IDE is only valid for 30 days free usage
  4. if you have compiled a compatible 32bit portable version you could ask kjk if it could possibly be posted as an alternative irregular updated binary here ?

@nod5
Copy link
Owner

nod5 commented Feb 25, 2020

I don't know the exact method used by kjk to produce the Prerelease versions and I also know too little C++ to feel confident enough to release binaries, sorry. Some tips on how to compile though:

  • Get Visual Studio Community 2019 (free, works also after the 30 days period, if you simply sign in with a free Microsoft account once)
  • No need to have it running in the background, you can close it down after compiling
  • The two modified files should be drop-in replacements for their namesakes in SumatraPDF-master as of 2020-02-25 before compiling.

Keep in mind also that my experimental code may have (likely have) some issues. It is for the moment more of a test to illustrate and prototype, in the hopes of that leading to kjk or someone else adding properly tested and improved versions of the functions to SumatraPDF in the future.

@GitHubRulesOK
Copy link
Author

Nod5

  1. exactly I too am unsure of the binary result due to optional build directives

  2. I had shut Studio each time after compiling but VS kept downloading updated components in background practically all day every day even after reboot slowing this machine to a crawl so had to wipe hard disk and fresh start

  3. see 2 above IDE refused to play ball even when I should have been signed in

  4. see all of the above :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants