about summary refs log tree commit diff stats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* 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
* cgi: do not eat first word of the error messagebptato2024-03-071-1/+1
| | | | whoops
* cgi: pass system error message after execl failurebptato2024-03-071-1/+2
|
* buffer: fix bug of eating chars before invalid UTF-8bptato2024-03-051-2/+2
| | | | | | | using this API is suffering (`n' is the last *valid* character ever since the validator API got fixed, so it must be included in the slice.)
* pager: clear status message when opening external viewersbptato2024-03-041-0/+2
| | | | it used to leave "Connecting..." on the screen
* css: simplify property & value definitionsbptato2024-03-041-266/+272
| | | | having to manually add them to a million places is annoying
* catom: merge TagType with AttrTypebptato2024-03-046-112/+133
| | | | | it's inefficient and pointless to treat them differently, so just derive a new enum from TagType with a macro
* dom: use relList for stylesheet checksbptato2024-03-042-10/+17
|
* dom: misc fixesbptato2024-03-042-6/+41
| | | | | | | | * parse XHR URL with document base URL * allow setting XHR responseType * add tagName, nodeName * make hasChildNodes a function * fix horribly broken insertNode
* loader: fix crash on cha </dev/nullbptato2024-03-031-1/+3
| | | | | | | | | not a very useful operation, but crashing on it is definitely not the correct reaction (hyperfine does this for example. though in that case it's still better to turn it off, otherwise Chawan will pointlessly open a new buffer for it...)
* strwidth, renderdocument: small refactoringbptato2024-03-035-124/+96
| | | | | | * put attrs pointer in state * simplify width() * use unsigned int as ptint to avoid UB
* Update chamebptato2024-03-031-1/+1
|
* buffer: improve/fix onload return valuesbptato2024-03-033-20/+30
| | | | | | | | | Only report when bytesRead has changed, otherwise we get unnecessary load requests. (This means -2 return value no longer exists; it did not work correctly anyway.) Also, fix the race condition that broke onload returns when onload happened before client requested load.
* quickjs: reduce diff with upstreambptato2024-03-025-20/+18
| | | | | | * the uint8array thing is probably from txiki.js, but we never used it * upstream now has JS_GetClassID, importing that instead... (so this commit won't build :/)
* cssparser: fix another anb parsing bugbptato2024-03-021-2/+2
| | | | obviously for ident tokens we must check value, not unit
* container: fix off-by-one error in scrollDownbptato2024-03-021-1/+1
|
* env: add window.screenbptato2024-03-022-1/+25
|
* cssparser: fix anb parser whitespace handling bugsbptato2024-03-021-4/+7
| | | | | * skip whitespace in some places where we didn't but should * fix crash in get_tok when eof comes after whitespace
* layout: add whitespace width to end offset's x positionbptato2024-03-021-0/+4
| | | | | | | | so that e.g. a<span style="background-color: red"> </span>b makes the span width exactly one space.
* layout: fix float exclusion of other floatsbptato2024-03-021-2/+2
| | | | | | | | | | | | | | | > The right outer edge of a left-floating box may not be to the right > of the left outer edge of any right-floating box that is next to > it. Analogous rules hold for right-floating elements. says the standard therefore it does not really matter where the beginning of the float is; if it's float: left, then `left' must be set to the right edge, and if it's float: right, then `right' must be set to the left edge. (this was breaking some negative margin float abominations such that floats were suddenly overlapping and that's certainly not what we want)
* cgi: fix regression in header handlingbptato2024-03-021-5/+8
| | | | it's a good idea to use the return value, but it must substitute atEnd.
* posixstream: add readLine implementationbptato2024-03-022-7/+22
| | | | | slightly more efficient, but more importantly does not choke on NUL and weird \r\n
* buffer: do not incrementally display in headless modebptato2024-03-022-3/+6
|
* container: fix cursorLineBegin/cursorLineTextStart with vertical scrollbptato2024-03-011-1/+3
| | | | | | setCursorX only moves the screen backwards if the intended X position is lower than the actual X position. Pass it -1 so that this is true even with zero-width lines.
* css: remove caption-side: left, right, fix caption-side: bottombptato2024-03-012-23/+3
| | | | | | | | left/right never really worked correctly, is non-standard, and the only browser that supported it (Firefox) removed it years ago. bottom was adding the table width to its offset instead of the height, that is now fixed.
* dom: fix canvas element crashbptato2024-03-011-2/+3
|
* css/values: assign to the correct variablebptato2024-03-011-6/+6
|
* buffer, client: fix deadlock with send() callsbptato2024-02-296-24/+104
| | | | | | | | | | This is an ancient bug, but it got much easier to trigger with mouse scrolling support so it's time to fix it. (The bug itself was that since both the client and buffer ends of the controlling stream are blocking, they could get stuck when both were trying to send() data to the other end but the buffer was full. So now we set the client end to non-blocking.)
* css: fix shorthands not overriding all valuesbptato2024-02-291-29/+32
| | | | background & list-style did not override unspecified values
* Add mouse supportbptato2024-02-295-31/+193
|
* pager: fix gotoURL crashingbptato2024-02-291-0/+1
| | | | | should finally convert the code to strictDefs, implicit result is a horrible footgun
* layout: reduce useless empty lines in inline boxesbptato2024-02-291-10/+17
| | | | | | | | | | | | | | If we are going to round things in layout, let's do it properly. Adding fake height has negative utility (things get more annoying to read), so now we don't. TODO: finding the correct positioning of the baseline after adding padding is an open question. Probably have to revise the algorithm somewhat to get it right. (This should also fix the bug where error correction would make inline box backgrounds shift into unrelated text, causing much confusion for the reader.)
* pager: improve URL loading procsbptato2024-02-281-5/+14
| | | | | | | Split up load into loadSubmit, gotoURL: loadSubmit is a replacement for load(s + '\n'), and gotoURL is a load that does no URL expansion. Also, fix a bug where load("\n") would crash the browser.
* layout: round atom offsets toobptato2024-02-282-10/+13
| | | | | it is useful to round them so that they don't get positioned somewhere in the middle of a line (which is rounded to the same precision as well)
* layout: improve/simplify line box error correctionbptato2024-02-282-36/+17
| | | | | | | | | | | | The previous retrofitting of the old renderdocument error correction usually worked, but it still had a horrible flaw in that it assumed that all line boxes are of equal height. So if error was lower for some line than another, it would move *all* lines by a somewhat lower error, and that resulted in overlapping lines. Now we do something much simpler: in flushLine, round each line's height downwards before moving on to the next line. This gets rid of any blanks inbetween lines, and also works much better with cleared floats.
* container: fix cursor positioning bugsbptato2024-02-281-6/+24
| | | | | | | | | * fix cursor jumping back to the start of the line (instead of the end of the line) when it is outside the viewport and a leftwards update is requested * save setxsave too when line is not loaded yet * always set needslines in onMatch when hlon (this was causing a blank screen when incremental search was jumping around in large documents)
* Fix tab size bug on double tabsbptato2024-02-271-4/+4
| | | | | | | | | | It is in fact quite simple to calculate: charwidth is the width of printing characters until now, and whitespacenum the number of (non-flushed) spaces. So we just have to subtract this from the target width to get the number of spaces missing from the next tab stop. (Of course, it gets much harder to understand when the whole thing is formatted as a convoluted multi-line equation...)
* dom: fix non-stylesheets being downloaded as stylesheetsbptato2024-02-271-0/+2
|
* buffer: add image viewer supportbptato2024-02-272-46/+62
|
* url: return correct resultbptato2024-02-271-1/+1
|
* misc refactoringsbptato2024-02-275-95/+45
| | | | | | * rename buffer enums * fix isAscii for char 0x80 * remove dead code from URL
* loader: fix early return in handleReadbptato2024-02-272-30/+29
| | | | | | | | Ensure that a) dead outputs do not continue to get more data from istream and b) if all outputs are dead, istream is immediately closed. Also, remove that pointless loop in loadStreamRegular (it did nothing that handleRead did not).