aboutsummaryrefslogtreecommitdiff
path: root/ui.h
AgeCommit message (Collapse)AuthorFilesLines
2025-12-22move all standard library includes into util.hRandy Palamar1-4/+0
2025-12-16mark all functions in headers with VIS_EXPORT or VIS_INTERNALRandy Palamar1-27/+27
if vis actually wants to be a library exported symbols may need mark up depending on the platform (eg. __declspec(dllexport)). This needs to be hidden behind a macro because the way you export is not the same on every platform. I did this based on the assumption that vis.h was supposed to be the only interface to the "vis" library. Since nobody actually uses vis as a library I have no idea if this is actually correct. Anyway marking up all prototypes like this allows for one to convert all functions to static if a single translation unit is used by inserting at the start: #define VIS_INTERNAL static #define VIS_EXPORT static
2025-12-14Use STYLE_WHITESPACE for spaces, newlines, and tabsLaurence de Bruxelles1-0/+1
Allow theming the replacement characters shown for showspaces, showtabs, and/or shownewlines.
2025-02-22style_set: add option to keep non-default style valuesinfastin1-2/+2
2025-01-08ui: pass window id when setting styleRandy Palamar1-1/+1
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.
2024-05-24combine Win and UiWinRandy Palamar1-26/+13
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 ui pointer chasingRandy Palamar1-1/+2
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-39/+68
2024-05-21replace UiTermWin with UiWin & remove function pointersRandy Palamar1-8/+17
2024-04-29Add Lua function to Win for directly editing cell styling by positionRudy Dellomas III1-0/+1
2024-03-25ui: refactor style handlingRandy Palamar1-13/+1
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-08-24Lua API: access and set all available optionsRandy Palamar1-0/+1
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/+1
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-1/+1
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-12-10fix typos in commentsMoesasji1-1/+1
2020-03-17color-column: Don't change fg/bg if not set explicitlyGennadiy Volkov1-0/+2
eg. if your long line is a comment with green fg, and you set your column color bg red while not specifying the fg, then the result is green fg on red bg. Prior to this change the result would be default fg on red bg, thus one char in the long line of green text would look odd/wrong. Of course if you do explicitly set the column color fg to default in your theme then the result will not be what you expect - ideally we need an UNSPECIFIED color type instead of relying on DEFAULT.
2017-06-10More theme improvementsPhilipp Emanuel Weidmann1-0/+1
2017-03-16ui: further cleanup display codeMarc André Tanner1-1/+0
2017-03-14Add experimental raw vt100 UI backendMarc André Tanner1-0/+15
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-4/+21
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.
2016-11-15vis: defer UI initialization and overhaul argument parsingMarc André Tanner1-1/+0
Do not initalize curses UI before it is actually needed. Move vis command line argument parsing logic into main.c. This fixes `vis -v` output and exit status. Fix #351
2016-11-14vis-lua: add vis.ui.colors denoting the number of available colorsMarc André Tanner1-0/+1
2016-11-14ui: remove unused functionMarc André Tanner1-1/+0
2016-10-27vis: apply language map only to key values not modifiersMarc André Tanner1-1/+1
The language map translation should not take modifiers into account. For example if `a` is mapped to `b` then `<M-a>` should also be mapped to `<M-b>`. Fix #404
2016-05-22vis: refactor status line handlingMarc André Tanner1-1/+0
Make window status bar content configurable via Lua.
2016-05-22vis: add function to change window statusbar contentMarc André Tanner1-0/+1
2016-05-22vis: add functions to query window sizeMarc André Tanner1-0/+2
2016-05-22ui: s/UiStyles/UiStyle/gMarc André Tanner1-1/+1
2016-05-10Revert "vis: clean up interaction between vis and ui"Marc André Tanner1-1/+4
This caused issues on OpenBSD where it crashed the terminal. Also on Mac OS X suspend via ^Z (Ctrl-Z) was missing a \r i.e. the shell prompt was not properly redrawn. While in principle user interfaces should not have to depend on libtermkey, in practice this won't be an issue unless we are adding a non-terminal based UI (which won't happen anytime soon). This reverts commit 8f92b98848f9366e78c7aa824615bade83971513. Close #311
2016-05-04vis: enable large file optimizations for files with long linesMarc André Tanner1-0/+5
2016-05-04vis: clean up interaction between vis and uiMarc André Tanner1-4/+1
A concrete user interface implementation should not have to depend on libtermkey. Therefore the vis core now uses an independent instance to parse keys.
2016-04-08vis: let :e recreate a window at the same location as the old oneMarc André Tanner1-0/+1
Close #224
2016-03-10ui: make primary cursor blinkMarc André Tanner1-0/+1
2016-02-12Improve large file supportMarc André Tanner1-0/+1
Disable absolute line numbers for large files (currently anything bigger than 32MiB). This speeds up moving around with for example nn% since no new lines need to be calculated. Of course movements like :nn will be unaffected. The optimizations can be disabled by explicitly enabling absolute line numbers as in :set number
2016-01-30Implement system clipboard registers "* and "+Marc André Tanner1-1/+1
Both registers are currently treated identically. The actual system integration is performed by two shell scripts vis-copy and vis-paste.
2016-01-30Improve Lua error reportingMarc André Tanner1-0/+1
Display Lua errors in a dedicated window/file. A typo or missing dependency (e.g. lpeg) in visrc.lua will no longer silently fail without any indication. The Lua integration in view.h is not yet converted.
2016-01-13Implement command/search prompt history as a regular fileMarc André Tanner1-4/+1
2016-01-13ui: make statusbar configurableMarc André Tanner1-1/+3
2015-12-20vis: fix forceful redraw <C-l>Marc André Tanner1-0/+1
2015-11-08Fix warnings found by static analyzerMarc André Tanner1-1/+1
2015-11-08Remove trailing white space from source filesMarc André Tanner1-1/+1
2015-11-08vis: implement :set colorcolumnMarc André Tanner1-0/+1
2015-11-08vis: implement :set cursorlineMarc André Tanner1-0/+2
2015-11-08vis: experimental support for lua/lpeg based syntax highlightingMarc André Tanner1-1/+8
The lua based lexers are searched in the following order: $VIS_PATH/lexers $HOME/.vis/lexers /usr/share/vis/lexers followed by the standard lua package.path
2015-11-07vis: API documentation and cleanupMarc André Tanner1-1/+0
2015-10-26vis: merge editor.c into vis.cMarc André Tanner1-2/+2
2015-10-22ui: introduce and use ui specific die(...) functionMarc André Tanner1-0/+1
2015-10-15ui: cleanup redrawingMarc André Tanner1-1/+0
2015-10-14view: cleanup whitespace replacement symbol handlingMarc André Tanner1-1/+5
2015-10-14view: cleanup option handlingMarc André Tanner1-1/+2