about summary refs log tree commit diff stats
path: root/src/local
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* url: fix compilation on Nim 1.6.14bptato2024-11-071-1/+1
| | | | it handles side effects differently
* luwrap: fix compilation on 2.0.8 and refactor a bitbptato2024-11-051-1/+1
| | | | ref. https://todo.sr.ht/~bptato/chawan/21
* utils, types: merge some modulesbptato2024-11-035-6/+2
| | | | | * line, vector, matrix -> path * twtuni, charcategory -> twtstr
* container: fix nil deref on cancelbptato2024-11-021-3/+4
|
* pager: fix borked error checkbptato2024-10-311-1/+1
|
* container: fix peekCursor showing hover texts in the wrong orderbptato2024-10-291-4/+5
|
* config: refactor, accept more possible config dirsbptato2024-10-281-1/+2
| | | | | | | | | | | | | | | | | | | | | I'm starting to favor dotfiles over XDG basedirs, but there's no reason why we couldn't have both. So now the search path is: 0. if config was set through -C, use that 1. $CHA_CONFIG_DIR is set -> $CHA_CONFIG_DIR/config.toml 2. $XDG_CONFIG_HOME is set -> $XDG_CONFIG_HOME/chawan/config.toml 3. ~/.config/chawan/config.toml exists -> use that 4. ~/.chawan/config.toml exists -> use that Notably, this makes it so the default directory is ~/.chawan *if* you don't have an existing config.toml file. So in that case known_hosts will be placed in ~/.chawan/known_hosts. However, configurations with a config in ~/.config/chawan/config.toml continue to work as expected, as for those the known_hosts file remains inside ~/.config/chawan/. Finally, I've added a default user CGI directory to reduce friction in setting CGI up. (Like known_hosts, it's also relative to whatever config dir you have.)
* pager: misc extern fixesbptato2024-10-271-80/+109
| | | | | * fix externFilterSource ignoring content types other than html * refactor runProcess to use a custom fork/exec instead of system(3)
* container: fix crash on isearch between redirectsbptato2024-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | Sadly, pushCursorPos may not be paired with a popCursorPos in case the container in question is replaced during the isearch. The easiest way to reproduce this is: * start request to a page that redirects * start isearch * redirection happens, now the old container is gone * type something Then, popCursorPos would try to pop the cursor position from the new container. An alternative (and better) solution would be to add a weak ref to the container as the line edit data. Sadly, we don't have weak refs, and I don't want to hack them in with finalizers. (But maybe I should. Hmm.)
* termcap: merge into termbptato2024-10-231-1/+29
| | | | | again, not that useful to put it in a separate module if only term uses it
* dynstream: refactorbptato2024-10-203-9/+7
| | | | | | | | | | * consistently use cint instead of FileHandle - this was another remnant of winapi support; on posix, they are the same. * move "blocking" field to PosixStream * recvFileHandle -> recvFd, sendFileHandle -> sendFd * merge serversocket into dynstream * merge auxiliary C functions into dynstream_aux
* dynstream, serversocket: use posix instead of nativesocketsbptato2024-10-203-6/+2
| | | | | | | | | | | nativesockets is a wrapper over posix and winapi, but we don't support winapi, so we can just fall back to PosixStream instead. SocketStream remains as a constraint over PosixStream to allow sendFileHandle/recvFileHandle. As a nice side effect, we can drop some allowed syscalls from the seccomp filter.
* 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