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

🐞 Noticeable delay occurs when changing Settings #1247

Open
austincondiff opened this issue Apr 27, 2023 · 1 comment
Open

🐞 Noticeable delay occurs when changing Settings #1247

austincondiff opened this issue Apr 27, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@austincondiff
Copy link
Collaborator

austincondiff commented Apr 27, 2023

Description

Changing any setting causes a slight delay before the UI is updated to reflect the change. This is problematic when interacting with a stepper control when it is common to click several times consecutively or a text field when it is common to type characters consecutively. The UI doesn't have time to respond resulting in a sluggish UI.

To Reproduce

  1. Open Settings
  2. Navigate to the Text Editing page
  3. In the Font Size field, click the up arrow to increase five times in a row
  4. Notice that the UI does not update immediately resulting in it feeling sluggish to interact with

Expected Behavior

The UI should respond to user action immediately.

Version Information

CodeEdit: 0.0.3-dev (32)

Additional Context

This might be because it is writing to settings.json in our Application Support folder. I think it waits until it has been updated (not sure, just a theory). I think we should be handling this more optimistically and not be so dependent on writing to the file.

Screenshots

Screen.Recording.2023-04-27.at.2.35.06.PM.mov

Related issues

@austincondiff austincondiff added the bug Something isn't working label Apr 27, 2023
matthijseikelenboom pushed a commit to CodeEditApp/CodeEditSourceEditor that referenced this issue Apr 29, 2023
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description

This PR fixes an issue where the view would be reloaded too often. This
happened because `updateNSViewController` is called too often. This
mostly happens because of a change in the environment, which gets passed
to the NSViewControllerRepresentable in the `context` variable.

Manual diffing is applied to check if any variables that matter have
changed. If not, nothing is updated.

The initializer has also changed, a few variables are now just values
instead of bindings. These don't have to be bindings, as the textview
won't update variables.

### Related Issues

CodeEditApp/CodeEdit#1247

### Checklist

<!--- Add things that are not yet implemented above -->

- [x] I read and understood the [contributing
guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md)
as well as the [code of
conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md)
- [x] The issues this PR addresses are related to each other
- [x] My changes generate no new warnings
- [x] My code builds and runs on my machine
- [x] My changes are all related to the related issue above
- [x] I documented my code

### Screenshots

<!--- REQUIRED: if issue is UI related -->

<!--- IMPORTANT: Fill out all required fields. Otherwise we might close
this PR temporarily -->

Signed-off-by: Wouter01 <[email protected]>
@austincondiff
Copy link
Collaborator Author

austincondiff commented May 20, 2023

We've discovered the root of the problem. The MonospacedFontPicker is causing this. When this is removed, performance is fine when changing a font size. If the user has a lot of fonts installed, for whatever reason it effects other fields in the form. If the Other Fonts picker is taken out of this view, everything seems to be fine.

Things we might try:

  • Only include the other fonts Picker when the monospaced fonts picker menu is open
  • Explore if there is a way to lazy-load these menu items
  • Rewrite the picker using AppKit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant