about summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
...
* twtuni: correct behavior on failed bounds checkbptato2024-09-081-11/+11
| | | | Make sure U+FFFD is returned when a bounds check fails.
* sixel: small optimizationbptato2024-09-081-29/+27
| | | | | | For large palettes, looping over the entire chunk list is quite slow. Store the list of active chunks in a separate sequence so we can skip the unused ones.
* utils: add twtunibptato2024-09-0819-433/+483
| | | | | | | | | | | | | | | | | | | std/unicode has the following issues: * Rune is an int32, which implies overflow checking. Also, it is distinct, so you have to convert it manually to do arithmetic. * QJS libunicode and Chagashi work with uint32, interfacing with these required pointless type conversions. * fastRuneAt is a template, meaning it's pasted into every call site. Also, it decodes to UCS-4, so it generates two branches that aren't even used. Overall this lead to quite some code bloat. * fastRuneAt and lastRune have frustratingly different interfaces. Writing code to handle both cases is error prone. * On older Nim versions which we still support, std/unicode takes strings, not openArray[char]'s. Replace it with "twtuni", which includes some improved versions of the few procedures from std/unicode that we actually use.
* Fix 1.6.14 compilationbptato2024-09-072-2/+30
| | | | | Wait, why does std fastRuneAt try to decode UCS-32? Hmm...
* md2html: code, pre, inline fixesbptato2024-09-075-124/+198
|
* term: support SyncTERMbptato2024-09-061-55/+69
| | | | Now it mostly works, provided you set a compatible encoding.
* Update chagashibptato2024-09-062-1/+1
|
* sandbox: allow futex in network/buffer sandboxbptato2024-09-061-1/+2
| | | | | WSL needs it. It was already allowed on Android, so this just makes the sandboxes converge a little.
* twtstr: type erase binarySearch instantiationbptato2024-09-063-38/+52
| | | | | | | | Do it like parseEnumNoCase0, so we no longer instantiate a gazillion different binary searches for the same type. While we're at it, make matchNameProduction's searchInMap use uint32 too.
* term: sixel sizing & output fixesbptato2024-09-053-20/+29
| | | | | | | | | | | | * round down to number divisible by 6 for height * make pager's dispw match term's dispw even after width clamping * make *BE procs actually emit/consume big-endian (lol) * fix borked sixel set raster attributes & control string I mixed up SRA with the device control string's parameters, so instead of toggling transparency in the DCS, I was setting the second SRA parameter to 0. Which, by the way, defines the aspect ratio's denominator, and has nothing to do with transparency. Whoops.
* term: add outputSixelImage bounds checksbptato2024-09-041-3/+12
| | | | Makes it so we don't crash the entire browser upon encoding failure.
* sixel, stbi, sandbox: fix fstat sandbox violationbptato2024-09-045-54/+72
| | | | | | | Until recently, glibc used to implement it as fstatat. So don't trap for fstatat (and for consistency, fstat), but return EPERM. Just to be sure, rewrite sixel & stbi to never call fread.
* bindings: remove zlibbptato2024-09-041-79/+0
| | | | unused
* loader, client, buffer: use selectInto (not select)bptato2024-09-033-9/+13
| | | | select allocates. (makes sense, but I never realized...)
* loader: fix crashes with kqueue backendbptato2024-09-032-4/+23
| | | | | | | pain... (also, fix an fd leak, plus a more general bug where we registered empty output handles.)
* cascade: add missing nil checkbptato2024-09-021-1/+1
|
* loader: fix some fd leaksbptato2024-09-024-11/+37
| | | | + be a bit more paranoid about double closes
* doc: update manpagesbptato2024-09-0214-30/+387
|
* md2html: misc inline fixesbptato2024-09-011-114/+160
| | | | | * fix whitespace-surrounded asterisk turning into emphasis * slightly refactor parseInline (it's still quite ugly...)
* Update chagashibptato2024-09-012-1/+1
|
* pager: fix missing gotoLine return valuebptato2024-09-011-0/+1
|
* sixel: special case search for few color registersbptato2024-09-011-17/+58
| | | | | | See comment for details. (Also, set the palette size based on quality for toBlob.)
* canvas: make sure we don't link to QJSbptato2024-09-0111-192/+167
|
* url: reduce idna sizebptato2024-09-013-2155/+1181
| | | | | Instead of storing pointers to cstrings, put all of them in a single huge string and store indices of that.
* path: fix swap bug, refactor linesbptato2024-09-013-19/+21
|
* canvas: move to separate CGI scriptbptato2024-09-0123-364/+571
| | | | | | | | | | * stream: and passFd is now client-based, and accessible for buffers * Bitmap's width & height is now int, not uint64 * no more non-network Bitmap special case in the pager for canvas I just shoehorned it into the static image model, so it still doesn't render changes after page load. But at least now it doesn't crash the browser.
* git.cgi: add git blamebptato2024-09-011-11/+63
|
* layout: fix table height constraint typebptato2024-08-303-1/+35
| | | | | it's really min-height, not height; consistency is not CSS's strong suit...
* sixel: fix oobbptato2024-08-301-3/+2
| | | | whoops
* term, sixel: misc image fixes, sixel optimizationbptato2024-08-302-70/+121
| | | | | | | | * expand allowed color range somewhat * update maximum sixel size on window resize * fix kitty image cropping * use faster algorithm for sixel compression (also produces less wasteful output)
* md2html: support blockquotebptato2024-08-304-13/+30
| | | | + update todo, readme
* sixel: ditheringbptato2024-08-291-42/+73
| | | | | | | | | | | | | uses floyd-steinberg - I originally tried atkinson, but liked the results with fs a bit more. also, I got rid of the half hearted attempt to skip tree traversals for color lookups, as it performs horribly with dithering. it *did* work if I set Y as the key, but it still felt wrong - well, as it turns out, octree traversal is faster anyway, so just do that. it works out nicely because we can fill in holes (from dithering) with a linear search for the nearest match as we go.
* sixel: fix borked approximation schemebptato2024-08-291-41/+29
| | | | | | | | | | | ok, of course if you search for the nearest entry after setting blue as the lowest index bits the search will be biased towards blue... let's just skip the trouble of reconstructing closest color relations by storing hashes in the octree - this way, I can ensure that the final merged colors are present in the buckets that getColor then looks at (while we're at it, also fix the color run merging code in quantize.)
* Update readmebptato2024-08-281-0/+8
|
* sixel: minor optimizationsbptato2024-08-282-52/+89
| | | | | | * don't emit transparency request when we don't need it * add lookup table for missing hash entries * write(2)'ize
* sixel, term: fix off-by-1's in croppingbptato2024-08-282-52/+42
| | | | & clean up outputSixelImage in general
* Update showcase.pngbptato2024-08-271-0/+0
|
* term: fix crash on identical stacked imagesbptato2024-08-272-3/+5
| | | | | | | in fact, we consider these to be the same image, and arguably that's a bug in and of itself. but at least we don't crash anymore. (also, update todo)
* sixel: proper color quantizationbptato2024-08-273-40/+218
| | | | | | | | just use an octree. works fine afaict, though obviously somewhat slower than the static method (encoding is 2-pass now) & still has banding issues with many colors (will need dithering) also, fixed a bug that caused initial masks of bands to get misplaced
* pager: fix nav direction after view sourcebptato2024-08-271-0/+1
|
* stbi, jebp: use read/write instead of fread/fwritebptato2024-08-263-61/+131
| | | | | | | | glibc likes to do weird things (such as calling stat) when you use fread(3) and friends, so try to use functions that are more likely to just do a single syscall. Also, copy over some more paranoid read/write procedures to http.
* Add image docsbptato2024-08-251-0/+143
| | | | Somewhat rough, but better than nothing.
* dom: toBlob fixesbptato2024-08-251-20/+7
| | | | | | | | | | * fix return type * don't choke on empty bitmaps * don't check for Cha-Image-Dimensions in encoder output (it was unused anyways) Mainly so that I can spec the encoder without Cha-Image-Dimensions as an output header - it's pointless redundancy.
* makefile: misc fixesbptato2024-08-241-0/+4
|
* sixel: break out into a separate cgi scriptbptato2024-08-246-134/+355
| | | | | | | | This caches sixel output. Works best when the line height is a multiple of 6px, but should still be faster than the previous solution everywhere else too (simply by virtue of encoding separate images in parallel). Next step: actual color quantization
* layout: fix whitespace weirdnessbptato2024-08-233-1/+9
| | | | | avoid adding whitespace to the previous atom if it's not on the current line
* winattrs: un-snakeifybptato2024-08-237-18/+18
|
* cssvalues: fix broken vmin, vmaxbptato2024-08-231-2/+2
|
* Update monouchabptato2024-08-222-1/+1
|
* loader: fix crash on empty data URLsbptato2024-08-172-1/+9
|