about summary refs log tree commit diff stats
path: root/src/config
Commit message (Collapse)AuthorAgeFilesLines
* 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
* color: separate out JS convertersbptato2024-05-051-0/+1
| | | | | ansi2html depends on color, but we definitely do not want to link it to QJS, so the converters must be moved into a separate module.
* Use isSome instead of isOkbptato2024-05-051-2/+2
| | | | no point in having identical overloads
* js: fix various leaks etc.bptato2024-05-032-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously we didn't actually free the main JS runtime, probably because you can't do this without first waiting for JS to unwind the stack. (This has the unfortunate effect that code now *can* run after quit(). TODO: find a fix for this.) This isn't a huge problem per se, we only have one of these and the OS can clean it up. However, it also disabled the JS_FreeRuntime leak check, which resulted in sieve-like behavior (manual refcounting is a pain). So now we choose the other tradeoff: quit no longer runs exitnow, but it waits for the event loop to run to the end and only then exits the browser. Then, before exit we free the JS context & runtime, and also all JS values allocated by config. Fixes: * fix `ad' flag not being set for just one siteconf/omnirule * fix various leaks (since leak check is enabled now) * use ptr UncheckedArray[JSValue] for QJS bindings that take an array * allow JSAtom in jsgetprop etc., also disallow int types other than uint32 * do not set a destructor for globals
* config: add insecure-ssl-no-verify option to siteconfbptato2024-05-011-0/+1
| | | | | | | Equivalent to curl --insecure. Note: unfortunately this does not help if the server is using unsafe legacy renegotiation, you have to allow that in the OpenSSL config.
* color: RGBAColor -> ARGBColorbptato2024-04-261-4/+4
|
* Initial image supportbptato2024-04-251-0/+4
| | | | | | | | | | | | | | | | | * png: add missing filters, various decoder fixes * term: fix kitty response interpretation, add support for kitty image detection * buffer, pager: initial image display support Emphasis on "initial"; it only "works" with kitty output and PNG input. Also, it's excruciatingly slow, and repaints images way too often. Left undocumented intentionally it for now, until it actually becomes useful. In the meantime, adventurous users can find out themselves why: [[siteconf]] url = "https://.*" images = true
* js: fix some incorrect defineProperty usagebptato2024-04-211-2/+3
| | | | It consumes a value, so we must dup those that we pass.
* url, twtstr: correct number parsingbptato2024-04-181-10/+7
| | | | | | | | | * do not use std's parse*Int; they accept weird stuff that we do not want to accept in any case * fix bug in parseHost where a parseIpv4 failure would result in an empty host * do not use isDigit, isAlphaAscii * improve parse*IntImpl error handling
* Update code stylebptato2024-04-174-72/+69
| | | | | | * separate params with ; (semicolon) instead of , (colon) * reduce screaming snake case use * wrap long lines
* js: remove automatic function -> closure conversionbptato2024-04-151-8/+14
| | | | | | | | | | | | | | | It's a bad idea for several reasons: * it's inefficient; must allocate an environment for a closure in Nim, even though we already have one in JS * writing macros for automatically creating functions with variadic arguments is suprisingly difficult (see the entire `js/javascript' module) * it never really worked properly, because we never freed the associated function pointer. We hardly used it anyway, so the easiest fix is to get rid of it completely.
* pager: edit source fixesbptato2024-03-301-44/+48
| | | | | | | * URI-decode path name for local files in default config * (ab)use mailcap command quoting for passing params to editor command instead of replicating it badly in formatEditorName * rename mailcap enums
* ansi2html: support passing titlesbptato2024-03-291-0/+1
| | | | | | | Use content type attributes so e.g. git.cgi can set the title even with a text/x-ansi content type. (This commit also fixes some bugs in content type attribute handling.)
* config: improve input systembptato2024-03-262-6/+91
| | | | as described in <https://todo.sr.ht/~bptato/chawan/6>
* config, toml: rename enumsbptato2024-03-262-101/+101
|
* js: proper distinction between Opt/Optionbptato2024-03-241-34/+45
| | | | | | | | | | | | | | | | until now, this had very strange (and inconsistent) semantics: * err() was used for exception propagation, but also as a null value * Option accepted undefined as a none value, but not null * Opt and Option were used interchangeably (and mostly randomly) Now, Result is always used for error reporting, and err(nil) means JS_EXCEPTION. (Opt is a special case of Result where we don't care about the error type, and is not used in JS.) Option on the other hand means "nullable variation of normally non-nullable type", and translates to JS_NULL. In JS we mainly use it for turning strings nullable.
* config: add default-headers to siteconfbptato2024-03-211-14/+2
| | | | | | | So long as we have to live with siteconf, let's at least make it useful. Also, rewrite the header overriding logic because while it did work, it only did so accidentally.
* cell: update FormatFlag naming, remove useless templatesbptato2024-03-211-7/+7
|
* main: refactor slightlybptato2024-03-211-0/+3
| | | | | | * put forkServer into main() * use a ctx type instead of closures * get rid of types/opt import
* main: set CHA_LIBEXEC_DIR env var at startupbptato2024-03-191-15/+5
| | | | This way, we can use it everywhere (e.g. in mailcap).
* config: parse mime.types/mailcap/urimethodmap inside parseConfigbptato2024-03-182-85/+67
| | | | | | Better (and simpler) than storing them all over the place. extra: change lmDownload text to match w3m
* config: clean up/simplifybptato2024-03-173-243/+294
| | | | | | | | | * Parse the default config at runtime. There's no significant performance difference, but this makes it much less painful to write config code. * Add better error reporting * Make fromJS2 easier to use * Unquote ChaPaths while parsing config
* pager, loader: add "Save file to" functionalitybptato2024-03-161-7/+1
| | | | | | | As simple as it could be; no download panel yet. Also, remove the xdg-open default mailcap entry; it's better to just save by default.
* config: add start.console-buffer optionbptato2024-03-161-0/+1
| | | | useful for debugging
* Clean up BufferConfigbptato2024-03-151-43/+0
| | | | | | | | It was defined in the wrong module, and unnecessarily included LoaderClientConfig. Also, referrerPolicy was not being propagated to loader clients because it was (incorrectly) in BufferConfig instead of LoaderClientConfig.
* loader: remove applyHeadersbptato2024-03-121-41/+18
| | | | | | | Better compute the values we need on-demand at the call sites; this way, we can pass through content type attributes to mailcap too. (Also, remove a bug where applyResponse was called twice.)
* mailcap: better error messages, accept \ as newline escapebptato2024-03-111-6/+18
| | | | the backslash thing is in the RFC, I just forgot to add it