about summary refs log tree commit diff stats
path: root/src/layout/renderdocument.nim
Commit message (Collapse)AuthorAgeFilesLines
* css/values -> css/cssvaluesbptato2024-05-161-1/+1
| | | | for consistency
* layout: unify some code pathsbptato2024-05-091-17/+6
| | | | | | | Turn Offset, Size, etc. into arrays indexed by a DimensionType enum, and use it to unify code that only differs in the dimension it is computing for. (e.g. this lets us use the same code for flex row & column layouts.)
* color: RGBAColor -> ARGBColorbptato2024-04-261-2/+2
|
* Initial image supportbptato2024-04-251-11/+28
| | | | | | | | | | | | | | | | | * png: add missing filters, various decoder fixes * term: fix kitty response interpretation, add support for kitty image detection * buffer, pager: initial image display support Emphasis on "initial"; it only "works" with kitty output and PNG input. Also, it's excruciatingly slow, and repaints images way too often. Left undocumented intentionally it for now, until it actually becomes useful. In the meantime, adventurous users can find out themselves why: [[siteconf]] url = "https://.*" images = true
* Update code stylebptato2024-04-171-10/+10
| | | | | | * separate params with ; (semicolon) instead of , (colon) * reduce screaming snake case use * wrap long lines
* layout: remove ListItemBox, handle inline-flex correctlybptato2024-04-151-10/+0
| | | | | This allows us to unify BlockBox instantiation and block-level inner layout calls.
* renderdocument: do not layout with styledRoot == nilbptato2024-04-111-1/+4
| | | | it can happen when do_reshape is called before any parsing happens.
* layout: rework inline box area modelbptato2024-03-251-29/+10
| | | | | | | | | | | | | Specifying the background area as three LayoutUnit pairs sounds clever, but breaks down for text-align: center. * store line Y offset in LineBox - this is necessary to pass down areas we need to paint * refactor addHorizontalLine loop; remove mystery "If necessary, update ictx's width" line that used to be labeled "TODO this seems meaningless" and indeed seems meaningless now (I am prepared to deeply regret this later) * replace broken & convoluted startOffset/endOffset/size with a simple seq of offsets + sizes
* cell: update FormatFlag naming, remove useless templatesbptato2024-03-211-6/+6
|
* Move around some modulesbptato2024-03-141-1/+1
| | | | | | | | * extern -> gone, runproc absorbed by pager, others moved into io/ * display -> local/ (where else would we display?) * xhr -> html/ * move out WindowAttributes from term, so we don't depend on local from server
* strwidth, renderdocument: small refactoringbptato2024-03-031-73/+61
| | | | | | * put attrs pointer in state * simplify width() * use unsigned int as ptint to avoid UB
* term: improve pixels-per-column/line detectionbptato2024-02-251-2/+59
| | | | | | | | | Some terminal emulators (AKA vte) refuse to set ws_xpixel and ws_ypixel in the TIOCGWINSZ ioctl, so we now query for CSI 14 t as well. (Also CSI 18 t for good measure, just in case we can't ioctl for some reason.) Also added some fallback (optionally forced) config values for width, height, ppc, and ppl. (This is especially useful in dump mode.)
* Separate ANSI text decoding from main binarybptato2024-02-251-0/+437
Handling text/plain as ANSI colored text was problematic for two reasons: * You couldn't actually look at the real source of HTML pages or text files that used ANSI colors in the source. In general, I only want ANSI colors when piping something into my pager, not when viewing any random file. * More importantly, it introduced a separate rendering mode for plaintext documents, which resulted in the problem that only some buffers had DOMs. This made it impossible to add functionality that would operate on the buffer's DOM, to e.g. implement w3m's MARK_URL. Also, it locked us into the horribly inefficient line-based rendering model of entire documents. Now we solve the problem in two separate parts: * text/x-ansi is used automatically for documents received through stdin. A text/x-ansi handler ansi2html converts ANSI formatting to HTML. text/x-ansi is also used for .ans, .asc file extensions. * text/plain is a separate input mode in buffer, which places all text in a single <plaintext> tag. Crucially, this does not invoke the HTML parser; that would eat NUL characters, which we should avoid. One blind spot still remains: copiousoutput used to display ANSI colors, and now it doesn't. To solve this, users can put the x-ansioutput extension field to their mailcap entries, which behaves like x-htmloutput except it first pipes the output into ansi2html.