-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Improve text editor status bar and zooming UX #88474
Conversation
3657bf8
to
95df637
Compare
I prefer if all my scripts are at a persistent zoom level and it seems like this will make it hard to do so. Beside this, I fully agree with the approach of not changing a whole editor setting to achieve zooming. |
@MewPurPur Just to clarify, do you mean persistent (saves between sessions), or consistent (synced between all tabs)? Though in truth, making it consistent would actually make it much easier to make it persistent as well, since there is only one value to save to cache. 🤔 |
I myself am concerned about exposing this |
@Mickeon I was wondering about that actually. How does one accomplish a subscription-like behaviour in the Godot codebase without the use of signals? Unfortunately there are many places from which the indent type of |
There are some things in the API that are "exposed" but not really "exposed". These are prefixed with an underscore and do not show up on autocompletion or documentation, and by all means are discouraged to be used. I believe there's never been a case of this for signals, however, so it's probably not supported at all. So right now, I am not sure how. Again, I'm not against adding more things, but that would warrant people will actually need and use it. If you want to ask for some help and feedback remember that Godot also has a public chat specifically tailored for development of the engine: https://chat.godotengine.org |
Right off the bat, I do have a suggestion. Thinking outside of the box. A new signal would be much more beneficial if it was emitted on more than one situation, not just when specifically the tab type changes. Resources have a However, this suggestion is only somewhat related to this PR, and may require another PR and proposal to be potentially accepted. |
It'd be better to first do the less controversial changes in this PR so it's approved more easily. |
95df637
to
9d71689
Compare
@MewPurPur It's not quite so simple, since the "less controversial" fixes were only possible by decoupling from editor settings. And by doing so, all the script tabs now have to do additional work to stay in sync with each other or save their zoom. I thought it would be one interface, but no, every script in the tab actually holds onto its own text editor in memory. That said, I am working on some changes. |
@Mickeon After doing some more deep studying of the class hierarchy and their interplay, I implemented and pushed a solution which doesn't involve any changes to |
It does, marginally. Now this feature can be taken a look at without having any interference with the public API, and it can be changed later if necessary. I for one approve a lot but @MewPurPur made a good point before and it would be nice to see addressed. Never seen a "Per document" zooming level in an IDE (even if it does sound interesting). |
My approach would've been to save one value in the editor state, just a script zoom level that'd hold across all scripts. This would be consistent with the current behavior, just no lag spikes from changed editor settings. |
Script zoom should definitely be consistent across saves. Persistence is a bonus but not strictly required. Web browsers store zoom levels on a per-domain basis, but this behavior isn't really suited to code editors. |
9d71689
to
e2b9b54
Compare
Outstanding job. I hope this gets evaluated soon. The zooming was always a massive pain of the current text editor. It got to the point where @KoBeWi wanted to disable the shortcut outright for accidentally triggering it. |
It's not as smooth for me: godot.windows.editor.dev.x86_64_LDwOQWlhPu.mp4Though it's maybe because of dev build. It's still better than before of course and accidental zoom happen in small increments. But I'm still in favor of removing the shortcut >_> Overall works great, I just found a small bug. When you set 75% zoom and restart, it will be restored as 79%. |
e7e2070
to
d9b5b8e
Compare
d9b5b8e
to
f9cbcd6
Compare
f9cbcd6
to
dd81433
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally (at 100% and 175% editor scales), it works as expected.
Note that the first time you zoom in an editor session (causing a new font size to be displayed), there will be some slowdown due to the font cache having to be regenerated. This doesn't occur afterwards. Using MSDF rendering for the code font would alleviate this, at the cost of making it less crisp (so I don't recommend this approach, at least for now).
dd81433
to
190832d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine now.
Needs rebase after #69032
Note that every function that updates editor settings (either from NOTIFICATION_EDITOR_SETTINGS_CHANGED
or from settings_changed
signal) should use check_changed_settings_in_group()
now.
2116ac9
to
6f6de77
Compare
@KoBeWi Did the rebase! Should be ready to go. 🤞 |
6f6de77
to
77674f3
Compare
77674f3
to
9281c44
Compare
Thanks! |
ZoomLagFix.mp4
Old:
New:
Changes
and even between each script tab.MenuButton
that allows the user to quickly select between a few common zoom levels.VSeparator
s to separate the various stats, instead of relying on vague empty space and a printed|
character like before.Tabs
/Spaces
) has been separated from the line-and-column indicators and responds to the appropriate changes (e.g. indentation conversions and editor indentation setting changes), instead of responding to caret changes.Rationale
This represents a pretty big change to the role of the zoom feature in the user's workflow. Previously, the zoom feature was a shortcut for making a persistent change to the editor itself, even though it was not obvious to the user that this was happening. It was also easy to accidentally trigger.
In the new system, the zoom feature behaves as a quick, transient operation - similar to a scroll or a drag, while the editor code font size setting serves as the preferred neutral size (at 100% zoom). In this way, the purpose of the zoom feature is to give the user a quick way to navigate their view of a document.
They are free to leave some documents zoomed out for at-a-glance interaction, while zooming in on others where they are focused on specific areas.Notes
The zoom levels of each open document are currently not persistent, and will be reset between each session. However, they can totally be saved to the editor cache if we decide that is worthwhile (perhaps in another PR).