about summary refs log tree commit diff stats
path: root/src/display/term.nim
Commit message (Collapse)AuthorAgeFilesLines
* Move around some modulesbptato2024-03-141-906/+0
| | | | | | | | * 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
* twtstr: fix deleteChars, do not remove space in replaceControlsbptato2024-03-141-5/+1
|
* 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
* Add mouse supportbptato2024-02-291-7/+28
|
* term: improve pixels-per-column/line detectionbptato2024-02-251-76/+164
| | | | | | | | | 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.)
* Allow non-RGB colors in CSSbptato2024-02-241-90/+101
| | | | | | | | | | | 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
* Replace Chakasu with Chagashibptato2024-02-221-9/+7
| | | | | | The API is horrid :( but at least it copies less. TODO: think of a better API.
* term: fix coloring messbptato2024-02-171-29/+171
| | | | | | | | | | | | | | | | | | | | | | | | | 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.)
* layout: use html/body bgcolor as canvas bgcolorbptato2024-02-171-6/+7
| | | | | | This is required by the standard. (Without this, lots of websites have incorrect background colors, because they set the body height to 100% of the viewport.)
* Remove newFormatbptato2024-01-231-3/+3
| | | | Pointless; it just returned a default zero-initialized object.
* Remove std/terminal dependencybptato2024-01-171-14/+30
| | | | It is mostly unnecessary, and conflicts with our use of termcap anyway.
* Use std/* imports everywherebptato2024-01-071-9/+9
|
* Compile with styleCheck:usagesbptato2023-12-281-5/+5
| | | | much better
* break up twtstr somewhatbptato2023-12-131-0/+1
| | | | | Avoid computing e.g. charwidth data for http which does not need it at all.
* pager, container: add text selection/copyingbptato2023-12-031-3/+12
| | | | | | | | | | * 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: fix regressionbptato2023-11-211-2/+2
| | | | | pager.tty refers to infile, not outfile. rename to avoid further confusion
* bindings: find termcap on FreeBSDbptato2023-11-211-8/+8
| | | | | pkg-config does not find termcap (or really, ncurses) here, so we have to find it ourselves.
* pager: remove pager.tty memberbptato2023-11-211-4/+5
| | | | now it's a function
* term: replace control chars in setTitlebptato2023-10-201-1/+5
|
* WindowAttributes: refactorbptato2023-10-191-1/+1
| | | | | | * rename module (window -> winattrs, to avoid conflict with env/window) * do not use result * remove unused cell_ratio
* term: un-export canvasbptato2023-10-011-1/+1
|
* term: simplify/cleanupbptato2023-09-181-77/+17
|
* move around more modulesbptato2023-09-141-3/+3
| | | | | | | | | | * ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
* add extern, refactor some term functionsbptato2023-09-091-47/+54
| | | | | | | | | | | * Add an extern() call. Maybe it should be defined on client. It certainly should accept a dictionary instead of the enum type we use now. Perhaps it should return the error code? I'll leave it undocumented until I figure this out. * Refactor enableRawMode, unblockStdin, etc. so that they operate on the term object instead of global state. * Move editor to a separate folder, and factor out runprocess into a different module.
* Move charsets into chakasubptato2023-08-141-2/+3
| | | | Operation "modularize Chawan somewhat" part 1
* Add default background/foreground color overridebptato2023-07-291-38/+39
|
* Improve encoding supportbptato2023-07-121-29/+58
| | | | | | | | * Use the output charset in lineedit (as w3m does) * encoder: fix broken UTF-8 encoding, use openArray instead of var seq for input queue * Add RuneStream as an in-memory interface to EncoderStream * Document display-charset config option
* term: fix cursorGoto without termcapbptato2023-07-101-1/+1
|
* term: fix ANSI color approximationbptato2023-07-061-7/+8
| | | | Fixes a bug that lead to incorrect color approximation.
* term: convert 8-bit colors to ANSIbptato2023-06-271-0/+6
| | | | (Instead of crashing)
* Support 8-bit output colorsbptato2023-06-261-20/+48
|
* hacks for readline so that it at least kind of worksbptato2023-06-251-1/+1
| | | | Proper fix needed later
* Only set terminal title when it is a ttybptato2023-06-241-2/+5
| | | | Avoid writing the escape sequence when dumping files.
* term: fix clearEnd regressionbptato2023-06-231-1/+3
| | | | Sending EL at EOL clears the last character, so we avoid doing that.
* Fix color U, slightly change contrast algorithmbptato2023-06-101-5/+14
|
* approximateANSIColor: fix possible underflowbptato2023-06-101-3/+4
|
* Fix some type confusion with colors, fix crash in pagerbptato2023-06-091-8/+11
|
* Fix 'F' missing from fullwidth chars + display bugsbptato2023-06-091-34/+29
|
* Add XTERM title renamingbptato2023-06-071-27/+21
|
* Add display/output encodingbptato2023-05-191-10/+45
| | | | Some encodings are still missing
* Refactor config, add charset optsbptato2023-05-161-12/+12
| | | | Only document-charset supported for now.
* pager, term: fix inefficiencies, off by one errorsbptato2023-01-111-7/+6
| | | | and other weird things I forgot to remove while debugging
* term: hack to avoid a weird crashbptato2023-01-021-2/+8
| | | | Looks like we can't just assign canvas to pcanvas.
* Proper support for tabsbptato2022-12-271-7/+11
|
* Add unicode normalization, etcbptato2022-12-191-6/+18
|
* Fix a processFormat bugbptato2022-12-161-4/+6
|
* term: improve screen/line clearingbptato2022-12-151-4/+12
|
* Add all sorts of config options and cookiesbptato2022-12-131-15/+20
|
* Fix color contrast correctionbptato2022-12-121-28/+27
| | | | | Instead of just inverting the color and hoping for the best, convert it to YUV and increase/decrease luminance based on results.
* Fix -dbptato2022-12-101-23/+44
|