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

Editor cursor position is offset to the right when display scaling >100% (on Windows) #226

Closed
processing-bot opened this issue Jul 12, 2021 · 51 comments
Labels

Comments

@processing-bot
Copy link
Collaborator

Created by: soprano

Description

Display of cursor position in Editor in Windows 10 for the 4.0 alpha versions 5 and 6 is offset to the right when using OS display scaling (>100%)

Change the display of the cursor to the correct position in the Editor

Expected Behavior

When you see the cursor and you delete to the left or to the right, it is supposed to do it as in the position of the displayed cursor.

It should work like in version 3.5.4

Current Behavior

Steps to Reproduce

Your Environment

  • Processing version: 4.0.5 and 4.0.6 in Windows 10
  • Operating System and OS version: Windows 10
  • Other information:

Possible Causes / Solutions

@processing-bot
Copy link
Collaborator Author

Created by: benfry

With 4.0 alpha 6, can you try setting the font in Preferences and see if that works? In alpha 5 there was a problem where the font was changing to something that wasn't monospaced, which would make it look strange like this.

@processing-bot
Copy link
Collaborator Author

Created by: soprano

I changed it to Monospace and I realized something. I started typing 1234567890 and so on and the cursor gets farther and farther away as you type more numbers.

You start seeing the problem when you go to 123456789. Placing the cursor before 9 shows inside 9, a bit left from the middle.
I think the bug is in the calculation of the position of the cursor with respect to the width of the characters, probably a wrong calculation of the width of the characters when positioning the cursor.

So I tried the default and Monospace and the same problem. What I wrote above was with Preferences set to Monospace.

@processing-bot
Copy link
Collaborator Author

Created by: benfry

Can you provide more details? Are you on a US English version of Windows or another language? Do you have a HiDPI screen? Have you set the interface scaling in the Preferences window?

@processing-bot
Copy link
Collaborator Author

Created by: soprano

US English. It is not display dependent. On the same computer if I use the release version 3.5.4, it works perfectly.
You should be able to reproduce it. Check the code for the calculation of width of font.
On Mac I am using the alpha 4.0.3 and it doesn't happen.

@processing-bot
Copy link
Collaborator Author

Created by: soprano

I tried interface scaling off and on and it does not change anything. Bug is still there. Did you try to reproduce the bug? Do you have a Windows 10/11 computer?

@processing-bot
Copy link
Collaborator Author

Created by: soprano

image

@processing-bot
Copy link
Collaborator Author

Created by: soprano

See after adding all those numbers, the cursor is far to the right.

@processing-bot
Copy link
Collaborator Author

Created by: soprano

I tried all the fonts in Preferences, not a single one behaves well, all work equally wrong.
Am I the only one seeing this bug?

@processing-bot
Copy link
Collaborator Author

Created by: sampottinger

Hey there! I attempted to reproduce this on a Windows 10 computer and was unsuccessful. Do you mind providing the specific build number? https://www.howtogeek.com/236195/how-to-find-out-which-build-and-version-of-windows-10-you-have/. If you are comfortable, getting your display settings would also be helpful.

Attempted to reproduce with Windows 10 17763.1817
processing_cursor

@processing-bot
Copy link
Collaborator Author

Created by: soprano

Hello. I discovered the differences between what you tried and what I tried. I got it in 2 computers, one with Windows 10 and one with Windows 11, but it does not happen if the Display Settings of the Operating System are scaled as default (100%).

I have both computers scaled at 250%. But both computers with scale at 250% work perfectly on version 3.5.4.

@processing-bot
Copy link
Collaborator Author

Created by: soprano

I also tried by scaling in the Windows setting to only 125% and the bug appears.
Basically, version 3.5.4 compensates correctly for that scaling and 4.0.a6 seems to ignore the scaling factor.
I will try to see if I can compensate that with the scaling in the Preferences of Processing.

I tried that and compensating for scaling in Preferences does not change anything. There is no workaround for this bug unless only having to have a very small size of display in a big monitor by only using the no scaling of 100%. Any scaling on Windows larger than 100% will show the bug that doesn't show on version 3.5.4.

@processing-bot
Copy link
Collaborator Author

Created by: soprano

Using the same monitor, this problem doesn't show up on my Mac Mini. Mac Mini alpha versions work fine if you scale the display in the OS.

@processing-bot
Copy link
Collaborator Author

Created by: soprano

I am using a 40 inch 4K monitor.

@processing-bot
Copy link
Collaborator Author

Created by: soprano

I see in the left image you have the Display of the O.S. at 100%. I am pretty sure you will see the bug if you change it to any other value (e.g. 125%). My preferred value is 250%.

@processing-bot
Copy link
Collaborator Author

Created by: soprano

@benfry. It's different from the bug in MacOS. This one happens even if you don't change any font size.
The bug I am reporting here does not happen in the Mac alpha versions.

@processing-bot
Copy link
Collaborator Author

Created by: benfry

In alpha 5, I removed the sun.java2d.uiScale.enabled setting so that most scaling would work properly (i.e. the startup screen doesn't show in micro size on a HiDPI screen), but unfortunately, it looks like this has issues with custom components (like the editor component we're using) and especially with fractional sizes.

To see if it's the fractional size issue or just a custom component issue, what happens if your scaling is at 200% or even 300%?

@processing-bot
Copy link
Collaborator Author

Created by: soprano

In alpha 5, I removed the sun.java2d.uiScale.enabled setting so that most scaling would work properly (i.e. the startup screen doesn't show in micro size on a HiDPI screen), but unfortunately, it looks like this has issues with custom components (like the editor component we're using) and especially with fractional sizes.

To see if it's the fractional size issue or just a custom component issue, what happens if your scaling is at 200% or even 300%?

I tried any scaling different than the default (100%) in Windows and that is the only configuration that works fine. As I said above my preferred configuration is 250%. I am also using another Windows 11 computer with same monitor and same problem, and a Mac Mini M1 with same monitor and also alpha version 3 and 6 and on Mac it works perfectly. On Windows it only works fine if I switch to Processing 3.5.4.

@processing-bot
Copy link
Collaborator Author

Created by: benfry

Added the UI scaling flag back for alpha 7, but it leaves the underlying problem still broken. That's now being tracked here: #231

@processing-bot
Copy link
Collaborator Author

Created by: soprano

Thank you for fixing it.

@processing-bot
Copy link
Collaborator Author

Created by: soprano

Not fixed in 4.0 b1 version (Beta).

@processing-bot
Copy link
Collaborator Author

Created by: sampottinger

Reopening given #245.

@processing-bot
Copy link
Collaborator Author

Created by: sampottinger

Just checking… Do you need any help from my end on this @benfry ?

@processing-bot
Copy link
Collaborator Author

Created by: RishYang

I had encountered the same issue in 4.0 b1 version (Beta) on Windows with 125% display scaling. However, I changed the setting of the High DPI scaling override to "System (Enhanced)" and the issue is kinda solved.

@processing-bot
Copy link
Collaborator Author

Created by: benfry

Just checking… Do you need any help from my end on this @benfry ?

@sampottinger Happy for any help! It just needs a lot of time and testing across various platforms, screen types, and UI zoom settings. I just haven't had time to do it myself.

@processing-bot
Copy link
Collaborator Author

Created by: PeterQuinn925

I see this problem in 4.0b2. I don't know if the fix was applied to that version of not.
display:
scale 125%
Resolution 1920 x 1080

@processing-bot
Copy link
Collaborator Author

Created by: HasseDAC

I faced the same problem in 4.0b2 and windows 10 home.
Display scale 100% could solve it.
However, the characters get too small to read.

@processing-bot
Copy link
Collaborator Author

Created by: Iqwertz

I also have this problem on 4.02b, The high scaling dpi override fixed it, but the application is a bit blurry now!

@processing-bot
Copy link
Collaborator Author

Created by: MattStillerman

I had this same problem with 4.0b2 Windows 10 Pro at 150% display. I changed my font to Consolas and font sizes to 14. I left the interface scale to "automatic" (unchanged). I left "use smooth text" turned on. The problem seems to have been resolved by these changes.

@processing-bot
Copy link
Collaborator Author

Created by: duskvirkus

Had the same issue when I opened up processing on a school computer (might not be up to date). Here's more documentation I took before finding this issue.

Screen Recording:
https://user-images.githubusercontent.com/43045568/145496973-11494b0d-3564-41bf-ada1-6b0de3ad681a.mp4

Screenshots:
processing-bug-1
processing-bug-2
processing-bug-3

@processing-bot
Copy link
Collaborator Author

Created by: TomasJuocepis

Last time I used processing was years ago, version 2.0 I believe. Today I decided to do some doodling with processing again. Went online, downloaded the latest vesion (4.0b2), and immediately ran into this issue which makes it unusable. Issue is exactly as described - cursor offset to the right,. Offset increases with additional characters on the line. Using a high dpi (17" 4k monitor) windows 10 laptop. Windows 10 Pro 10.0.19044.

@processing-bot
Copy link
Collaborator Author

Created by: jruberto

I too experience this bug, running 150% scaling on my 4k display.
Windows 10 Pro 10.0.19041
processing-4.0b2

Using @MattStillerman suggested settings makes the app useable until this gets fixed. Thank you, Matt!

@processing-bot
Copy link
Collaborator Author

Created by: danksearle

I saw the bug too, thanks to the info in this thread saying that it is due to the Windows display scaling I found that by reducing my resolution low enough so I can turn off Windows scaling (which means a resolution of 1920 x 1200 for me), the bug disappears.

Edition Windows 10 Pro
Version 20H2
Installed on ‎12/‎21/‎2021
OS build 19042.1415
Experience Windows Feature Experience Pack 120.2212.3920.0

processing-4.0b2

The resolution that I was originally trying to use, where I saw the bug, was 3840 x 2400 with a scaling of 250%.

@processing-bot
Copy link
Collaborator Author

Created by: colinwilcox

Encountered this issue w/ 4.0b2

processing-4.0b2
Edition Windows 10 Pro
Version 20H2
Display scale: 125%
Display resolution: 2560x1080

I had encountered the same issue in 4.0 b1 version (Beta) on Windows with 125% display scaling. However, I changed the setting of the High DPI scaling override to "System (Enhanced)" and the issue is kinda solved.

This worked for me. Thanks! 👍
It actually looks better when I override the display scale this way. I noticed that the font for many of the UI elements in the main window was a bit jaggy, e.g. the tab / menu text. Now it looks properly rendered.

@processing-bot
Copy link
Collaborator Author

Created by: OldSurferDude

I couldn't find - the setting of the High DPI scaling override to "System (Enhanced)" -
Looks like I'm stuck with a tiny font or a funky cursor

@processing-bot
Copy link
Collaborator Author

Created by: OldSurferDude

I was premature. I don't have a choice, all I get is "funky cursor"

@processing-bot
Copy link
Collaborator Author

Created by: zakatakk

I have also encountered this on 150% scaling in 4.0b2 with a 1280 x 720 resolution.

@processing-bot
Copy link
Collaborator Author

Created by: mariana-s-fernandes

I have the same problem, using an Acer Aspire V3-372 , Windows 10 Home with 150% scaling and 1920x1080 resolution, Processing 4.0.b1

@processing-bot
Copy link
Collaborator Author

Created by: benfry

Adding a “Disable HiDPI Scaling” option in Preferences for 4.0 beta 3. It's a temporary solution, but resolves the immediate issue for now.

Further development for a better long-term solution will be covered here: #342

@processing-bot
Copy link
Collaborator Author

Created by: GilesCartmel

Thanks Ben that helps for the time being. Small interface font, but at least I can set the editor font a little larger to compensate... and the cursor no longer drifts to the right.

@processing-bot
Copy link
Collaborator Author

Created by: benfry

@GilesCartmel what sort of device are you using? (What hardware, what OS version, what sort of display hardware, what pixel resolution, what zoom level set in Windows?)

@processing-bot
Copy link
Collaborator Author

Created by: GilesCartmel

@benfry
Processor Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz 2.40 GHz
Installed RAM 32.0 GB (31.7 GB usable)
System type 64-bit operating system, x64-based processor
Edition Windows 10 Home
Version 21H1
OS build 19043.1466
Experience Windows Feature Experience Pack 120.2212.3920.0
15" Dell XPS laptop with 4K (3840x2160) screen, zoom level set to 175%
NVIDIA GeForce GTX 1650

@processing-bot
Copy link
Collaborator Author

Created by: benfry

@GilesCartmel If you turn off the Preference in Processing but put your Windows zoom level to 200% instead of 175% is the cursor still weird?

@processing-bot
Copy link
Collaborator Author

Created by: GilesCartmel

@benfry Disable HiDPI unchecked, Interface Scale automatic, Windows "Make Everything Bigger" set to 200%.... works ok. Set Windows back to 175%.... problem re-appears.

@processing-bot
Copy link
Collaborator Author

Created by: benfry

@GilesCartmel Thanks, that's helpful and gives me something to go on… I thought we were down to just low-res displays misbehaving in beta 3 until the pref was checked, but this is actually easier to track down.

@processing-bot
Copy link
Collaborator Author

Created by: benfry

Should be better in beta 4, but finally, hopefully, fixed for 4.0 beta 5.

@processing-bot
Copy link
Collaborator Author

Created by: GilesCartmel

4.0 beta 4.... now the cursor's going the other way... not keeping up with the text.

@processing-bot
Copy link
Collaborator Author

Created by: benfry

Yep, fixed in beta 5.

@processing-bot
Copy link
Collaborator Author

Created by: GilesCartmel

Looking forward to it Ben. Thanks.

@processing-bot
Copy link
Collaborator Author

Created by: GilesCartmel

Just got around to downloading and checking beta 5 and can confirm that works ok for me now. Good work Ben, thanks.

@processing-bot
Copy link
Collaborator Author

Created by: benfry

Great! Thanks for letting me know.

@processing-bot
Copy link
Collaborator Author

Created by: github-actions[bot]

This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant