about summary refs log tree commit diff stats
path: root/src/local
Commit message (Collapse)AuthorAgeFilesLines
* select: fix height definitionbptato2024-12-151-13/+10
| | | | | now I sort of understand how it works. basically maxh and maxw represent the inner area occupied by the widget at any time.
* chabookmark fixes & improvementsbptato2024-12-151-1/+4
| | | | | | | | * correct action on M-b * add external.bookmark option * move openFileExpand functionality into unquote * add menu items * update docs
* client: document readFile, writeFile; add getenv, setenvbptato2024-12-141-7/+32
| | | | | | | | Both are quite useful. readFile and writeFile got a small makeover in error handling; in particular, readFile now returns null instead of the empty string when the file is missing and writeFile throws a TypeError on I/O errors.
* term: allow ANSI fgcolor + bgcolorbptato2024-12-131-6/+2
| | | | | | | | Not quite sure why I had assumed that this is broken. At least on XTerm, the previous behavior definitely was, e.g. with a white-ish background and white foreground it would end up correcting the contrast to purple even with black CSS color (thus breaking the "no fgcolor with bgcolor" assumption anyway.)
* container, cookie: simplify extractCookies, cookieJar.addbptato2024-12-131-4/+3
|
* cookie: remove JS modulebptato2024-12-131-2/+0
| | | | I no longer need it
* pager: fix casingbptato2024-12-121-1/+1
|
* pager: do not prompt for text typesbptato2024-12-111-1/+7
| | | | we hadn't before, and it's annoying when using cha as a pager
* pager, mailcap: misc fixes, add prompt for global mailcapbptato2024-12-111-94/+218
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* 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)
* client: mostly merge into pagerbptato2024-12-092-808/+784
| | | | | | | | 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
|
* 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.)
* config, mailcap: remove std/streams dependency, specialize mmapbptato2024-12-051-1/+1
| | | | | | | | | | * 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-052-2/+3
| | | | | | | | | | | | * 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.
* pager, term: use cell offset with kitty imagesbptato2024-12-032-11/+24
| | | | | | | | 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.
* term: respect LINES, COLUMNS; do not crash without vi/vebptato2024-12-011-6/+12
|
* term: disable screen workaround on tmuxbptato2024-12-011-1/+2
|
* pager: do not make pointless requests in viewImage, add saveImagebptato2024-11-302-5/+10
| | | | | | | with buffer.images enabled, we already cache them, so we can skip the additional request also, add saveImage, bound to sI
* twtstr: add mypairsbptato2024-11-282-3/+3
| | | | | 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-281-1/+0
|
* mailcap: add x-needsstyle extension fieldbptato2024-11-271-2/+7
| | | | | | | 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
* select: pad options in newSelectbptato2024-11-262-18/+19
| | | | this way it works for <select> tags too
* client: exit if quit was called inside a jobbptato2024-11-251-10/+11
| | | | ref. https://todo.sr.ht/~bptato/chawan/27
* pager, select: add more items, misc fixesbptato2024-11-253-46/+78
| | | | | | eh probably have to move the event loop to pager...
* select: misc fixesbptato2024-11-241-2/+10
| | | | | * jump to first selected item (if any) when opened * fix crash on control chars in option (at least they didn't bleed...)
* loader/* -> serverbptato2024-11-243-14/+14
| | | | one less mystery
* select: fix display with multi-width charsbptato2024-11-241-6/+11
| | | | progress. now they only mess up coloring a bit.
* pager: pad menu itemsbptato2024-11-241-10/+10
|
* pager, select: implement more functionsbptato2024-11-242-5/+18
| | | | | not quite happy with this design but for now let's just try to make it work well
* pager, select: add right click menu, fix some bugsbptato2024-11-234-82/+219
| | | | | | | | | | | | | | | | | | It's *not* a context menu: items are fixed, and currently not even customizable. Former is a feature, latter is a bug. Also, select now has improved mouse support; its behavior is a combination of the w3m menu (for btn1) and GTK Firefox context menu (for btn3). Also, fix some bugs in select: * lines with double width chars are handled better (not perfectly, but at least the grid isn't completely mangled anymore) * non-multiple select now highlights the currently selected option * small selects at the bottom of the screen are handled correctly * selects at the right edge of the screen are handled correctly * select multiple no longer discards selected items on cursorLeft
* pager: fix loadURL crash on empty URLbptato2024-11-231-1/+3
| | | | ref. https://todo.sr.ht/~bptato/chawan/24
* container: add Lynx-style navigation commandscommodorian2024-11-231-0/+55
|
* buffer: proper toggleImages implementationbptato2024-11-212-4/+4
| | | | | | | It necessarily removes the config.images check from codec access, which I'm not quite happy about, so I've added a check to the DOM instead. (TODO: maybe pager should just dynamically grant codec access as a capability instead? but maybe that's even more error prone...)
* select: various improvementsbptato2024-11-211-69/+79
| | | | | | * replace weird cursor position representation * add cursorTop, cursorMiddle, cursorBottom, scrollDown, scrollUp * expose fromy, cursory to JS
* container: add numLines getterbptato2024-11-191-1/+1
|
* Update monoucha, fix some JS testsbptato2024-11-181-2/+2
|
* select: add cursorPrevLink, cursorNextLinkbptato2024-11-171-0/+6
|
* container: do not share cached images on clonebptato2024-11-161-0/+1
| | | | this was causing images to disappear sometimes
* formdata: eliminate a global varbptato2024-11-152-8/+9
|
* js: reorganize modules, update docsbptato2024-11-152-8/+30
| | | | | | | most of it has already been moved to monoucha, and the rest fits better in other directories. also, move urimethodmap to config
* config: resolve download-dir as path, update docsbptato2024-11-131-1/+3
| | | | | | | Turns out it's more useful to have env vars in the variable than to allow incomplete path names. Also, fix the disappearing backslash issue in docs.
* container: fix `U' cursor repositioning (really)bptato2024-11-122-25/+16
| | | | I swear this feature is cursed
* buffer: fix broken gotoAnchor behaviorbptato2024-11-122-44/+44
| | | | | | | | | | | | | | | | | 23beebe6 introduced a regression that broke gotoAnchor. This fixes that, plus a couple other long-standing gotoAnchor bugs: * If no anchor is found, do not dupe the buffer. Desktop browsers still add a history entry, while w3m prints an error. I've copied the latter because it makes more sense as a user, but this will have to be refined for the navigation API at some point. * If the anchor *is* found, then always jump to it, even if it's not visible. This was a limitation of relying on the line array, so now we rely on the box tree instead. (Sooner or later, the former must go anyway.) Also, fix `U' reload not restoring the position (hopefully this time for good).
* client: do not reopen istream if stdin is a ttybptato2024-11-121-6/+5
|
* url: reduce URL object size, simplifybptato2024-11-113-4/+5
| | | | | | | * query, fragment are now strings, not options * get rid of Host, Path types, now hostname/pathname are strings * fix ipv4 parsing error case * in file protocol, fix URL for dirlist without slash with a redirection
* client: run actions for mouse clicksbptato2024-11-101-12/+16
| | | | | stopgap measure until I think of a more flexible mouse configuration method
* cascade: adjust prefers-color-scheme based on terminal backgroundbptato2024-11-101-0/+1
| | | | also, default link color is now blue for light terminal backgrounds
* layout -> cssbptato2024-11-102-3/+3
| | | | as much as I wish it weren't, layout *is* css.