Edits sometimes lead to blurry code
Opened this issue · 2 comments
There seem to be different times that blurry code happens...I've noticed for it for a while, but just ignored it because I know how to work around it and un-blurry it. But some of my users have started to report it so I wanted to try to fix.
I would really appreciate some hints on how I might be able to fix.
Reproduce Steps
- Load in code where some lines stretch far to the right of what is visible
- Go to one of the long lines of code
- At the end of that line, add 2 spaces
- Delete those 2 spaces
There might be other ways to get blurry code, but this is one set of steps I can reproduce.
Workaround:
After it is blurry, clicking the line numbers or just scrolling back all the way to the left seems to fix it
--
It seems like the BACKSPACE is deleting from one layer of text, but not the other layer of text...giving it the blurry appearance.
I can do something like :
if Input.KeyCode == Enum.KeyCode.Backspace
...but I'm not sure yet what I should do when a Backspace occurs
This might be an issue with the GetTextBoxScrolling.luau
module. I believe it might be related to this issue on the devforum. It has a code snippet that might fix it. If it works it would be nice for you to create a PR on their behalf.
@SpaceDice9 Thanks for pointing me to that fix. I tried it out and while it fixed "blurriness" in some cases, it still caused that problem in other cases.
The past few days, i've been working on a different approach:
- CodeField always keeps all of the code (not just what is visible) with AutomaticSize as XY
- RichOverlayContainer is now the child of CodeField (this helps them to always stay in positional sync)
- Set OSEBackground 'ClipDescendants' to true
- When user scrolls to the right, move the code field to the left. In this way, OSEBackground is a 'window' into both CodeField and RichOverlayContainer. (same for scrolling down -- CodeField is moved up)
- Line numbers always has all of the line numbers and scrolls at the same time as CodeField
Side benefit is now CTRL+A works for selecting all text.
I extended my previous code submission for cursor keys up and down to support doing the correct thing for the right/left cursor keys.
Made sure AutoIndent is works...need to do some work to get AutoWrap to work again.
Selecting a section of text seems to not work quite right -- but it seems like that wasn't right before too.
Under some stress testing (pounding on the keyboard and wild clicking) -- i can still get some "blur" cases...but under normal testing, I don't get it anymore.
I need to do a lot of cleanup before submitting, but you can test it on :
https://www.roblox.com/games/77437102057731/Ultimate-Arduino-Builder