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

Cursor location changes with Normal/Small font selection #223

Open
videosmith opened this issue Oct 15, 2023 · 2 comments
Open

Cursor location changes with Normal/Small font selection #223

videosmith opened this issue Oct 15, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@videosmith
Copy link

Bug Description
When changing from Normal to Small fonts or back, the current cursor location changes.

Steps to Reproduce

  1. Load your Welcome script
  2. Place the cursor next to a word
  3. Switch to Small fonts, cursor moves to new location

Expected behavior
Cursor location should remain next to the same text.

Screenshots (optional)
Screenshot from 2023-10-15 13-04-22
Screenshot from 2023-10-15 13-09-06
Screenshot from 2023-10-15 13-10-10

Device information

  • QPrompt Version: 1.2 r6
  • Operating System: Debian Bookworm (x86), Ubuntu Bullseye (ARM)
@Cuperino
Copy link
Owner

Positions are adjusted based on where the reading region is pointing to, prior to considering the actual position of the cursor.

If only the cursor position were used, and you went through a long script making changes, and then back to the start to start prompting, the moment the Normal font size was restored, the viewport's position would jump all the way back to near the bottom of the script to where the text cursor remained placed, and the user would have to scroll a long distance to where they were a moment ago.

The solution I came up with is that when sizes are toggled, the cursor position is set to the beginning of the line the reading region points to. Nevertheless, this repositioning intentionally doesn't happen when going from small to normal when the position of the text cursor is within the line the reading region is pointing to, which allows us to return to our previous line in the case of the button for toggling between font sizes being toggled multiple times one after the other.

In other words, this was a small compromise and a design choice made to prevent QPrompt from becoming frustrating to users. Having said that, there might be room for improvement here. It might be possible to compare against the area visible inside the viewport and not just the position of the reading region, then only use the reading region if the cursor is outside of the visible area...

I'll leave this open for now, to do experiments later.

@Cuperino Cuperino self-assigned this Oct 15, 2023
@Cuperino Cuperino added the enhancement New feature or request label Oct 15, 2023
@Cuperino Cuperino added this to QPrompt Oct 15, 2023
@github-project-automation github-project-automation bot moved this to Uncategorized Issues in QPrompt Oct 15, 2023
@Cuperino Cuperino moved this from Uncategorized Issues to Editor in QPrompt Oct 15, 2023
@Cuperino Cuperino added this to the 1.x milestone Oct 15, 2023
@Cuperino
Copy link
Owner

Cuperino commented Mar 3, 2024

Details copied from #245:

Bug Description
When cycling between normal and small font sizes, unless beginning of paragraph coincides with the middle of the prompt window, cursor position moves.
Also appears to occur when paragraph spacing is >000%

Steps to Reproduce

  1. Load attached long test file
  2. Pick a paragraph, center the beginning in the middle of a full-screen QPrompt window, and place the cursor at the beginning.
  3. Cycle between the normal and AA font sizes, cursor should remain where it was placed.
  4. In the normal size, slightly scroll the script so the selected paragraph is either lower or higher than the center.
  5. Repeat the cycling. Cursor should reposition at another place in the script.
  6. Place cursor at the beginning of a paragraph, adjust paragraph spacing, cursor moves.

Expected behavior
Cursor should always position where is was placed regardless of script position

screen

test.html.zip

Device information

  • Operating System: Debian Bookworm, latest updates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Editor
Development

No branches or pull requests

2 participants