aboutsummaryrefslogtreecommitdiff
path: root/ui-terminal.c
AgeCommit message (Collapse)AuthorFilesLines
8 daysExperiment with termbox2 for renderingHEADmasterMitchell Riedstra1-0/+2
2025-12-22move all standard library includes into util.hRandy Palamar1-17/+0
2025-11-27ui: add missing includes for printfssewn1-0/+2
functions such as [v]snprintf and sscanf require stdio and stdarg.
2025-02-22style_set: add option to keep non-default style valuesinfastin1-4/+11
2025-01-08ui: pass window id when setting styleRandy Palamar1-10/+9
There are a couple times when we want to set a style without an active window. In those cases we just want to use base UI_STYLE_*s and (Win *) is not needed. This fixes a crash when trying to do a vis:info() from lua during an initial file open event. Note that this code is due for a serious refactor, ui styles should be stored in Ui and window specific styles should be stored in Win. Then we won't need any of this difficult to follow indexing into the styles array based on window id and we will never have to realloc when a new window opens. Just another thing to add to my list.
2025-01-04curses ui: fix default color detectionRandy Palamar1-10/+20
closes: #1209
2025-01-04ui: remove useless memcpy callRandy Palamar1-11/+9
If the compiler wants to use memcpy to move 12 bytes it can inline the call itself otherwise we should just write the simple thing.
2024-05-24combine Win and UiWinRandy Palamar1-89/+56
These are not seperate things and keeping them this way makes gives this convoluted mess where both Wins and UiWins must have linked lists to the other Wins and UiWins in the program despite the fact that neither of them can exist in isolation. This, like my previous cleanup commits, is part of a larger goal of properly isolating the various subsystems in vis. Doing so is required if we ever want to be able to have a vis-server and a vis-client.
2024-05-21remove some view pointer chasingRandy Palamar1-6/+6
Same as previous commit each window only has a single View. No need for it to be stored elsewhere in memory.
2024-05-21remove some ui pointer chasingRandy Palamar1-7/+5
There only exists a single Ui so there is no need to force a pointer redirection for accessing it. The Ui member was moved down in vis-core.h to punt around an issue with the way lua checks for existing objects. It may show up again as I flatten more structs.
2024-05-21replace UiTerm with Ui & delete function pointersRandy Palamar1-125/+45
2024-05-21replace UiTermWin with UiWin & remove function pointersRandy Palamar1-75/+29
2024-05-21make Selection unopaqueRandy Palamar1-2/+1
2024-05-21make View unopaqueRandy Palamar1-7/+7
2024-04-29Emit an event (ui_draw) immediately before drawing the screenRudy Dellomas III1-0/+1
This allows better control over styling, as well as potential for entirely new UI elements implemented entirely using the Lua API.
2024-04-29Add Lua function to Win for directly editing cell styling by positionRudy Dellomas III1-0/+15
2024-04-21Disable reverse with "notreverse" in style definitionsRudy Dellomas III1-0/+2
2024-03-25ui: refactor style handlingRandy Palamar1-3/+14
The old style handling had a lot edge cases where one of the colours or the attribute wouldn't get applied correctly. This commit adds a new style_set() method to the Ui which should be called instead of manually touching a cell's style. This also means that the Cell struct can be made opaque since all the handling is now done inside the ui-terminal files. With this it is now viable to combine the light and dark 16 colour themes into a single base-16 theme. This theme works very well with the Linux virtual console and will now be the default theme regardless of if the terminal supports 256 colours or not. This should address the common complaints about vis not respecting the users default terminal colours. fixes #1151: Theming is sometimes partially applied or ignored see #1103: terminal no longer has transparency/opacity see #1040: Transparent background and setting options by default
2023-12-02Add ansi escaping values and theming keyword for dimmed textHaz1-0/+4
This adds `[not]dim` to the set of accepted theme keywords
2023-08-24Lua API: access and set all available optionsRandy Palamar1-0/+5
The first point of this commit is to allow all options to be read from lua. This has a number of uses for plugin writers. They are grouped into a couple of tables depending on what they control: `vis.options`: table with global configuration `win.options`: table with window specific configuration The second point is to allow you to set all these options as if they were simply lua variables. Technically this is already possible by using `vis:command("set ...")` but personally I think this interface is cleaner. Note that this already possible for some things like the current mode (eg. vis.mode = vis.modes.VISUAL). Examples: `vis.options.ai = true` `win.options.brk = " !?."` `win.options = { showeof = true, showtabs = true } There are a number of related issues and pull requests: closes #803: Lua API: let plugins read the values of options closes #812: Window layout property supersedes/closes #717: Add ability to access tabwidth from Lua supersedes/closes #1066: expose UI layout and allow it to be set from lua API
2023-08-01Prevent flickering in cursesIan Hixson1-0/+8
Reading from curs_refresh(3X) from curses, calling doupdate() repeatedly will cause 'several bursts of output to the screen'. wnoutrefresh() has the smarts to only copy the changed lines to the copied virtual screen, but doupdate() does not. There have been several bug reports related to flickering but all seems to be inconsistenly reproducible due to different terminal buffering behavior. See #1032, #327 Unfortunately, when I am using a slow display, I still notice flickering, so this commit changes the routines for opening new windows and splitting windows to wait until the last change is finished before calling doupdate().
2023-07-18Add fullscreen param to vis_pipe_collect() and Lua API vis:pipe()Jörg Bakker1-2/+2
This enables restoring the terminal from a fullscreen command like curses based program. Use cases are e.g. a file picker based on some external program like nnn (https://github.com/jarun/nnn).
2020-06-07ui: fix terminal UI on serial consoleMarc André Tanner1-4/+4
Make sure we do not override the 80x24 default terminal size with zero size as reported by an actual serial console.
2020-04-29ui: fix line number drawingMarc André Tanner1-2/+2
Fix #830
2020-04-27Avoid use of VLAsMichael Forney1-15/+17
2018-04-15ui: make sure $TERM is setMarc André Tanner1-1/+3
libtermkey passes the $TERM value unchecked to libunibilium which just aborts (in debug builds) or crashes (in release builds). Workaround that by defaulting to `xterm`, if $TERM is unset. It should eventually be fixed in libtermkey/unibilium too. This fixes test suite failures on the Debian package build environment. It might also be the reason for failures in other CI environments e.g.: https://github.com/alpinelinux/aports/pull/3768
2017-06-27Merge branch 'theme-tweaks-2' of https://github.com/p-e-w/visMarc André Tanner1-1/+2
Conflicts: view.c
2017-06-15vis: rename uses of Cursor to SelectionMarc André Tanner1-2/+2
2017-06-15view: rename view_cursors_primary_{get,set}Marc André Tanner1-1/+1
2017-06-10More theme improvementsPhilipp Emanuel Weidmann1-1/+2
2017-05-30ui: reopen terminal read-writeableMarc André Tanner1-1/+1
libtermkey fails if the terminal file descriptor is read only. This should fix the `v` command in less(1).
2017-04-28ui: ignore whitespace when parsing style optionsMarc André Tanner1-6/+10
2017-03-22ui: try to fix job control issues with certain shellsMarc André Tanner1-5/+3
Make sure that curses and libtermkey don't fight over the terminal state. Also send use SIGTSTP instead of SIGSTOP. Previously certain shells (e.g. csh, dash) would get stuck after the editor process was suspended for the second time. Not completely sure whether this is correct, but it seems to work in my limited tests.
2017-03-22view: rename view_dirty to view_invalidateMarc André Tanner1-3/+3
2017-03-17ui: explicitly initialize cell matrix after resizeMarc André Tanner1-0/+1
2017-03-16ui: further cleanup display codeMarc André Tanner1-33/+16
2017-03-16ui: fix display artifacts in info lineMarc André Tanner1-10/+10
We need to clear the info line before displaying a new message, otherwise parts of the old cell contents might remain visible.
2017-03-15ui: add some bound checksMarc André Tanner1-0/+4
2017-03-14Add experimental raw vt100 UI backendMarc André Tanner1-0/+4
The intention of this is not to slowly reimplement curses but to provide a minimal working terminal UI backend which can also be used for debugging, fuzzing and in environments where curses is not available. Currently no attempt is made to optimize terminal output. The amount of flickering will depend on the smartness of your terminal emulator.
2017-03-14Restructure display codeMarc André Tanner1-0/+727
Use pull instead of push based model for display code. Previously view.c was calling into the ui frontend code, with the new scheme this switches around: the necessary data is fetched by the ui as necessary. The UI independent display code is moved out of view.c/ui-curses.c into vis.c. The cell styles are now directly embedded into the Cell struct. New UI styles are introduced for: - status bar (focused / non-focused) - info message - window separator - EOF symbol You will have to update your color themes. The terminal output code is further abstracted into a generic ui-terminal.c part which keeps track of the whole in-memory cell matrix and #includes ui-terminal-curses.c for the actual terminal output. This architecture currently assumes that there are no overlapping windows. It will also allow non-curses based terminal user interfaces.