about summary refs log tree commit diff stats
path: root/src/local/pager.nim
Commit message (Collapse)AuthorAgeFilesLines
...
* buffer: remove BufferSourcebptato2024-02-221-18/+12
| | | | | | | | | | Aside from being a wrapper of Request, it was just storing the -I charset, except even that didn't actually work. Whoops. This fixes -I effectively not doing anything; now it's a forced override that even disables BOM sniffing. (If the user wants to decode a file using a certain encoding, it seems wise to assume that they really meant it.)
* buffer: clean up contentTypebptato2024-02-221-11/+17
| | | | | | | | | | This fixes a bug where setContentType would call setHTML twice, which messed up charsets and probably a couple more things. As a bonus, it allows us to pass around the content type less. In fact, buffer does not have to know its exact content type, just whether it is in HTML mode or not. So that's all we tell it now; only container still keeps track of the content type (as it should).
* config: replace default-flags with ignore-casebptato2024-02-221-4/+10
| | | | | | default-flags was overly complicated for its purpose. Also, ignore-case is quite useful, so enable it by default.
* Replace Chakasu with Chagashibptato2024-02-221-1/+1
| | | | | | The API is horrid :( but at least it copies less. TODO: think of a better API.
* pager: fix compilation on 1.6.14bptato2024-02-171-1/+1
|
* regex: re-work compileSearchRegexbptato2024-02-171-2/+4
| | | | | | | 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.
* term: fix coloring messbptato2024-02-171-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Until now, the config file required manual adjustment for the output to look bearable on terminals colored differently than {bgcolor: black, fgcolor: white}. Also, it only detected RGB when COLORTERM was set, but this is not done by most (any?) terminal emulators (sad). To improve upon the situation, we now query the terminal for some attributes on startup: * OSC(10/11, ?) -> get the terminal's bg/fgcolor * DCS(+, q, 524742) -> XTGETTCAP for the "RGB" capability (only supported by a few terminals, but better than nothing) * Primary device attributes -> check if ANSI colors are supported, also make sure we don't block indefinitely even if the previous queries fail If primary device attributes does not return anything, we hang until the user types something, then notify the user that something went wrong, and tell them how to fix it. Seems like an OK fallback. (The DA1 idea comes from notcurses; since this is implemented by pretty much every terminal emulator, we don't have to rely on slow timing hacks to skip non-supported queries.)
* winattrs: remove unnecessary call, fix height_px fallbackbptato2024-02-171-2/+3
| | | | no need for every new buffer to query the window size
* pager: increase numload for stdinbptato2024-02-151-0/+1
| | | | otherwise pages from stdin have a race condition in dump
* 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
|