Skip to content

Keyboard paging computation error while paging up #935

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

Closed
ghost opened this issue Jun 26, 2020 · 6 comments
Closed

Keyboard paging computation error while paging up #935

ghost opened this issue Jun 26, 2020 · 6 comments
Labels

Comments

@ghost
Copy link

ghost commented Jun 26, 2020

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.)

@ghost ghost changed the title Keyboard paging unresponsive after paging to document end Keyboard paging computation error while paging up Jun 26, 2020
@Jugen
Copy link
Collaborator

Jugen commented 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 .....

@Jugen
Copy link
Collaborator

Jugen commented Jun 30, 2020

So this problem seems to be in Flowless, which doesn't have a maintainer at the moment. I've applied and will investigate further, hopefully next week .....

@ghost
Copy link
Author

ghost commented Aug 4, 2020

Any movement on this @Jugen ?

@Jugen
Copy link
Collaborator

Jugen commented Aug 5, 2020

Sorry, I did have a look but haven't gotten round to trying to fix it. To be honest it seems complicated/obscure and I've got other priorities at the moment so it's going to be a while I think .....

@ghost
Copy link
Author

ghost commented Aug 5, 2020

Flowless issue.

FXMisc/Flowless#73

@ghost ghost closed this as completed Aug 5, 2020
@Jugen
Copy link
Collaborator

Jugen commented Aug 5, 2020

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

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

No branches or pull requests

1 participant