question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Keyboard paging computation error while paging up

See original GitHub issue

Replicate

  1. Run the following JavaFX application, which uses RichTextFX:
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.control.ScrollPane;
    import javafx.stage.Stage;
    import org.fxmisc.flowless.VirtualizedScrollPane;
    import org.fxmisc.richtext.StyleClassedTextArea;
    
    public class Pagination extends Application {
      public static void main( final String[] args ) {
        launch( args );
      }
    
      @Override
      public void start( final Stage stage ) {
        final var editor = new StyleClassedTextArea( false );
        final var scrollbars = new VirtualizedScrollPane<>( editor );
    
        scrollbars.setVbarPolicy( ScrollPane.ScrollBarPolicy.ALWAYS );
        editor.setWrapText( true );
    
        stage.setScene( new Scene(scrollbars) );
        stage.show();
      }
    }
    
  2. Copy multiple text paragraphs (e.g., https://www.lipsum.com/feed/html).
  3. Paste the text 5 times (to ensure the scrollbar extends).
  4. Do not resize the window (you can, but it’ll mean more steps; if you did, start over): small-window
  5. Press Ctrl+Home to navigate to the top of the document.
  6. Press Ctrl+End to navigate to the bottom of the document.
  7. Press and hold Page Up to navigate upwards.

Expected Results

The view port navigates back one page for as long as the key is held, or the top is reached.

Actual Results

The computation for the new caret position goes awry in a variety of ways, depending on how much text is pasted and the view port size, resulting in one of the following behaviours:

  • Nothing happens.
  • View port scrolls up several times, but eventually stops, as though running into an asymptote.
  • View port scrolls up a few times, then scrolls to the same page within an infinite loop.

Bonus “Bug”

Possibly considered a feature request, most word processors allow the page up key to move the cursor to the top of the document. If there is insufficient room for a complete page before reaching the top of the document (i.e., paragraph 1, care position 1), RichTextFX prevents further paging up. This is atypical behaviour, but not really a bug because it is likely performing to specification. The specification is inconsistent with most other editors. (Compare with the page up/page down behaviour of the text area for writing issues on GitHub, for example.)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Jugencommented, Aug 5, 2020

@DaveJarvis thanks for reporting. I submitted a PR in Flowless that hopefully resolves this.

1reaction
Jugencommented, Jun 26, 2020

I’ve had look and was able to replicate the problem, but I haven’t determined what causes it. Will have a look next week and see if I can find out why …

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Fix the “Windows Created a Temporary Paging File ...
Once you're ready, follow our steps to get rid of the “Windows created a temporary paging file” error on Windows 7 and Windows...
Read more >
Adjust Page File Windows 10 (How to Set the Right Size)
How to adjust the paging file size in Windows 10. 1. Open Advanced System Settings; 2. Open Performance Settings; 3. Change the virtual...
Read more >
HP PCs - Troubleshooting Wired Keyboard Problems
If a keyboard with cable connection does not respond or work as expected, check the connection, install updates, and confirm settings to resolve...
Read more >
Prevent page screen scrolling up when keyboard is opened ...
I need the page to shift to a certain Y. And I need to be able to close the keyboard when I click...
Read more >
Keyboard shortcuts in Word - Microsoft Support
Move the cursor to the bottom of the screen. Ctrl+Alt+Page down. Move the cursor by scrolling the document view up by one screen....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found