about summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* http: do not use buffered stdiobptato2024-03-021-6/+9
| | | | | | | buffering output kind of defeats the purpose of the entire loader select machinery (we don't buffer streams either for the same reason)
* 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
|
* bonus/w3m.toml: emacs-style page-up/downbptato2024-03-011-4/+6
| | | | this is more or less how it works in w3m
* 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-013-31/+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-298-31/+202
|
* 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-283-11/+36
| | | | | | | 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-283-39/+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...)
* config: add yI for yanking image URLsbptato2024-02-272-2/+14
|
* dom: fix non-stylesheets being downloaded as stylesheetsbptato2024-02-271-0/+2
|
* buffer: add image viewer supportbptato2024-02-274-46/+65
|
* url: return correct resultbptato2024-02-271-1/+1
|
* misc refactoringsbptato2024-02-277-118/+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).
* buffer: reset prevStyled in switchCharset, reshapebptato2024-02-272-12/+8
| | | | | | | | reshape must do a render from zero, as it's a last resort for users to fixup the page on a rendering bug. switchCharset must reset prevStyled for obvious reasons (it refers to a dead document).
* Update Chagashibptato2024-02-262-1/+1
|
* pager: do not add replacement containersbptato2024-02-261-1/+3
| | | | | they will replace the target container on connection, so inserting them in a different place first results in strange navigation bugs
* buffer: clean up onload, fix console updatebptato2024-02-263-59/+51
| | | | | | | | | | | | * reduce onload result size to a single int * clean up mess that was the container onload handler This fixes automatic refresh in console. Before, the client would only request a screen update after receiving the number of bytes read, but before the screen was actually reshaped (which obviously resulted in a race condition). Now, "I've reshaped the document" is a separate response (and is the only occasion where the screen is updated before the final render).
* loader: clean up regular file loadingbptato2024-02-264-109/+106
| | | | | | | | | | | | | | | | | | | | * Get rid of sostream hack This is no longer needed, and was in fact causing loadStream to get stuck with redirects on regular files (i.e. the common case of receiving <file on stdin without a -T content type override). * Unify loading from cache and stdin regular file code paths Until now, loadFromCache was completely sync. This is not a huge problem, but it's better to make it async *and* not have two separate procedures for reading regular files. (In fact, loadFromCache had *another* bug related to its output fd not being added to outputMap.) * Extra: remove ansi2html select error handling It was broken, because it didn't handle read events before the error. Also unnecessary, since recvData breaks from the loop on n == 0.
* ansi2html: quote & toobptato2024-02-261-0/+1
| | | | whoops
* term: improve pixels-per-column/line detectionbptato2024-02-2517-370/+280
| | | | | | | | | Some terminal emulators (AKA vte) refuse to set ws_xpixel and ws_ypixel in the TIOCGWINSZ ioctl, so we now query for CSI 14 t as well. (Also CSI 18 t for good measure, just in case we can't ioctl for some reason.) Also added some fallback (optionally forced) config values for width, height, ppc, and ppl. (This is especially useful in dump mode.)
* Update docsbptato2024-02-251-8/+8
|
* ua.css: fix details element displaybptato2024-02-251-3/+3
| | | | no open/closed logic yet, but at least this fixes the display: property
* ua.css: use ANSI yellow for linksbptato2024-02-251-1/+1
| | | | | | | | | This was my original intention, but there wasn't a way to do it until now. The difference is that this respects user-configured color values. (Now that I think of it, it may be better to automatically detect prefers-color-scheme based on the default background color, and then use blue for bright backgrounds and yellow for dark backgrounds. Hmm.)
* buffer: remove incorrect assertionsbptato2024-02-251-3/+0
| | | | | `confidence' becomes ccCertain when PRES_STOP is returned, so asserting the opposite is incorrect (and was resulting in crashes).
* css: always use defaultColor as the initial colorbptato2024-02-251-7/+4
| | | | | | | | | | This way, we do not end up with ugly contrast-corrected white on terminals with arbitrary backgrounds by default. (Now we get the native -cha-ansi(default) instead). (We leave background-color as transparent; this should have the same effect, since defaultColor as bgcolor is ignored, but makes more sense (and will allow us to un-ignore defaultColor as bgcolor in the future.))
* Update todobptato2024-02-251-4/+0
|
* buffer: fix rewind with mailcap entriesbptato2024-02-254-10/+41
| | | | | | | | Cache mailcap entry output too, then delete it when the buffer can no longer read from it. (Maybe it would be useful to instead preserve it and allow viewSource for HTML output too? Hmm.)
* Separate ANSI text decoding from main binarybptato2024-02-2514-268/+587
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handling text/plain as ANSI colored text was problematic for two reasons: * You couldn't actually look at the real source of HTML pages or text files that used ANSI colors in the source. In general, I only want ANSI colors when piping something into my pager, not when viewing any random file. * More importantly, it introduced a separate rendering mode for plaintext documents, which resulted in the problem that only some buffers had DOMs. This made it impossible to add functionality that would operate on the buffer's DOM, to e.g. implement w3m's MARK_URL. Also, it locked us into the horribly inefficient line-based rendering model of entire documents. Now we solve the problem in two separate parts: * text/x-ansi is used automatically for documents received through stdin. A text/x-ansi handler ansi2html converts ANSI formatting to HTML. text/x-ansi is also used for .ans, .asc file extensions. * text/plain is a separate input mode in buffer, which places all text in a single <plaintext> tag. Crucially, this does not invoke the HTML parser; that would eat NUL characters, which we should avoid. One blind spot still remains: copiousoutput used to display ANSI colors, and now it doesn't. To solve this, users can put the x-ansioutput extension field to their mailcap entries, which behaves like x-htmloutput except it first pipes the output into ansi2html.
* dom: use AttrType in DOMTokenList supportsbptato2024-02-241-5/+3
|
* dom: check rel attribute for link tags before downloadbptato2024-02-241-1/+1
|
* Allow non-RGB colors in CSSbptato2024-02-248-180/+252
| | | | | | | | | | | The -cha-ansi color type now sets ANSI colors in CSS. Also, color correction etc. has been improved a bit: * don't completely reset output state in processFormat for new colors * defaultColor is now separated from ANSI color type 0 * bright ANSI colors are no longer replaced with bold + dark variant * replaced ANSI color map to match xterm defaults
* layout: make it compile attempt 2bptato2024-02-241-2/+2
| | | | aaaaaa
* layout: make it compilebptato2024-02-241-2/+2
| | | | :/
* Update todobptato2024-02-241-1/+4
|
* layout: make position: fixed, sticky act like staticbptato2024-02-241-7/+8
| | | | | | | | It's better to not implement them at all than to implement them badly. (In particular, making fixed act like absolute breaks horribly on websites that actually use it. Fixing it is not really possible without changinge the way we currently draw things to the screen.)