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

Page down key does not work if there are too many removed lines #394

Open
M393 opened this issue Jul 25, 2024 · 11 comments
Open

Page down key does not work if there are too many removed lines #394

M393 opened this issue Jul 25, 2024 · 11 comments

Comments

@M393
Copy link

M393 commented Jul 25, 2024

With the cursor in line 4040 on the right side, pressing page down does nothing.
image

Looks like the page up/down behavior in Notepad++ is implemented by moving the cursor and then scrolling the cursor into view, so this poses a problem when there is no line to place the cursor on, but maybe it's possible to use the next available line instead of not moving the cursor.

Not sure if this is a plugin problem or would need a fix in Notepad++ itself.

@pnedev
Copy link
Owner

pnedev commented Jul 25, 2024

@M393 ,

I'll look into it, thanks 👍

@pnedev
Copy link
Owner

pnedev commented Aug 26, 2024

@M393 ,
Hi again,
This issue is coming directly from Notepad++ - the plugin does not handle document navigation on its own.
I can try manually processing navigation to circumvent this shortcoming but I prefer not to do it.
I'll leave the issue open as a reminder if I decide to look at it in the future. Thanks.

@M393
Copy link
Author

M393 commented Aug 26, 2024

Thank you, @pnedev, I reported it to Notepad++, maybe it can be resolved there.

@xomx
Copy link

xomx commented Aug 27, 2024

This issue is coming directly from Notepad++ - the plugin does not handle document navigation on its own.

Hello @pnedev ,
this looks to me as the ComparePlus issue as I did a quick replacement by the old Compare v2.0.2 and it works with the PageDown as the OP expected even in my latest N++ v8.6.9. I know absolutely nothing about how your plugin works, but Scintilla probably does not see the ComparePlus enlarged view size for the smaller doc (enlarged to match the bigger doc one, I mean that inserted grey-area visible in the OP's pic above). But OTOH it is interesting that the scroll-bar behavior seems to be ok at the same time.

@pnedev
Copy link
Owner

pnedev commented Aug 27, 2024

Hi @xomx ,

The old Compare plugin (2.0.2) uses real custom-inserted empty lines to achieve the synchronization between both views.
ComparePlus uses Scintilla annotations to do that which has many advantages (the main one is not messing up the undo/redo functionality) but also has several shortcomings like slower views refresh and this issue as well.

So the problem is maybe Scintilla itself as it directly handles annotations. You could make a simple test to verify this:

  1. Create a new file in Notepad++ containing at least 2 lines.
  2. Open PythonScript plugin console.
  3. Execute there editor.annotationSetVisible(1)
  4. Execute editor.annotationSetText(0, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"). If annotation does not fill the whole screen please add more \n's in the above command.
  5. Go to the first line in the document (after which the annotation starts) and try using PageDown key. You should observe that it does nothing - the page is not scrolled. You need to use the ArrowDown key to move the view to the next line.

BR,
Pavel

@xomx
Copy link

xomx commented Aug 27, 2024

You could make a simple test to verify this:

Ok, I am able to reproduce your STR.

But there should not be any reason for a reached range difference in between the PageDown and the scroll-bar use...

So now I think this is a potential bug in the Scintilla PageDown handler (direction == +1 ... PageDown, -1 ... PageUp):
https://github.com/notepad-plus-plus/notepad-plus-plus/blob/8e26e08c1cf799c632c3cdc067804ed128f6e743/scintilla/src/Editor.cxx#L3013
the problem there seems to be somewhere inside the SPositionFromLocation.

@pnedev
Copy link
Owner

pnedev commented Aug 28, 2024

I am posting here a link to a comment of mine in the corresponding Notepad++ issue thread which describes a problem with last line views synchronization of ComparePlus : notepad-plus-plus/notepad-plus-plus#15579 (comment)

It is just a reminder for me to look at this (has nothing to do with PageDown behavior which is another issue unrelated to ComparePlus).

@pnedev
Copy link
Owner

pnedev commented Nov 5, 2024

The last line scroll issue caused by ComparePlus 1.2 views sync function is fixed and will be available in the next plugin version.
The PageDown key issue is caused by Scintilla so it is still present and currently I am not planning to do a work-around fix in the plugin.

@M393
Copy link
Author

M393 commented Nov 5, 2024

Thanks for looking into this @pnedev 👍
Is there an open issue at https://sourceforge.net/p/scintilla/bugs/ ? (is that the correct issue tracker?) I can create one if it doesn't exist yet.

@pnedev
Copy link
Owner

pnedev commented Nov 6, 2024

@M393 ,
You are welcome.
I think there is no need for creating issue in Scintilla tracker - the ticket you created in Notepad++ is the right one and will suffice. My comment meant just that the plugin is not responsible for that functionality and is not the right place for a fix - the right place this issue should be fixed is Notepad++ (or its Scintilla component but I am not sure if it is Scintilla itself).
Sorry if I mislead you.
BR

@M393
Copy link
Author

M393 commented Nov 6, 2024

Alright, understood.
Thanks a lot for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants