Repository navigation
Dev - #3
Merged
Merged
Dev#3
Conversation
Measured per phase: URL detection built a String at every char of every shown line, 40% of a frame; a line without "://" now skips it. The completion menu cloned, hashed and sorted every matching word on each key; it now borrows them, hashes only words from other buffers, compares ASCII by bytes and sorts only the 50 it shows. Open + draw 2.1 -> 1.0 ms, typing 500 chars 145 -> 121 ms, scrolling 63 -> 56 ms.
tools.rs held nine tools in 1500 lines. Each now has its own module (calculator, units, bases, time, colors, JSON, generated text, case) with its tests beside it; tools/mod.rs keeps the Tool table and the popup. The JSON layout, one 94-line loop, is a small Layout with a method per kind of char: string, comment, bracket, separator.
draw_line was one 95-line loop. A LinePaint now holds what the line needs once (theme, background, guide, search matches) and builds a char's style in layers: syntax, URL, word, TODO, hex color, bracket, selection or search. Blanks with guides and guides past the text get their own functions. Same frames, same timings.
The tabline is a Tabs that pushes one buffer's tab at a time, with its icon and mark worked out apart, then the buttons. The statusline is NvChad's modules in a row: caps, mode and file, git, activity, cwd and position. The gallery renders byte for byte the same.
compose was 86 lines. Rows shares the screen's rows between the bars and the text; side_panels, text_area, bottom_bars and overlays draw the tree and preview, the windows, the bars, then the floats. The tool popup and split borders leave windows() too. The gallery renders the same.
explorer() keeps the scrolling and the loop; an entry's row, icon, name color and git symbol each have a function. The gallery renders the same.
picker() lays out three parts, each drawn by its own function; a result row, the preview's source (file, buffer, theme sample) and a highlighted code row are separate too.
text_rows keeps the scroll and the loop; a Gutter knows its width and draws a line's number and gitsigns mark, and decor_for finds a line's highlights. The theme is passed down, not fetched per line: without an installed theme (the benchmarks) each fetch builds one. Same frames, same timings.
run() reads as the loop it is: draw, wait, handle, then the shell or the clipboard. The panic hook, a frame drawn under catch_unwind, an event handled under it, and a shell run each have a function.
inline() was an 81-line loop of closures and flags. Inline holds the spans and the emphasis; flush, look and toggle are its methods, and a code span and a link are read by their own functions.
open_picker builds the Picker; picker_items is the table of sources, and the buffer, command, line and smart lists each have a function.
submit checks the path and the answer, then reports; run_prompt is the table of actions, and the tree's add, copy and delete, with the path an action touches, are plain functions.
detect() routes to elf() and pe(); the other magic bytes are a table.
setup() lays the popup out; the search field, the list of section and setting rows, and one row's columns each have a function.
A screenshots test plays each README scene with real keys in a small demo project and writes its frame as SVG; the PNGs are rasterised from them (docs/development.md says how). Twelve scenes now, the tools popup, the visual selection and the settings among them, and captions that match. The architecture page shows the tools modules and how a frame and a line are drawn; the feature table says NvChad look.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.