about summary refs log tree commit diff stats
path: root/src/config
Commit message (Collapse)AuthorAgeFilesLines
...
* default(T) -> T.default, add some strict defsbptato2024-12-172-4/+4
|
* chabookmark fixes & improvementsbptato2024-12-152-24/+20
| | | | | | | | * correct action on M-b * add external.bookmark option * move openFileExpand functionality into unquote * add menu items * update docs
* mimetypes: use cmpIgnoreCase for JS typesbptato2024-12-121-1/+1
|
* mailcap: misc bugfixes & cleanupbptato2024-12-121-63/+43
| | | | | | | | | | | * fix broken newline skipping logic in consume * remove reconsume char buffer (it's not needed with mmap) * pass on backslash to unquote - this makes backslashes in unquoteCommand work as expected (since it parses the command again) * close ps on write failure * add entries even before parse error - this drops a pointless copy of mailcaps. (we could theoretically just use old behavior without the copy, but this feels more intuitive anyway)
* pager: do not prompt for text typesbptato2024-12-111-0/+3
| | | | we hadn't before, and it's annoying when using cha as a pager
* pager, mailcap: misc fixes, add prompt for global mailcapbptato2024-12-112-54/+111
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix casingbptato2024-12-051-3/+3
|
* config, mailcap: remove std/streams dependency, specialize mmapbptato2024-12-052-76/+74
| | | | | | | | | | * 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-44/+94
| | | | | | | | | | | | * 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.
* toml, config: skip copying buf, use PosixStreambptato2024-12-032-115/+124
| | | | | | | one std/streams less I used mmap for reading the user config. It shouldn't matter in any realistically sized config, but who knows.
* config: add copy-cmd, paste-cmdbptato2024-12-011-0/+2
| | | | ref. https://todo.sr.ht/~bptato/chawan/29
* twtstr: add mypairsbptato2024-11-281-1/+1
| | | | | This couldn't get into system.nim for technical reasons, but it's still pretty useful when iterating over non-mutable openArrays.
* mailcap: add x-needsstyle extension fieldbptato2024-11-271-0/+1
| | | | | | | 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
* config.configdir -> config.dirbptato2024-11-261-1/+1
|
* loader/* -> serverbptato2024-11-241-1/+1
| | | | one less mystery
* Update monoucha, fix some JS testsbptato2024-11-181-1/+1
|
* js: reorganize modules, update docsbptato2024-11-152-2/+86
| | | | | | | most of it has already been moved to monoucha, and the rest fits better in other directories. also, move urimethodmap to config
* chapath: fix a few more bugs, simplifybptato2024-11-131-64/+30
| | | | | | | | | * fix incorrect :- behavior * merge non-standard '${%VARIABLE}' syntax with regular syntax; now all internal variables are exported to the environment, so the behavior should be equivalent. * handle terminal symbol appropriately in all states * deny numeric curly substitutions
* config: resolve download-dir as path, update docsbptato2024-11-131-1/+1
| | | | | | | 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.
* config.toml: respect TMPDIRbptato2024-11-121-6/+10
| | | | | also, fix a bug in the chapath parser so that param expansion actually works
* utils, types: merge some modulesbptato2024-11-031-1/+0
| | | | | * line, vector, matrix -> path * twtuni, charcategory -> twtstr
* config: fix relative includes with -Cbptato2024-10-311-2/+3
|
* config: refactor, accept more possible config dirsbptato2024-10-281-71/+35
| | | | | | | | | | | | | | | | | | | | | 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: refactor mailcap, console; misc fixesbptato2024-10-141-8/+7
| | | | | | | | | * 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-5/+0
| | | | | * remove unused DateTime toml type * add parseIntP for pointer-size int parsing
* gmifetch: rewrite in Nimbptato2024-10-122-45/+32
| | | | | | | | | | This finally makes it possible to use socks5 for Gemini. Also slightly refactored the config, to make it easier to pass on the config dir. By the way, the known_hosts file is now stored in the config dir too. The adapter will try to move it to there from the old location.
* toml: fix casingbptato2024-09-211-12/+12
|
* dom: add forms, elements getter + misc fixesbptato2024-09-171-3/+0
| | | | | | | | | | | | * 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
* config: add display.sixel-colorsbptato2024-09-101-0/+1
|
* utils: add twtunibptato2024-09-081-4/+4
| | | | | | | | | | | | | | | | | | | 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.
* mailcap: fix weird error handlingbptato2024-08-131-19/+13
| | | | | | * don't accept flags specified as named fields * don't error out on named field specified as flag * allow trailing whitespace on named fields & flags
* mailcap: various fixesbptato2024-08-111-38/+27
| | | | | | * parse last line even if it doesn't end with LF * parse flags & named fields case-insensitively * update naming
* dom: remove generic JS bindingsbptato2024-08-111-2/+2
| | | | Dispatch manually with fromJS instead.
* Update monouchabptato2024-08-092-7/+4
|
* buffer, pager, config: add meta-refresh + misc fixesbptato2024-07-281-49/+30
| | | | | | | | | * buffer, pager, config: add meta-refresh value, which makes it possible to follow http-equiv=refresh META tags. * config: clean up redundant format mode parser * timeout: accept varargs for params to pass on to functions * pager: add "options" dict to JS gotoURL * twtstr: remove redundant startsWithNoCase
* config: support smart casebptato2024-07-161-1/+1
| | | | and enable it by default.
* fix compilation on 2.0.8bptato2024-07-101-3/+8
|
* config: add buffer.autofocusbptato2024-07-041-0/+1
| | | | Same as [[siteconf]] autofocus.
* config: add various missing optionsbptato2024-06-291-0/+11
| | | | | | | Mainly things you could already set with [[siteconf]] but not normally. Also, a `styling' option to disable author styles. Also, `images' is now documented as an "experimental" option, since it's halfway usable now.
* config: fix JS command definitionsbptato2024-06-231-1/+1
|
* misc cleanupsbptato2024-06-221-2/+1
|
* buffer: add autofocusbptato2024-06-081-0/+1
| | | | naturally, it's opt-in
* pager, buffer: improve forms, protocol configbptato2024-06-081-2/+19
| | | | | | * refactor form submission * add options to specify form handling per protocol * block cross-protocol POST requests
* Move JS wrapper into Monouchabptato2024-06-032-12/+13
| | | | Operation "modularize Chawan somewhat" part 3
* config: fix -C with files not in CWDbptato2024-05-311-5/+13
|
* config: separate tmp dir for sockets, usersbptato2024-05-161-10/+1
| | | | | | | * add $LOGNAME to the tmp directory name, so that tmpdirs of separate users don't conflict * use separate directory for sockets, so that we do not have to give buffers access to all cached pages
* pager: editor command fixesbptato2024-05-121-1/+2
|
* js: allow var instead of ptrbptato2024-05-121-15/+15
|
* term: optimize canvas redraw, remove emulate-overlinebptato2024-05-101-1/+0
| | | | | | | * Replaced the `pcanvas' comparison with a much simpler tracking of the first damaged cell in writeGrid, which is significantly faster. * Removed emulate-overline: it's of too little utility compared to the maintenance burden it caused.
* js: refactorbptato2024-05-082-4/+4
| | | | | | | * prefix to-be-separated modules with js * remove dynstreams dependency * untangle from EmptyPromise * move typeptr into tojs