about summary refs log tree commit diff stats
path: root/src/local/pager.nim
Commit message (Collapse)AuthorAgeFilesLines
* pager: enable wait in runMailcapWritePipebptato2024-02-141-1/+1
| | | | | | Otherwise, container will just happily kill the buffer and with it the loader process before it would have had the chance to stream out the input into the external process.
* Various refactorings & fixesbptato2024-02-141-1/+1
| | | | | | | | * disallow Stream interface usage on non-blocking PosixStreams * do not read estream of forkserver byte-by-byte (it's slow) * do not call writeData with a zero len in formdata * do not quote numbers in mailcap quoteFile * remove some unused stuff
* pager: reduce boilerplatebptato2024-02-141-33/+20
| | | | also spawn less processes in some cases
* pager: warn on protocol switching redirectsbptato2024-02-141-4/+16
| | | | TODO should be configurable
* container: allow dismissing loadinfobptato2024-02-131-2/+3
| | | | it broke line info in console since it's never fully loaded
* buffersource: remove location fieldbptato2024-02-121-17/+19
|
* Add pager.externFilterSourcebptato2024-02-121-6/+62
| | | | useful for filtering stuff through commands like rdrview
* Remove CLONE BufferSource; cache document sources in tmpdirbptato2024-02-121-32/+14
| | | | | | | | | | | | | | | | | | | | | | | At last all BufferSources are unified. To achieve the same effect as the previous CLONE source type, we now use the "fromcache" flag in Request. This *forces* the document to be streamed from the disk; if the file no longer exists for some reason, an error is returned (i.e. the document is not re-downloaded). For a document to be cached, it has to be the main document of the buffer (i.e. no additional resources requested with fetch()), and also not an x-htmloutput HTML file (for those, the original source is saved). The result is that toggleSource now always returns the actual source for e.g. markdown files, not the HTML-transformed version. Also, it is now possible to view the source of a document that is still being downloaded. buffer.sstream has almost been eliminated; it still exists, but only as a pseudo-buffer to interface with EncoderStream and DecoderStream. It no longer holds the entire source of a buffer at any point, and is cleared as soon as the buffer is completely loaded.
* pager: fix discardTreebptato2024-02-111-4/+6
|
* Get rid of LOAD_PIPE BufferSourcebptato2024-02-111-11/+13
| | | | | Instead, use a stream: scheme and associate hostnames with file descriptors directly from the pager.
* pager: use 644 mask for mailcap temp filesbptato2024-02-101-2/+2
|
* pager: display precnum *and* inputBuffer when precnum != 0bptato2024-02-011-3/+1
| | | | Previously we were overwriting it, and that looked a little strange.
* forkserver: clean upbptato2024-01-291-5/+2
| | | | | Move forkBuffer into forkserver (why was it in container anyway), remove unused mainproc variable, etc.
* Remove newFormatbptato2024-01-231-6/+5
| | | | Pointless; it just returned a default zero-initialized object.
* js: merge some type modules into jstypesbptato2024-01-111-1/+1
| | | | They only had type definitions, no need to put them in separate modules.
* pager: simplify updateReadLinebptato2024-01-111-14/+16
|
* Fix windowChange not refreshing valid media queriesbptato2024-01-101-0/+2
| | | | | | | | * css/cascade: copy stylesheet in applyMediaQuery (so that changes are reverted on re-style) * buffer: clear prevstyled in windowChange (to avoid using cached results from previous cascading passes); set window.attrs * pager: avoid windowChange if new attrs are identical to the old ones
* Use std/* imports everywherebptato2024-01-071-9/+9
|
* Set cgiDir for client loader processbptato2024-01-061-1/+1
|
* Fix some casing issuesbptato2024-01-061-2/+2
|
* Compile with styleCheck:usagesbptato2023-12-281-3/+3
| | | | much better
* Fix warnings on Nim 2.0.2bptato2023-12-241-2/+1
| | | | | | | | One is a false-positive (in dom). The other one in pager is something I hadn't noticed before, that's nice. For now I want to avoid making a change that may break things, so I just removed the dead code.
* config: allow overriding default prepended schemebptato2023-12-151-2/+3
|
* Implement local CGI error message handlingbptato2023-12-151-3/+1
| | | | | | This was documented, but not implemented until now. Also, improve the loader module's protocol documentation.
* container: track ishtml statusbptato2023-12-151-1/+1
| | | | | This way we can at least view HTML source of x-htmloutput filtered buffers. TODO: make it render the actual source instead.
* break up twtstr somewhatbptato2023-12-131-0/+1
| | | | | Avoid computing e.g. charwidth data for http which does not need it at all.
* mailcap: add $MAILCAP_URLbptato2023-12-101-0/+2
| | | | | | This is better than %u as it is backwards compatible (i.e. does not rely on other user agents doing whatever upon encountering an unknown substitution template.)
* config: better path handling; fix array parsing bugbptato2023-12-101-14/+39
| | | | | | | | | * 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.
* pager: add marksbptato2023-12-091-8/+28
| | | | | Default is vi-style, but w3m-style marks work as well; see bonus/w3m.toml.
* pager, container: add text selection/copyingbptato2023-12-031-16/+17
| | | | | | | | | | * Add select & copy selection functionality to container * Fix bug in generateSwapOutput where output could be misplaced because of zero-width cells * Add fromJSPromise, call runJSJobs in every iteration of the headed event loop * "await" pager actions that output a promise * Change default view source keybinding to `\'
* pager: small optimization in drawBufferbptato2023-12-011-2/+2
|
* pager: fix regressionbptato2023-11-211-4/+4
| | | | | pager.tty refers to infile, not outfile. rename to avoid further confusion
* pager: remove pager.tty memberbptato2023-11-211-3/+3
| | | | now it's a function
* WindowAttributes: refactorbptato2023-10-191-1/+1
| | | | | | * rename module (window -> winattrs, to avoid conflict with env/window) * do not use result * remove unused cell_ratio
* pager/lineedit: notify lineedit of windowChangebptato2023-10-181-0/+2
| | | | this was causing crashes
* Refactor Consolebptato2023-10-131-1/+1
| | | | | * merge dom.console & client.Console * move client-specific stuff out of Console (into callbacks when necessary)
* Add urimethodmap supportbptato2023-09-301-3/+7
| | | | yay
* buffer: simplify contentType handlingbptato2023-09-271-10/+11
| | | | | | * remove contentType member of Buffer object * add ishtml to reduce string comparisons * consistent spelling: contenttype -> contentType
* Add precnum support to more functionsbptato2023-09-261-8/+8
|
* pager: show character sequence inputs on status linebptato2023-09-261-8/+19
| | | | pretty useful I think
* Add M-p as "load page on clipboard"bptato2023-09-251-3/+8
|
* regex: copy after compilingbptato2023-09-241-1/+2
| | | | | | | | | | | | Instead of the broken attempt at making regexes zero-copy (it copied anyway), copy once and forget about it. (There have been way too many problems with the destructor approach, including the latest one where the GC would happily zero out our regexes if they were in a sequence. Maybe we can make this work once we switched to ORC. For now, it's not worth the trouble.)
* buffer: make clone fork()bptato2023-09-231-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes e.g. on-page anchor navigation near-instantaneous. Well, as instantaneous as a fork can be. In any case, it's a lot faster than loading the entire page anew. This involves duplicating open resources (file descriptors, etc.), which is not exactly trivial. For now we have a huge clone() procedure that does an ok-ish job at it, but there remains a lot of room for improvement. e.g. cloning is still broken in some cases: * As noted in the comments, TeeStream'ing the input stream for any buffer is a horrible idea, as readout in the cloned buffer now depends on the original buffer also reading from the stream. (So e.g. if you clone, then kill the old buffer without waiting for the new one to load, the new buffer gets stuck.) * Timeouts/intervals are broken in cloned buffers. The timeout module probably needs a redesign to fix this. * If you clone before connect2, the cloned buffer gets stuck. The previous solution was even worse (i.e. broken in more cases), so this is still an improvement. For example, this fixes some issues with mailcap handling (removes the "set the Content-Type of htmloutput buffers to text/html" hack), does not reload all resources, does not completely break if the buffer is cloned during loading, etc.
* Disable "toggle source" for the console bufferbptato2023-09-211-5/+10
|
* lineedit: rewritebptato2023-09-181-13/+7
| | | | | | | | | | | | | | | | 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).
* move around more modulesbptato2023-09-141-10/+10
| | | | | | | | | | * ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
* move some modules to local/bptato2023-09-141-0/+1189
makes a bit more sense than the previous arrangement