diff options
| author | Jefferson González <jgmdev@gmail.com> | 2025-11-24 21:01:30 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-24 21:01:30 -0400 |
| commit | a1450948da83a113f0d192524fb3e1bda3fcb2d9 (patch) | |
| tree | e2a663fb5023be3c8640bd43b80a50738bdeea33 /data/plugins/settings.lua | |
| parent | f5e7c9ea5879d558681e6e62939fc31ee244c5e9 (diff) | |
| download | pragtical-a1450948da83a113f0d192524fb3e1bda3fcb2d9.tar.gz pragtical-a1450948da83a113f0d192524fb3e1bda3fcb2d9.zip | |
Better out of box smoothness and responsiveness (#357)
* Better out of box smoothness and responsiveness
This PR does various things to improve the out of the box editor
smoothness which includes:
* Adding new renwindow.get_refresh_rate method.
* Introduce new config.auto_fps flag to match the fps to current
display refresh rate.
* Setting config.fps to match the display refresh rate by default.
* Emit displaychanged event to keep refresh rate updated.
* Allow smaller snap point on move_towards animation to reduce jittering.
* Reduce scroll rate from 0.3 to 0.2 for smoother scroll transition.
* Decrease garbage collection setpause to collect more often and
in smaller sizes preventing big pauses, which should improve
responsiveness.
Other Changes:
* Introduce new global DEFAULT_FPS to assist the settings gui when
changing the config.auto_fps/fps flags.
* Revert default context lines from 10 to 1.
* Increase blink period from 0.8 seconds to 1.2 seconds which
should be less distracting.
* Adjust run loop no-draw wait time
* Drop no longer necessary lower latency config
* Minor adjustment to code comment
Thanks to Amer for testing!
Diffstat (limited to 'data/plugins/settings.lua')
| -rw-r--r-- | data/plugins/settings.lua | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/data/plugins/settings.lua b/data/plugins/settings.lua index 9a33a9ba..f81f6820 100644 --- a/data/plugins/settings.lua +++ b/data/plugins/settings.lua @@ -263,13 +263,34 @@ settings.add("General", settings.add("Graphics", { { + label = "Auto FPS", + description = "Automatically set frames per second from current display refresh rate.", + path = "auto_fps", + type = settings.type.TOGGLE, + default = true, + on_apply = function(enabled) + if enabled then + config.fps = DEFAULT_FPS + else + config.fps = settings.config.fps or DEFAULT_FPS + end + end + }, + { label = "Frames Per Second", - description = "Lower value for low end machines and higher for a smoother experience.", + description = "Lower value for low end machines and higher for a smoother experience. This value is ignored if Auto FPS is enabled.", path = "fps", type = settings.type.NUMBER, - default = 60, + default = core.window:get_refresh_rate() or 60, min = 10, - max = 300 + max = 300, + on_apply = function(value) + if config.auto_fps then + config.fps = DEFAULT_FPS + else + config.fps = value + end + end }, { label = "Transitions", @@ -511,7 +532,7 @@ settings.add("User Interface", description = "Interval in seconds in which the cursor blinks.", path = "blink_period", type = settings.type.NUMBER, - default = 0.8, + default = 1.2, min = 0.3, max = 2.0, step = 0.1 @@ -610,7 +631,7 @@ settings.add("Editor", description = "Minimum number of lines to keep visible above and below the cursor when scrolling the document.", path = "scroll_context_lines", type = settings.type.NUMBER, - default = 10, + default = 1, min = 0, step = 1 }, @@ -689,13 +710,6 @@ settings.add("Editor", path = "scroll_past_end", type = settings.type.TOGGLE, default = true - }, - { - label = "Lower Input Latency", - description = "Reduce input latency by processing background tasks more aggressively, may use more CPU.", - path = "lower_input_latency", - type = settings.type.TOGGLE, - default = false } } ) @@ -825,7 +839,7 @@ settings.add("Advanced", description = "How many times ram has to increase after last clean in order to reclean. Lower value makes GC more aggressive but may cause stuttering. (Ignored on Lua 5.4+)", path = "gc_pause", type = settings.type.NUMBER, - default = 2, + default = 1.5, min = 1, max = 10, step = 0.1, @@ -843,7 +857,7 @@ settings.add("Advanced", description = "How many times faster to run the collector in relation to allocations. Higher value makes GC more aggressive but may cause stuttering. (Ignored on Lua 5.4+)", path = "gc_step_multiplier", type = settings.type.NUMBER, - default = 2, + default = 1.5, min = 1, max = 10, step = 0.1, |
