about summary refs log tree commit diff stats
path: root/src/local
Commit message (Collapse)AuthorAgeFilesLines
* pager: refactor mailcap, console; misc fixesbptato2024-10-142-245/+227
| | | | | | | | | * use more PosixStream (because it has double-close checking) * factor out some common mailcap operations * move console from client to pager * fix case-insensitive mime type matching * replace convoluted fdin/fdout comparison logic (that only accidentally worked) with a boolean flag
* twtstr, toml: misc cleanupbptato2024-10-131-2/+1
| | | | | * remove unused DateTime toml type * add parseIntP for pointer-size int parsing
* base64: merge into twtstr/envbptato2024-10-131-1/+0
|
* layout, pager: preserve tabs on display, selection & outputbptato2024-10-102-23/+45
| | | | | | | | | | | | Substitute tabs with one of eight PUA characters based on their width, and convert them back in the pager: * TUI mode always prints spaces, but now handles tabs appropriately on cursor movement * dump mode tries to preserve hard tabs, but uses soft tabs when that is not possible (e.g. tabs after a margin, tab with background color, etc) * selection mode always outputs hard tabs.
* client: fix redirected buffers jumping back to parent on reloadbptato2024-10-071-0/+5
| | | | | replaceBackup was not being cleared, so the next gotoURL with a replace pointing to such buffers wouldn't work.
* pager: do not choke on empty editor commandbptato2024-10-071-2/+4
|
* color: reduce CellColor size, misc color refactoringbptato2024-10-062-15/+26
| | | | | | * split out CSSColor from CellColor; now CellColor is just 4 bytes (which helps reduce FormatCell size) * unify color function naming (still not perfect)
* pager: add missing int conversionbptato2024-10-061-1/+1
|
* Update Chagashibptato2024-10-051-9/+0
|
* dynstream: fix memory leakbptato2024-10-041-2/+1
| | | | now I know why overloading dealloc felt wrong
* sixel, term: reduce half-dump special casingbptato2024-10-043-22/+37
| | | | | | | Makes it slightly easier to debug image output. Also, we stop sending dimension headers, and no longer check for the scheme env var to make CLI invocation a bit less annoying.
* sixel: transparency improvementsbptato2024-10-031-4/+4
| | | | | | | * don't set transparency when raster attributes suffice - it seems terminals don't background-fill in that case either. * fix transparency in encoder standalone mode * update comments
* term: "fix" GNU screen not respecting query sequence orderbptato2024-10-011-9/+22
| | | | | | | | | | | | | wtf ... OK, it's a "fix" as much as you can fix this. I'm not adding a timer just to work around screen silently reordering my output. (Who thought this would be a good idea??) Unfortunately, this means that your background/foreground colors won't get detected when using screen. Not that they would have been until now.
* pager: improve rewrite-url semanticsbptato2024-09-301-7/+19
| | | | | | | | | | | | | Previously, it just changed the URL before loading the site; now it's an actual redirect. Technically, the previous behavior was more flexible, because it let you apply siteconf rules exclusively for sites where you redirected from. Practically, this was not very useful, and probably unexpected for anybody trying to use the feature. This also fixes a bug where the loader filter would be set for the original page, so you couldn't switch from https to http, etc.
* timeout: accept err stream as parambptato2024-09-301-6/+3
| | | | | gets rid of a todo. (not sure why I thought this was important, but it sure looks nicer)
* pager: add missing nil checkbptato2024-09-291-2/+3
|
* loader: send headers for tocache requests toobptato2024-09-282-6/+3
| | | | | This lets us send the transparency bit as a header, and also halves the number of header parsers in loader.
* container: fix control char displaybptato2024-09-284-28/+23
| | | | | | Also, kill twidth and its friends; we haven't been using it for a while now. (In the future, a solution with PUA chars might be worth exploring.)
* container: don't show hover type on ubptato2024-09-271-1/+1
| | | | it's a waste of space, and doesn't work well with showFullAlert
* loader, pager: fix fd leaksbptato2024-09-251-0/+3
|
* term: prevent negative line damage, fix off by onebptato2024-09-252-9/+9
|
* pager: make image ordering deterministicbptato2024-09-252-4/+6
| | | | ensure that images are shown in the order buffer sent them
* sixel: support transparencybptato2024-09-243-19/+29
| | | | | | | | | | | | | | | | | | Sixel can only represent transparency for fully transparent (alpha = 0) and fully opaque (alpha = 255) pixels, i.e. we would have to do blending ourselves to do this "properly". But what do you even blend? Background color? Images? Clearly you can't do text... So instead of going down the blending route, we now just approximate the 8-bit channel with Sixel's 1-bit channel and then patch it up with dither. It does look a bit weird, but it's not *that* bad, especially compared to the previous strategy of "blend with some color which hopefully happens to be the background color" (it rarely was). Note that this requires us to handle transparent images specially in term. That is, for opaque ones, we can leave out the "clear cells affected by image" part, but for transparent ones, we must clear the entire image every time.
* select: use a separate module (again)bptato2024-09-244-351/+374
| | | | | | | | | Now we dispatch to select objects from the pager object too, just to make things even more confusing. Well, it works better than the previous arrangement, in that trying to use unimplemented movements now just throws instead of moving around the container. Yay for OOP (?)
* pager: fix double-width overprint & reload blank screen bugbptato2024-09-242-8/+17
| | | | | * fix overprint of double width chars in status & select * fix blank screen on reload + startpos screen move
* sixel: use inline background for blendingbptato2024-09-242-2/+2
| | | | still not really great, because inline background is a mess too
* Replace std/selectors with pollbptato2024-09-232-63/+78
| | | | | | | | | | | | std/selectors uses OS-specific selector APIs, which sounds good in theory (faster than poll!), but sucks for portability in practice. Sure, you can fix portability bugs, but who knows how many there are on untested platforms... poll is standard, so if it works on one computer it should work on all other ones. (I hope.) As a bonus, I rewrote the timeout API for poll, which incidentally fixes setTimeout across forks. Also, SIGWINCH should now work on all platforms (as we self-pipe instead of signalfd/kqueue magic).
* client, forkserver, dynstream: misc refactorings, fixesbptato2024-09-232-86/+84
| | | | | | * fix broken int conversion in dynstream * fix EPIPE handling in forkserver * merge fdmap and connectingContainers into loader map
* term: refactorbptato2024-09-232-145/+157
| | | | | * reduce copies & allocations * simplify SGR generation
* loader: mmap intermediate image files, misc refactoringbptato2024-09-223-27/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | * refactor parseHeader * optimize response blob() * add direct "to cache" mode for loader requests which sets stdout to a file, and use it for image processing * move image resizing into a separate process * mmap cache files in between processing steps when possible At last, resize is no longer a part of image decoding. Also, it feels much nicer to keep encoded image data in the same cache as everything else. The mmap operations *should* be more efficient than copying the whole RGBA data through a pipe. In practice, it only makes a difference for loading (well, now just mmapping) the encoded image into the pager, where it singlehandedly speeds up image display by 10x on my test image. For the other steps, the unfortunate fact that "tocache" must delay the next fork/exec in the pipeline until the entire image is processed seems to equal out any wins we might have gotten from skipping a single raw RGBA copy. I have tried moving the delay before the exec (it's possible with yet another pipe), but it didn't help much and made the code much uglier. (Not that tocache didn't, but I can live with this...)
* pager: improve hover text handlingbptato2024-09-223-44/+77
| | | | | | | | | | | * align status truncating behavior with w3m (not exactly, clipping is still different, but this should be fine for now) * add "su" for "show last alert" - w3m's solution here is to scroll one char at a time with "u", but that's extremely annoying to use. We already have a line editor that can navigate lines, so reuse that instead. * fix peekCursor showing empty text * update todo
* client: seqify fdmapbptato2024-09-221-4/+6
|
* dom: add forms, elements getter + misc fixesbptato2024-09-171-9/+2
| | | | | | | | | | | | * add document.forms * add form.elements * remove redundant jshasprop functions * use mpairs for attribute iteration (mpairs use pointers, but pairs copies) * fix remove() crash * fix remove() collection invalidation for children (if parent is not in the collection) * update monoucha
* blob: make size signed intbptato2024-09-151-2/+2
| | | | it was already being treated as such
* loader: refactor/move around some procsbptato2024-09-153-5/+8
| | | | | | | | | | | | | | Module boundaries didn't make much sense here either. Specifically: * loader/cgi was originally just one of the many "real" protocols supported by loader, so it was in a separate module (like the other ones). Now it's mostly an "internal" protocol, and it was getting cumbersome to pass all required loader state to loadCGI. * The loader interface has grown quite large, but there is no need for (or advantage in) putting it in the same module as the implementation. Now CGI is handled by loader, and the interface is in the new module "loaderiface".
* Refactor img/*bptato2024-09-152-2/+2
| | | | | I've moved most image logic to adapter, so it doesn't really make sense to have this subdir anymore.
* loader: improve map interfacebptato2024-09-141-1/+1
| | | | directly accessing map was a bit too error prone
* loader: refactor, misc optimizations & fixesbptato2024-09-143-34/+21
| | | | | | | | * factor out input/output handle tables; use a seq instead * add possibility to directly open cached items onto stdin (mainly an optimization for reading images, which are always cached) * close used handles on local CGI execution * make clone during load work again
* term: improve damage tracking, special case yaftbptato2024-09-132-15/+42
| | | | | | | It still sucks, but at least now it flashes a bit less. (I should really redo it properly some time) Also, special case yaft so that we always output sixels for it.
* sixel: do not reserve palette entry for transparencybptato2024-09-121-4/+4
| | | | | | | | | Turns out this isn't actually needed. Which makes sense, as transparency doesn't have a color register at all - it's just the default state of pixels. Also, skip octree-based quantization with palette <= 2; unsurprisingly, monochrome gives much better results.
* config: add display.sixel-colorsbptato2024-09-101-0/+3
|
* pager: fix saveSourcebptato2024-09-102-5/+9
| | | | | | Welp. The fence was needed after all. The keybinding was broken anyway; fix that too.
* pager: fix rewrite-url weirdnessbptato2024-09-102-8/+4
| | | | | | | | | saveSource's URL overriding mechanism conflicted with rewrite-url, since the latter wouldn't change the overriding URL (which was not optional either). Remove the former since a) it's just cosmetic and b) not really visible to the user at all.
* pager, term: fix kitty display, add a sixel bounds checkbptato2024-09-092-4/+5
|
* utils: add twtunibptato2024-09-084-177/+175
| | | | | | | | | | | | | | | | | | | 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.
* term: support SyncTERMbptato2024-09-061-55/+69
| | | | Now it mostly works, provided you set a compatible encoding.
* term: sixel sizing & output fixesbptato2024-09-052-13/+22
| | | | | | | | | | | | * 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.
* loader, client, buffer: use selectInto (not select)bptato2024-09-031-4/+6
| | | | select allocates. (makes sense, but I never realized...)
* loader: fix some fd leaksbptato2024-09-021-4/+2
| | | | + be a bit more paranoid about double closes