about summary refs log tree commit diff stats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* pager: remove useless codebptato2024-03-182-16/+1
|
* config: clean up/simplifybptato2024-03-1710-330/+349
| | | | | | | | | * 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
* Move SIGCHLD ignore call to forkserverbptato2024-03-172-4/+1
| | | | seems like it confuses popen()
* forkserver: set process titles for processesbptato2024-03-172-0/+42
| | | | | this is unfortunately truncated on Linux, but I don't care enough to hack around this
* main: ignore SIGCHLDbptato2024-03-171-0/+4
| | | | to avoid zombies
* client: fix "Hit any key" bug on load failurebptato2024-03-173-21/+45
| | | | it's an unintended side effect that we do not want
* pager: fix buffer filteringbptato2024-03-171-2/+4
|
* io: add BuferedWriterbptato2024-03-168-207/+310
| | | | | | | | | | Unsurprisingly enough, calling `write` a million times is never going to be very fast. BufferedWriter basically does the same thing as serialize.swrite did, but queues up writes in batches before sending them. TODO: give sread a similar treatment
* client, pager: various file saving fixesbptato2024-03-163-18/+22
| | | | | | * do not immediately quit when all containers are gone * fix double saving bug * fix wrong "save to" string
* pager: fix disappearing buffers when reload failsbptato2024-03-161-9/+8
| | | | | we do have logic for this in replace(), but it was not working because setContainer changed the buffer too early.
* container: fall back to text/plain instead of application/octet-streambptato2024-03-162-3/+5
| | | | | | | | | | | | | 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.)
* pager: simplify line editingbptato2024-03-162-64/+69
| | | | | * embed prompt string into enums * move pager.username to LineDataAuth
* pager, loader: add "Save file to" functionalitybptato2024-03-163-37/+128
| | | | | | | 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.
* layout: table column size fixesbptato2024-03-161-33/+20
| | | | | | | * remove unnecessarily duplicated code (probably a copy-paste error) * apply UNIT_PERC computed widths for table cells too (just base it on sizes the table receives) * remove unnecessary parameters in some procs
* loader: add missing flush() callsbptato2024-03-161-1/+4
| | | | | | | Seems wise to flush before e.g. reading. And unwise to enable buffering on tee() even though we disable it on startRequest()
* cgi: fix libexec dir not being setbptato2024-03-161-3/+4
|
* config: add start.console-buffer optionbptato2024-03-163-3/+5
| | | | useful for debugging
* container: cursor x fixesbptato2024-03-151-2/+4
| | | | | | * also set fromX to corrected target x if target x is less than corrected x; this is mainly so that setCursorX(-1) works as expected * return w from cursorFirstX() even if cursorx is <= the last character
* Clean up BufferConfigbptato2024-03-156-81/+73
| | | | | | | | 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.
* version: print error message on a single linebptato2024-03-141-4/+3
| | | | it's easier to see that it's a single message this way
* client: check if container was found before deleting itbptato2024-03-141-2/+2
| | | | | | Containers may also be deleted without a connection. More specifically: by mailcap, when it launches an external process without opening the output in a buffer.
* pager: unregister containers properly when headers are pendingbptato2024-03-143-14/+33
| | | | | It can happen that a container is deleted before it acquires a buffer process; add it to the `unreg' array in this case too.
* loader: handle connections where pid/key does not matchbptato2024-03-141-1/+8
| | | | | This can easily happen if a buffer process is killed and/or a new process takes its ID.
* cgi: fix broken pipe handlingbptato2024-03-141-1/+8
| | | | | if the socket is closed before the loader could send all header data, we must destroy the parser to avoid sending a result twice.
* Move around some modulesbptato2024-03-1421-96/+88
| | | | | | | | * extern -> gone, runproc absorbed by pager, others moved into io/ * display -> local/ (where else would we display?) * xhr -> html/ * move out WindowAttributes from term, so we don't depend on local from server
* pager: add "open in editor" keybinding (sE)bptato2024-03-145-76/+80
| | | | | | only for source for now, rendered document is a bit more complicated (also, get rid of useless extern/editor module)
* loader: only trap SIGTERMbptato2024-03-141-1/+1
| | | | SIGINT is trapped (well, ignored) by forkserver already.
* loader: fix crash on malformed CGI headersbptato2024-03-142-3/+2
| | | | | Setting istream to nil was preventing finishCycle from unregistering & closing it.
* twtstr: fix deleteChars, do not remove space in replaceControlsbptato2024-03-142-11/+7
|
* pager: use loadinfo for redirection message, not alertbptato2024-03-131-1/+2
| | | | | alert has a tendency to pile up redirection infos. This is annoying and may obscure the "too many redirections" error message.
* twtstr: simplify control char procsbptato2024-03-131-24/+7
|
* layout: remove word-spacingbptato2024-03-131-4/+1
| | | | this was a bad idea
* rudimentary support for <video>, <audio>bptato2024-03-136-9/+65
| | | | | we just treat them as img tags. lazy, but works suprisingly well -- so long as the server sends us a Content-Type, anyway.
* man: rewrite in Nimbptato2024-03-131-21/+22
| | | | | | | | | | | | Depending on Perl just for this is silly. Now we use libregexp for filtering basically the same things as w3mman2html did. This required another patch to QuickJS to avoid pulling in the entire JS engine, but in return, we can now run regexes without a dummy JS context global variable. Also, man.nim now tries to find a man command on the system even if it's not in /usr/bin/man.
* loader: fix nil deref in parseHeadersbptato2024-03-131-1/+1
|
* client: fix blocking reads on container connectionbptato2024-03-125-72/+123
| | | | | | | | | | | | | | | | Sometimes, headers take a while to reach us even after the result has been sent. e.g. echo 'Cha-Control: Connected' sleep 5 echo 'Cha-Control: ControlDone' ^ this froze the UI for 5 seconds, that's certainly not what we want. Since we don't have a proper buffered reader yet, and I don't want to write another disgusting hack like BufStream, we just use a state machine to figure out how much we can read. Sounds bad, but in practice it works just fine since loader's response patterns are very simple.
* loader: remove applyHeadersbptato2024-03-1210-134/+112
| | | | | | | 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.)
* posixstream: do not ignore lseek resultbptato2024-03-122-3/+8
|
* pager: fix replacement logicbptato2024-03-122-27/+32
| | | | | | | | | This is what the original replacement logic was supposed to do, except it was broken. The previous fix might have been worse than the original bug. Now we do it like this: * if needed, replace buffer in gotoURL * deleteContainer swaps back the buffer it replaced, if it still exists * on connection success, kill the buffer we replaced
* pager: decrement numload on redirectbptato2024-03-121-0/+1
| | | | because gotoURL will increment it
* io: add dynstreambptato2024-03-126-57/+95
| | | | | a new abstraction that we derive posixstream from; hopefully with time we can get rid of std/streams
* loader: unregister input streams on EOFbptato2024-03-121-2/+2
| | | | if recvData returns 0, it must be treated the same as a broken pipe.
* 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
* pager: do not eat error alerts on startupbptato2024-03-112-2/+1
| | | | | cetStatus is only called for soft status updates, not alerts (we have cetAlert for that)
* loader: rework process modelbptato2024-03-1124-1432/+1630
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* client: fix thumb button confusionbptato2024-03-111-18/+18
| | | | | | | | the 0x40 bitmask implies one more state than the 0 bitmask, since state 3 with 0 is unused[0]. so we must add 7, not 6 [0] it's reserved for "move", but movement is indicated differently in the protocol we use so unused
* css: fix {} macros on older Nim versionsbptato2024-03-111-6/+9
| | | | | old Nim chokes on unquoting enums without explicitly casting them to the target enum type.
* client: bind middle button to discardBuffer, use button5/6 as scrollbptato2024-03-112-5/+14
| | | | | | middle button to close is from w3m btn5/6 is normally a horizontal scroll wheel, so scrollLeft/Right makes more sense than prev/next
* client: only accept "press" input type for scroll wheelbptato2024-03-111-2/+6
|
* term: fix alt-screen = true without ti/tebptato2024-03-081-10/+11
| | | | | | in this case just write smcup/rmcup also move down +1 line and reset formatting if alt screen is off