aboutsummaryrefslogtreecommitdiff
path: root/vis-core.h
AgeCommit message (Collapse)AuthorFilesLines
2026-01-06vis-marks: make mark set cache actually usefulRandy Palamar1-3/+12
Without also saving and restoring the editor mode when the selections were added to the cache almost no useful actions can be performed. While we are at it the 3 jumplist functions can just be combined into one.
2026-01-06vis-marks: greatly simplify jumplist managementRandy Palamar1-10/+4
As far as I could tell from the code this was supposed to be a fixed size LRU cache of sets of selection regions. The structure had a maximum size member but it was never set or used. Furthermore there was some very complicated management of 2 parallel sets of regions. Instead of that mess just treat the cache as a circular buffer. Note that this is really not that useful at the moment. While the selection regions are saved and restored the editor mode is not. Therefore the selection is visible but not in any way usable. That will be fixed in the next commit.
2025-12-22move all standard library includes into util.hRandy Palamar1-2/+0
2025-12-16mark all functions in headers with VIS_EXPORT or VIS_INTERNALRandy Palamar1-31/+33
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-16clean up remaining struct and function name collisionsRandy Palamar1-3/+3
I think that having structs with the same name be completely different depending on which part of the program you look at is even less readable than having functions with same name.
2025-01-11buffer: clear out one line functionsRandy Palamar1-1/+0
Buffer is fully exposed to the program, no need to rely on the linker to optimize useless code.
2025-01-11buffer: delete pointless buffer_init functionRandy Palamar1-1/+0
lets not make the code harder to read for no reason
2024-05-30remove the vis->initialized memberRandy Palamar1-1/+0
I already fixed the reason that this even existed (vis_event_emit getting called at random times when the editor wasn't ready). The option checking in main() was moved up because I noticed it was in the wrong place while thinking about where to emit the INIT event. There is no reason to do a bunch of useless work just to print the version.
2024-05-24combine Win and UiWinRandy Palamar1-3/+7
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-1/+1
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-1/+1
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-21cleanup vis event interfaceRandy Palamar1-2/+2
This removes the function pointer interface which was adding needless complexity and making it difficult to add new events. Now if new events are only meant for lua they only need to be added to the lua interface. This will also have a minor reduction in runtime memory usage and produce a smaller binary. The only runtime difference is that QUIT happens after all windows have been closed and their files freed.
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.
2023-08-27Make expandtab option window-localAlexey Yerin1-1/+1
2023-08-27Make tabwidth option window-localAlexey Yerin1-1/+0
2022-11-29fix miscellaneous spelling mistakesNick Hanley1-4/+4
2020-12-10fix typos in commentsMoesasji1-9/+9
2020-09-20Merge branch 'emg-add-ignorecase' of https://github.com/deepcube/vis into masterMarc André Tanner1-0/+1
2020-09-19Add ignorecase optionEvan Gates1-0/+1
Add a global ignorecase boolean option. When set add REG_ICASE to cflags when calling text_regex_compile().
2020-09-17Pass up terminal CSI as events to Lua.Ez Diy1-0/+1
2020-01-27vis: pass absolute path to pre/post save eventsMarc André Tanner1-0/+2
2018-05-30vis: add loadmethod optionMarc André Tanner1-0/+1
Valid values are `read`, `mmap` or `auto`.
2017-07-14vis: use distinct mark to save last selectionsMarc André Tanner1-0/+2
This partially reverts f9e2b884c15919757651db8b10c033a344a19e75 further jumps after leaving visual mode should not break `gv`.
2017-07-10vis: remove change listMarc André Tanner1-7/+0
This was completely broken since 71eab6d5d72145f17ab3d4c87945ac12176ae8e9 and even before never really worked as one would expect. If anything it should be implemented like the jump list using marks.
2017-07-10vis: let '^ mark point to top of jump listMarc André Tanner1-2/+0
2017-07-10vis: implement jump list in terms of marksMarc André Tanner1-3/+11
2017-07-07vis: use marks instead of registers to store selectionsMarc André Tanner1-4/+6
The key binding remain the same, but the selections are now stored on a per-buffer basis.
2017-07-04vis: implement `gv` by means of new "^ registerMarc André Tanner1-0/+1
This window local register holds the last active selections.
2017-06-15vis: add basic infrastructure to store selections in registersMarc André Tanner1-0/+1
2017-06-15vis: rename uses of Cursor to SelectionMarc André Tanner1-1/+1
2017-05-27vis-lua: expose currently active key bindings through APIMarc André Tanner1-0/+1
Close #563
2017-04-23vis: fix # register countMarc André Tanner1-1/+1
Previously the # register was always reported as containing only one entry. This wrongly caused the first value to be put at all locations. Fix #544
2017-04-20vis: add # register to insert cursor numberMarc André Tanner1-0/+1
2017-04-20vis: start cleaning up register related codeMarc André Tanner1-1/+29
Now that register.h is no longer used by view.h we can move the struct and function declarations to vis-core.h.
2017-04-19vis: restructure register handlingMarc André Tanner1-0/+3
Decouple register content from cursors. Previously each cursor had exactly one corresponding register. Now each register can save a list of values whose lifetime is not tied to the cursor. If multiple cursors exist and a put with a register holding only a single value is performed, then this value is inserted at every cursor location. If there are fewer values available than cursors, then only the matching ones will be used. If a register holding multiple values is inserted in a single cursor context, only the first value will be used. Another option would be to join all existing values. The details of this behavior might be changed in the future. <C-r> in insert mode has not yet been adapted and register handling in general needs to be cleaned up further. Fix #527
2017-04-14vis: make certain operations interruptible with <C-c>Marc André Tanner1-1/+1
As currently implemented this will only work for operations which are individually fast, but repeated many times (e.g. `1000000itext<Escape>`).
2017-04-04vis: remove unused struct memberMarc André Tanner1-1/+0
2017-03-31vis: add non-default actions for vi compatible n/N motionsMarc André Tanner1-0/+1
The following key mappings should result in the vi behavior: :map! normal n <vis-motion-search-repeat> :map! normal N <vis-motion-search-repeat-reverse> The default remains unchanged, that is `n` (`N`) always searches towards the end (start) of the file. Fix #470
2017-03-19vis: add infrastructure for user specified operatorsMarc André Tanner1-3/+6
2017-03-19Move :set horizon option implementaiton to luaMarc André Tanner1-1/+0
2017-03-19Move :set syntax option implementation to luaMarc André Tanner1-1/+0
It is no longer possible to change the used syntax by assigning to the `win.syntax = name` field, instead the function win:set_syntax(name)` should be called. The distinction between filetype and syntax lexer to use should probably be clarified/cleaned up at some point.
2017-03-14Restructure display codeMarc André Tanner1-1/+1
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.
2017-02-24vis: remove unused struct memberMarc André Tanner1-1/+0
The macro replay code has since been refactored, making this obsolete. There is only ever one input queue from which keys are interpreted.
2017-02-24vis: make help texts optional to produce a smaller binaryMarc André Tanner1-1/+1
$ ./configure --disable-help shrinks the binary by about 20K on a x86_64 system.
2017-02-22vis: add exact count motion flagMarc André Tanner1-0/+1
Some motions should fail (i.e. keep the initial position) when the specified count can not be satisfied exactly. Examples include t, f, T, and F. Fix #497
2017-02-07vis: improve text object handlingMarc André Tanner1-0/+2
Fix `gN` and delimited inner variants when given a count.
2017-02-07vis: reformat text object definitionsMarc André Tanner1-3/+3
2017-02-01vis: refactor autoindent handlingMarc André Tanner1-0/+1
Rather than inserting a newline and then looking for leading white space of the previous line we now gather the white space before newline insertion. Also we no longer indent empty lines. Close #472
2017-01-31sam: optmize transcript insertion for common caseMarc André Tanner1-0/+1
This esentially performs an insertion sort. Rather than iterating the list from the start every time keep track of the latest change and optmize for monotonically increasing file positions.
2017-01-31vis: add workaround for broken color handling in Terminal.appMarc André Tanner1-0/+1
Terminal.app sets $TERM=xterm-256color and ships a corresponding terminfo description advocating that it is capable of color changes to the 256 color palette when in fact it can not. We introduce a new boolean option "change-256colors" which is true by default but can be used to disable color changes. It is automatically set if Terminal.app is detected using $TERM_PROGRAM. This should fix display artifacts as described in #456.