Better colors, better performance, new Diff Viewer, SDL3 port and a seasoned dosage of new features, fixes and enhancements!
Many of the new features and fixes on this release are possible thanks to all the help, suggestions and testing provided by Amer.
Diff Viewer
One of the most exciting features on this release is the new file and strings differences viewer that was suggested by bananakid, who also provided testing and useful feedback, Thank You!
Here is a preview of the viewer and configuration settings:
Short video preview of the Diff Viewer:
New styles that can be set by color themes:
style.diff_delete = { common.color "rgba(200, 84, 84, 1)" }
style.diff_insert = { common.color "rgba(77, 127, 73, 1)" }
style.diff_modify = { common.color "rgba(202, 173, 85, 1)" }
style.diff_delete_background = { common.color "rgba(200, 84, 84, 0.30)" }
style.diff_insert_background = { common.color "rgba(77, 127, 73, 0.30)" }
style.diff_modify_background = { common.color "rgba(202, 173, 85, 0.30)" }
style.diff_delete_inline = { common.color "rgba(200, 84, 84, 0.40)" }
style.diff_insert_inline = { common.color "rgba(77, 127, 73, 0.40)" }
Better Colors
This release ships with a bunch of improvements and corrections to the color themes courtesy of Amer who also raised the subject of search selection highlights not been eye friendly. For this, we now introduced the ability of having a different highlight color for search selections as seen below:
New style fields introduced with this change that can be set by color themes:
style.search_selection
- background color of the selectionstyle.search_selection_text
- foreground (text) color of selection
Also, we got the nightfox family of color themes thanks to ranjan.
New Config Options
We added some new config options that let you modify some aspects of the editor. These configuration options are:
---Draw the current FPS, the average frame time, and the maximum time that
---coroutines have to run per frame without affecting the rendering process
---plus the total amount of running coroutines. If set to 'uncapped' the system
---will draw at the maximum speed per second for benchmarking purposes.
---
---Defaults to false.
---@type boolean | "uncapped"
config.draw_stats = false
---Perform case insensitive next word selection.
---
---The default is false.
---@type boolean
config.select_add_next_no_case = false
---Minimum number of lines to keep visible above and below the cursor
---when scrolling the document.
---
---The default is 10
---@type integer
config.scroll_context_lines = 10
---Show or hide the line numbers.
---
---The default is true
---@type boolean
config.show_line_numbers = true
Some previews on the effect of the config flags:
config.draw_stats
config.select_add_next_no_case
config.scroll_context_lines
All these configuration options are also accessible from the Settings UI.
UI Improvements
One feature mostly unknown by users is the ability to search for a line of code on current document using the goto line command. Syntax coloring was added to the shown results:
Welcome page is responsive:
REPL History and Completion Support
The previous release added a new REPL to easily interface with the Pragtical runtime from the CLI. This release improves the REPL by adding history and completion support that also works on Windows thanks to the lua linenoise wrapper which I forked in order to integrate it with linenoise-ng, fixing various segmentation faults and bugs. Finally, multiple return values are properly handled now as seen on the video below:
Performance Galore
Now, the officially distributed binary builds are generated using Profiler Guided Optimizations and Link Time Optimizations to get some better performance. For PGO I introduced a lua stress script to generate the profiler data by running various tasks like: text editing, tokenizing, scale changes, rect drawing, multiple process launching, etc...
LuaJIT FFI is now been used to call into some of the most hot C functions used at runtime in order to reduce the calling overhead produced by the Lua C API by up to 90%.
Also, the node system was modified to only perform updates on active views and draw only the visible ones. This improves performance when having multiple documents open at once.
A performance regression that was introduced with the fonts defer bitmap feature was fixed thanks to reproducible test data provided by Amer. Pinpointing the issue took some profiling and analyzing but it was finally fixed resulting on snappier editor performance when opening files containing whitespace characters.
The config.fps
flag is now better respected since the rendering system will
not go much higher from the set value. Before, setting a value of 60 would not
have much effect with total frames per second surpassing this value by the
hundreds on forced redraws or received events, now, the max fps should be
more aligned to the configured amount.
Other performance improvements are listed on the change log!
Core Additions
Some new methods made it in the core to help on the performance and code duplication reduction departments.
---Get an estimated range of visible columns. It is an estimate because fonts
---and their fallbacks may not be monospaced or may differ in size. This
---function provides a way of optimization on really long lines for plugins
---that perform drawing operations on them.
---
---It is good practice to set the `extra_cols` parameter to a value that leaves
---room for the differences in font sizes.
---@param line integer
---@param extra_cols? integer Amount of columns to deduce on col1 and include on col2 (default: 100)
---@return integer col1
---@return integer col2
---@return integer ucol1
---@return integer ucol2
function DocView:get_visible_cols_range(line, extra_cols) end
---Open the given resource using the system launcher.
---The resource can be an url, file or directory in most cases...
---@param resource string
---@return boolean success
function common.open_in_system(resource) end
We truly needed common.open_in_system
!
Other Changes
Finally the SDL3 Port was merged after various testing.
The project module settings are now reset on project change.
Dropped from official builds macOS universal bundle and Windows 32 bits.
A borderless mode bug was spotted on macOS some time ago by dilpreetsio and finally fixed thanks to the feedback provided by sfesenko.
Various other enhancements and fixes are part of this release but, I'm getting lazy summarizing them and this post is getting long. Check the changes log below for more details.
Downloads on GitHub.
Changes Log
New Features
-
Add option to draw rendering stats (#291)
-
REPL history and completion support (#287)
-
Configurable amount of context lines visible on scroll (#311)
-
Add built-in config to toggle line numbers (#316)
-
Add config option for insensitive next word selection (#332)
-
New Diff Viewer for built-in support of file and string comparisons (#306)
-
Add common.open_in_system(resource) function (#321)
-
SDL3 port (#254)
Colors
-
Add special highlight colors to search selections (#312)
-
add search highlight styles to pre-packaged themes (#315)
-
Add search selection styles to extra color themes (colors/#2)
-
Improve contrast for default themes (#322)
-
Improve contrast on extra themes (colors/#5)
-
Added new nightfox family of color themes (538d0424)
Fixes
-
Fix common.color returning rgba values as strings (#289)
-
Handle incomplete token type (#295)
-
fix for tokenizer plugins not providing state (fb56c461)
-
borderless: scale window hit test info (#303)
-
findfile: take into consideration subdirectories (#325)
-
Reset previous project module settings on change (#329)
-
projectsearch: restore docview focus on hidden treeview (#331)
Enhancements
-
language_lua: add c syntax coloring to ffi.cdef (#290)
-
autocomplete: on max symbols return syntax_symbols (#294)
-
settings ui: allow lowering line height to 0.8 (#299)
-
Make welcome page responsive (#300)
-
Scale treeview and projectsearch size on scale changes (#304)
-
Search UI: also scroll horizontally (#310)
-
doc:go-to-line: live syntax preview (#314)
Performance
-
Use LuaJIT FFI to perform draw calls (#288)
-
Limit FPS to match config.fps even during frequent events (#293)
-
Add DocView:get_visible_cols_range(...) (#296)
-
Revert "drawwhitespace: Cache whitespace location" (#302)
-
luajit: arm64 patch to increase mcode alloc size (#301)
-
Only update active views and draw visible ones (#307)
-
Lower frame rate only after 3 consecutive drops (#308)
-
Don't use incremental gc on Lua 5.4+ (#309)
-
Improve core.run() timings. (#313)
-
Revert back to performant iterator on each_token (#317)
-
Move inner functions to outer on tokenizer.tokenize (#318)
-
Fix performance regression on defer bitmap (#326)
Build System
- Add PGO Stress Generator Script, release and rolling builds are now PGO optimized, dropped macOS universal bundles and Windows 32 bit builds (#320)
Widgets
-
Added alpha slider to colorpicker widget
-
Make use of new container widget on settings UI installed plugins and also on the EmptyView
-
Added color reference support and make use of it on ListBox