Skip to content

replaceText on CodeArea makes scrollbar jump to line 2 #913

@veN1337

Description

@veN1337

Summary

When using the replaceText(String) method on a CodeArea the scrollbar jumps to line 2.
This happens when the replacement string is shorter or longer than the current text.

Expected Behavior

Scrollbar keeps in place when replacing the current text by a text with a different length.
This worked until richtextfx verions 0.9.2 (see video "scrollbar_doesnt_jump" in scrollbarjump_demo_and_videos.zip)

Actual Behavior

Scrollbar jumps to line 2 when replacing the current text by a text with a different length (see video "scrollbar_does_jump" in scrollbarjump_demo_and_videos.zip).

Reproducible Demo

See scrollbarjump_demo_and_videos.zip.

Press "Replace with long lorem ipsum" button.
Scroll to line 6 (doesnt matter which line but should be > 2)
Press "Replace with short lorem ipsum" button.

Environment info:

  • RichTextFX Version: 0.10.4
  • Operating System: Windows 10
  • Java version: 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions