about summary refs log tree commit diff stats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* pager, mailcap: misc fixes, add prompt for global mailcapbptato2024-12-115-157/+339
| | | | | | | | | | | | | | | | | | | | | | | | In the past, Chawan would read global mailcap (/etc/mailcap, ...) too, but every now and then that would run entries that I didn't even know existed and definitely didn't intend to run. So I changed it to only use ~/.mailcap, but this meant users now had to add mailcap entries for every single mime type. At some point I also changed application/octet-stream to always save to disk, which is usually nice except when a text file is misrecognized as binary. Often times I just want to decide myself what to do. So now there are two layers. First, the global mailcap files (path as per RFC) prompt before executing. Then there is ~/.chawan/auto.mailcap (or ~/.config/chawan/auto.mailcap) which runs entries automatically. If you press shift before selecting an option in the prompt, the corresponding entry gets copied to auto.mailcap. It's also possible to type a new entry on the fly. Overall I think it's quite convenient. One unfortunate side effect is that existing users will have to migrate their entries to auto.mailcap, or redefine external.auto-mailcap to e.g. ~/.mailcap, but this seems acceptable.
* twtstr: small cleanupbptato2024-12-111-9/+7
|
* layout: small cleanupbptato2024-12-101-60/+60
|
* render: apply visibility to inline boxesbptato2024-12-101-21/+23
|
* pager: remove unused variablebptato2024-12-101-15/+3
|
* pager: fix nil derefbptato2024-12-101-2/+2
| | | | | | isearch feels quite janky in general, and I think there's still a race lurking here... for now it's ok, but like buffer display, this really belongs in a state machine (not promises)
* layout: override table cell width if its min width is greaterbptato2024-12-101-0/+2
| | | | We can do this now that xminwidth is more accurate.
* layout: proper min width clampingbptato2024-12-101-73/+70
| | | | better
* layout: another min width clamping hackbptato2024-12-101-20/+29
| | | | still not quite right, but it's slowly taking shape
* client: mostly merge into pagerbptato2024-12-093-809/+787
| | | | | | | | not completely, because that would break the existing API :/ this also fixes the broken interruptHandler - it no longer crashes, but it's still inefficient... probably it should "just" handle SIGINT instead
* container: de-extern some procsbptato2024-12-091-19/+19
|
* buffer: skip a copybptato2024-12-091-3/+3
|
* response: simplify text()bptato2024-12-082-42/+14
| | | | | | | | | | | | | It gets copied once anyway, so just use a blob. I guess I could skip the copy with some effort, but the 4 lines implementation is too attractive :P This is still an improvement, as it doesn't needlessly zero-fill the buffer on realloc. (I've also removed the final realloc from blob, as it seemed quite pointless. Using Content-Length could help... except it doesn't, because it refers to the encoded length. Ugh.)
* layout: another xminwidth kludgebptato2024-12-081-0/+4
| | | | yeah idk
* cssparser: misc cleanupbptato2024-12-073-122/+66
| | | | another case of "the object model was unnecessarily complex"
* Update chagashibptato2024-12-071-1/+1
|
* layout: round inline block padding to cellsbptato2024-12-071-1/+7
| | | | | Seems more compatible with websites that use smaller fonts + padding for styled code tags.
* dom: another insertAdjacentHTML fixbptato2024-12-071-2/+2
| | | | ctx can be HTML even if we take `this'
* dom: fix crash on insertAdjacentHTMLbptato2024-12-071-28/+15
| | | | In my defense, it was broken in the spec too.
* pager: hide kitty images when menu is openbptato2024-12-062-3/+20
| | | | | | | | | | | | | | | | So I thought this was just a simple z-ordering issue, but silly me, it's never simple with images. In this case it turns out Kitty can't really do z-ordering with text the way Sixel can - in short, you must pick if the image is below text, or above text, but never both. I imagine you could also get something to work with z=-1 and stretched 1-pixel colored images or some similarly horrifying hack. It seems very annoying to code and maintain, so I won't. (In some way this is impressive, because Sixel z-ordering sucks too. Somehow we got into a situation where both viable image display protocols are incapable of expressing some useful ways of image layering, of course in a mutually incompatible way.)
* Fix casingbptato2024-12-053-5/+5
|
* loader: fix heisenbugbptato2024-12-051-1/+6
| | | | | | | | | | | | | | | | | | Unconditionally registering output handles on resume could result in a failed assertion on double-register. The bug would appear like: resume (register) -> handleRead -> pushBuffer -> currentBuffer is nil -> register again handleWrite had a very high likelihood of occurring between resume and handleRead, and that hid the bug by immediately unregistering the handle after resume. In fact, I haven't been able to reproduce the bug at all today, and only found it after poring over the source... Fix this by not registering output handles that are empty (except if the istream is already finished, in which case it will just be unregistered).
* env: allow data URL fetchbptato2024-12-051-1/+2
|
* config, mailcap: remove std/streams dependency, specialize mmapbptato2024-12-055-105/+119
| | | | | | | | | | * use PosixStream/mmap for mailcap reading too; this finally lets us get rid of std/streams in the entire codebase * split up recvDataLoopOrMmap into 3 functions: one that can fall back to recvAll, one that falls back to recvDataLoop, and one that does not fall back to anything * use MAP_PRIVATE in mmap for read (we don't care if changes are propagated, as we do no changes to cached files)
* mimetypes: refactor, use mime.types for inline image extensionsbptato2024-12-0512-104/+154
| | | | | | | | | | | | * remove std/streams use from mime.types; mmap and parse directly * use mime.types for inline image extensions * add some jpeg file extensions Latter came up because I was trying to add a format locally and it wouldn't recognize it on images from my file system (i.e. by extension). As a security measure we still do not allow additional extensions for predefined inline image types.
* main: support -C/path etc.bptato2024-12-051-10/+15
| | | | it's unambiguous anyway
* dynstream: recvDataLoopOrMmap improvementsbptato2024-12-051-38/+70
| | | | | * fall back to recvAll on ilen = -1 * handle zero-length files
* cssparser: misc cleanupbptato2024-12-051-50/+47
|
* pager, term: use cell offset with kitty imagesbptato2024-12-034-14/+35
| | | | | | | | Gets rid of rounding errors when positioning images. Theoretically this is possible with Sixel too, but as always, it's ten times as difficult to implement as with Kitty, so I'll leave it for later.
* cascade: add cellspacingbptato2024-12-032-0/+8
|
* cssvalues: optimize CSSComputedValues sizebptato2024-12-033-271/+269
| | | | | | | | Roughly halves the object's size, and gets rid of a large number of allocations. It could be compressed further into a bitmap, but I'm not sure if it's worth the complexity.
* toml, config: skip copying buf, use PosixStreambptato2024-12-034-123/+138
| | | | | | | one std/streams less I used mmap for reading the user config. It shouldn't matter in any realistically sized config, but who knows.
* cssvalues: fix min-width/min-height autobptato2024-12-021-19/+18
| | | | | | so for max-width it's called "none", but for min-width it's "auto". why :(
* layout: temporary hack to fix xminwidth + flexbptato2024-12-021-0/+12
| | | | | | | | | | | | ugly, but better than the status quo. the core issue is that width, min-width should clamp xminwidth too, but it doesn't. this hadn't been an issue until recently, but since I made <pre> stretch out xminwidth too it had the unfortunate result that you now have to scroll on pages that nest pre in a flex. this still isn't a proper fix, in particular it won't work if min-width is set to 0, but on the sites I tried it happens to work anyway.
* cascade, cssvalues: clean up a bit morebptato2024-12-022-68/+76
|
* css: misc refactoringbptato2024-12-025-137/+128
|
* config: add copy-cmd, paste-cmdbptato2024-12-011-0/+2
| | | | ref. https://todo.sr.ht/~bptato/chawan/29
* sheet, mediaquery: misc cleanupbptato2024-12-012-64/+29
|
* term: respect LINES, COLUMNS; do not crash without vi/vebptato2024-12-011-6/+12
|
* mediaquery: fix and after bare keywordbptato2024-12-011-1/+0
| | | | | no idea what that reconsume was doing there; probably a refactoring mistake
* term: disable screen workaround on tmuxbptato2024-12-011-1/+2
|
* dom: add support for @importbptato2024-12-014-58/+92
| | | | only the most basic form; no media queries yet
* buffer: fix nil derefbptato2024-11-301-1/+1
| | | | whoops
* pager: do not make pointless requests in viewImage, add saveImagebptato2024-11-305-35/+49
| | | | | | | with buffer.images enabled, we already cache them, so we can skip the additional request also, add saveImage, bound to sI
* cascade: allow presentational hints with styling=falsebptato2024-11-291-2/+2
| | | | They are UA style.
* layout: remove mystery startOffset adjustmentbptato2024-11-281-2/+0
| | | | | | | | Probably a remnant from back when startOffset meant (and was used for) something different. Interestingly, there was already a test case for this, but it was also wrong.
* twtstr: add mypairsbptato2024-11-2811-24/+35
| | | | | This couldn't get into system.nim for technical reasons, but it's still pretty useful when iterating over non-mutable openArrays.
* layout, term, url: misc cleanupbptato2024-11-283-4/+0
|
* cascade: apply buffer.styling to inline stylesbptato2024-11-271-8/+11
| | | | it's author style too
* mailcap: add x-needsstyle extension fieldbptato2024-11-272-2/+8
| | | | | | | Useful when an x-htmloutput handler needs styling for the HTML output to be formatted correctly (as a sort of pseudo-ua style sheet). ref. https://todo.sr.ht/~bptato/chawan/28