about summary refs log tree commit diff stats
path: root/src/utils
Commit message (Collapse)AuthorAgeFilesLines
* forkserver: set process titles for processesbptato2024-03-171-0/+38
| | | | | this is unfortunately truncated on Linux, but I don't care enough to hack around this
* container: fall back to text/plain instead of application/octet-streambptato2024-03-161-2/+3
| | | | | | | | | | | | | This has its own problems, but application/octet-stream has the horrible consequence that opening any local file with an unrecognized type automatically quits the browser. (FWIW, w3m also falls back to text/plain, so it's not such an unreasonable default.) The proper solution would be to a) fix the bug that makes the browser auto-quit and b) show a "what to do" prompt for unrecognized file types (and allow users to override it, preferably on a per-protocol basis.)
* twtstr: fix deleteChars, do not remove space in replaceControlsbptato2024-03-141-6/+6
|
* twtstr: simplify control char procsbptato2024-03-131-24/+7
|
* loader: remove applyHeadersbptato2024-03-122-11/+29
| | | | | | | 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.)
* loader: rework process modelbptato2024-03-111-62/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally we had several loader processes so that the loader did not need asynchronity for loading several buffers at once. Since then, the scope of what loader does has been reduced significantly, and with that loader has become mostly asynchronous. This patch finishes the above work as follows: * We only fork a single loader process for the browser. It is a waste of resources to do otherwise, and would have made future work on a download manager very difficult. * loader becomes (almost) fully async. Now the only sync part is a) processing commands and b) waiting for clients to consume responses. b) is a bit more problematic than a), but should not cause problems unless some other horrible bug exists in a client. (TODO: make it fully async.) This gives us a noticable improvement in CSS loading speed, since all resources can now be queried at once (even before the previous ones are connected). * Buffers now only get processes when the *connection* is finished. So headers, status code, etc. are handled by the client, and the buffer is forked when the loader starts streaming the response body. As a result, mailcap entries can simply dup2 the first UNIX domain socket connection as their stdin. This allows us to remove the ugly (and slow) `canredir' hack, which required us to send file handles on a tour accross the entire codebase. * The "cache" has been reworked somewhat: - Since canredir is gone, buffer-level requests usually start in a suspended state, and are explicitly resumed only after the client could decide whether it wants to cache the response. - Instead of a flag on Request and the URL as the cache key, we now use a global counter and the special `cache:' scheme. * misc fixes: referer_from is now actually respected by buffers (not just the pager), load info display should work slightly better, etc.
* strwidth, renderdocument: small refactoringbptato2024-03-032-45/+26
| | | | | | * put attrs pointer in state * simplify width() * use unsigned int as ptint to avoid UB
* misc refactoringsbptato2024-02-271-13/+1
| | | | | | * rename buffer enums * fix isAscii for char 0x80 * remove dead code from URL
* regex: re-work compileSearchRegexbptato2024-02-171-0/+16
| | | | | | | I've gotten tired of not being able to search for forward slashes. Now it works like in vim, and you can also set default ignore case in the config.
* widthconv: bugfixesbptato2024-02-111-25/+11
| | | | | | | * fix failed assertion on non-ha-column half-width chars followed by handakuten with text-transform: full-width * fix dquot full-width conversion * fix lone half-width han/dakuten conversion
* twtstr: misc refactoringsbptato2024-02-092-141/+150
| | | | | | * move out half width <-> full width converters * snake_case -> camelCase * improve toScreamingSnakeCase slicing
* mimetypes: simplify parseMimeTypesbptato2024-01-271-0/+6
| | | | | * use functions like until * do not call atEnd for every line, use boolean readLine instead
* Re-design word handling, add e, E, W, B, etc.bptato2024-01-191-11/+19
| | | | | | | | | | | | * Add functions for moving to the beginning/end of words (vi `b', `e'). * As it turns out, there are many possible interpretations of what a word is. Now we have a function for each reasonable interpretation, and the default settings match those of vi (and w3m in w3m.toml). (Exception: it's still broken on line boundaries... TODO) * Remove `bounds` from lineedit, it was horrible API design and mostly useless. In the future, an API similar to what pager now has could be added. * Update docs, and fix some spacing issues with symbols in the tables.
* utils/map: remove unused special casebptato2024-01-171-3/+0
| | | | Even if it were used, it's UB...
* Add urlenc, urldec; fix a URL encoding bug; improve trans.cgibptato2024-01-081-12/+18
| | | | | | | | | | * Fix incorrect internal definition of the fragment percent-encode set * urlenc, urldec: these are simple utility programs mainly for use with shell local CGI scripts. (Sadly the printf + xargs solution is not portable.) * Pass libexec directory as an env var to local CGI scripts * Update trans.cgi to use urldec and add an example for combining it with selections
* Use std/* imports everywherebptato2024-01-073-15/+15
|
* charwidth: use pre-generated map filebptato2024-01-042-136/+42
| | | | Also for reducing compilation time.
* Compile with styleCheck:usagesbptato2023-12-281-1/+1
| | | | much better
* strwidth & url fixesbptato2023-12-162-4/+4
| | | | | | * actually search Combining for isCombining * fix searchInMap * fix cmpRange of url
* charcategory: move out isDigitAsciibptato2023-12-143-6/+4
| | | | so we do not have to import unicode
* Various fixesbptato2023-12-132-37/+46
| | | | | | | * Makefile: fix parallel build, add new binaries to install target * twtstr: split out libunicode-related stuff to luwrap * config: quote default gopher2html URL env var for unquote * adapter/: get rid of types/url dependency, use CURL url in all cases
* break up twtstr somewhatbptato2023-12-134-372/+274
| | | | | Avoid computing e.g. charwidth data for http which does not need it at all.
* twtstr: import functions from gopher2htmlbptato2023-12-121-15/+10
|
* css: add case-insensitive matchingbptato2023-12-111-0/+14
| | | | Also case-sensitive, but for now that is the same as normal matching...
* css: add text-transformbptato2023-12-111-3/+113
| | | | | | | Probably not fully correct, but it's a good start. Includes proprietary extension -cha-half-width, which converts full-width characters to half-width ones.
* config: better path handling; fix array parsing bugbptato2023-12-101-1/+1
| | | | | | | | | * Paths are now parsed through an unified code path with some useful additions like environment variable substitution. * Fix a bug in parseConfigValue where strings would be appended to existing arrays (and not override them). * Fix beforeLast calling afterLast for some reason. * Add a default CGI directory.
* html: add HTMLElement.dataset (+ some twtstr cleanup)bptato2023-12-011-11/+19
|
* twtstr: simplify expandPathbptato2023-11-291-19/+12
|
* twtstr: remove tolower, isWhitespacebptato2023-11-201-18/+4
| | | | | | | | * tolower: strutils toLowerAscii is good enough for the cases where we need it. Also, it's easy to confuse with unicode toLower and vice versa. * isWhitespace: in AsciiWhitespace is more idiomatic. Also has a naming collision with unicode toLower.
* Add -C optionbptato2023-10-271-0/+7
|
* warn on eprint in release modebptato2023-10-211-1/+9
| | | | Maybe it's easier to avoid accidentally including like this
* twtstr: optimize widthbptato2023-10-011-34/+17
|
* Add urimethodmap supportbptato2023-09-301-4/+2
| | | | yay
* remove sequtils dependencybptato2023-09-241-3/+5
|
* ftp: encode paths, escape displayed stringsbptato2023-09-191-0/+17
| | | | avoid e.g. # being interpreted as a fragment
* term: simplify/cleanupbptato2023-09-181-0/+9
|
* twtstr: remove unused functionsbptato2023-09-181-22/+0
| | | | lineedit no longer needs these
* lineedit: rewritebptato2023-09-181-0/+22
| | | | | | | | | | | | | | | | The old lineedit system worked quite well in the original synchronous model. However, because it needs access to the terminal, it has been subtly broken ever since buffer updates are allowed while the user is in line edit mode. This is best observed in incremental search, where searching for a bgcolor'ed text would result in the bgcolor bleeding into the line editor box. The new version is much simpler, and therefore less optimized. But it can still take advantage of output optimization in the terminal controller, and it is free of races (because we simply query the current state from the pager and feed it into the main output grid).
* data urls: percent decodebptato2023-09-151-2/+2
|
* Fix compilation with --assertions:offbptato2023-09-151-1/+2
| | | | | Remove side effects from assert statements. The flag is not used currently, but let's not depend on that.
* remove radixtreebptato2023-09-141-195/+0
| | | | only used in chame
* move around more modulesbptato2023-09-143-111/+2
| | | | | | | | | | * ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
* twtstr: simplifybptato2023-09-131-11/+5
| | | | | | * remove unused function isAlphaAscii * swap pushHex for less casting * remove == overload for char/rune (we did not really use it anyway)
* twtstr: remove some unused procsbptato2023-09-071-22/+0
| | | | | | | * substr for Rune with 1 param: gone, ideally the other should be removed too * clearControls: gone, not used anymore. * split for Rune: gone, not used anymore.
* twtstr: remove toLowerAscii2bptato2023-09-071-15/+0
|
* javascript: refactorbptato2023-08-281-2/+2
| | | | | | | Split out parts of the JS module, because it was starting to confuse the compiler a little. (Peakmem is back at 750M. Interesting.)
* Add mailcap, mime.types & misc refactoringsbptato2023-08-131-0/+48
| | | | | | | | * add mailcap: works with copiousoutput, needsterminal, etc. * add mime.types (only works with mailcap) * refactor pipeBuffer * remove "dispatcher" * fix bug in directory display where baseurl would not be used
* css: implement case insensitivitybptato2023-08-101-8/+0
| | | | For some reason I forgot about this.
* Fixes & workarounds to compile on Nim 2.0.0bptato2023-08-011-2/+4
| | | | | | | | | | | | | | * Import punycode, as it has been removed from stdlib. * Fix some syntax errors * Apparently you can no longer compare distinct pointers with nil. Add explicit comparisons with typeof(nil) instead. * htmlparser: rename _ to other, as semantics of _ have changed. (Quite a shame, it looked better with _. Oh well.) * Explicitly specify mm:refc, as the browser OOMs with orc for some reason. Confirmed to compile & run on 2.0.0, 1.6.14, 1.6.12, 1.6.10 and 1.6.8. (<1.6.8 it's broken & wontfix.)
* Fix twtstr.cmpbptato2023-07-281-2/+2
| | | | We were comparing the wrong sides of ranges here.