aboutsummaryrefslogtreecommitdiff
path: root/vis.c
AgeCommit message (Collapse)AuthorFilesLines
2024-05-21replace UiTerm with Ui & delete function pointersRandy Palamar1-41/+25
2024-05-21replace UiTermWin with UiWin & remove function pointersRandy Palamar1-13/+9
2024-05-21make Selection unopaqueRandy Palamar1-7/+6
2024-05-21make View unopaqueRandy Palamar1-14/+14
2024-05-21cleanup some single line get/set functionsRandy Palamar1-32/+2
2024-05-21cleanup vis event interfaceRandy Palamar1-99/+13
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-05-19fix primary cursor color displaynobody1-1/+2
2024-05-12lua: allow changing the displayed file of a windowFlorian Fischer1-0/+12
Change the file displayed in a window by writing the new file name to the window's file member. This is useful to change the displayed file during events. Using the edit command during an event caused by a pervious edit command causes a double free.
2024-04-29Emit an event (ui_draw) immediately before drawing the screenRudy Dellomas III1-0/+4
This allows better control over styling, as well as potential for entirely new UI elements implemented entirely using the Lua API.
2024-03-25ui: refactor style handlingRandy Palamar1-49/+19
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
2024-03-25Add parentheses around '&&' within '||'.Matěj Cepl1-2/+2
Silencing compiler's -Wparentheses warning.
2023-10-17apply configured foreground to matching pairRandy Palamar1-0/+1
fixes #1151 (part 2): Set foreground color for matching pair
2023-10-17apply configured foreground to selectionsRandy Palamar1-0/+1
fixes #1151: Set foreground color for visual selection
2023-10-10vis_pipe: correctly return non-zero exit statusRandy Palamar1-1/+4
according to POSIX wait(3p) the return status needs to be checked and the macro WEXITSTATUS(stat_val) should be used to get the actual return value on a normal exit. POSIX doesn't specify the value of stat_val on abnormal exit and thus vis_pipe() should just return -1 as it does for other errors closes #1130: vis:pipe returns wrong exit status (when non-zero) Thanks @pippi1otta for the report and suggestion.
2023-08-27Make expandtab option window-localAlexey Yerin1-2/+2
2023-08-27Make tabwidth option window-localAlexey Yerin1-3/+1
2023-08-24Implementation of the non-blocking process running Lua APIxomachine1-1/+4
Rationale A modern text editor usually includes tools for helping user to avoid mistakes in texts. Those tools include spell checkers and programming language integrations. Though vis explicitly states that the full featured IDE is not a goal, implementing some of the tools might be achieved using its Lua API. Unfortunatelly the API misses the ability to start a process and to perform a communication with it without completely blocking the editor UI, which is crucial for any tool that performs background tracking of the inserted text (e. g. language servers). Implementation details New feature introduces new API method: communicate. The method start a new process and returns a handle to communicate with the process instantly. The patch inserts stderr and stdout file descriptors of the process to the pselect call of the main loop used for reading user input to track the process state without blocking the main loop until the process is finished. Any changes in the process state cause the iteration of the main loop and are being exposed to the Lua API as new event: PROCESS_RESPONSE.
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-4/+6
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).
2023-06-06Limit to lines within range for inner text objectsMiles Canfield1-0/+3
2022-11-29fix miscellaneous spelling mistakesNick Hanley1-1/+1
2022-07-27vis: Some duplicate files were overlooked due to a condition in the wrong placeTom Schwindl1-5/+7
2022-07-23vis: Compare non-existing files by name and existing files by inodeTom Schwindl1-5/+12
2022-07-12vis: Compare inodes instead of filenamesTom Schwindl1-3/+8
2021-02-15vis: correctly close pipe connected to stdin of external processMarc André Tanner1-2/+2
Once we have written all data we should properly close the (correct) pipe. Before we wrongly closed the pipe connected to the standard output stream. More generally, we currently do not listen for child process termination, but instead wait until all the connected pipes are closed. This might be problematic in case the external process keeps hold of the standard I/O file descriptors. One particular example of this is wl-copy(1). See #929
2020-12-10fix typos in commentsMoesasji1-2/+2
2020-11-14vis: fix <C-c> processing after SIGINTMarc André Tanner1-1/+2
There are two main ways how the input queue is managed in vis: - vis_keys_feed(..) appends new input to the queue and immediately starts processing it. Starting from the position before the call i.e. ignoring any previously queued input. This is typically used in key binding handlers where the input queue still contains the mapping leading to the invocation of the handler. In that case new input should be interpreted immediately, before the handler eventually returns and its mapping is consumed. - vis_keys_push(..) with pos=0, appends new input to the end of the queue and starts processing it from the start of the queue, taking the full content into consideration. This is used by the main loop when new input becomes available. This patch switches the handling of <C-c> after a SIGINT from the former to the latter mechanism and fixes mappings using <C-c> in a non-leading position.
2020-09-20Merge branch 'emg-add-ignorecase' of https://github.com/deepcube/vis into masterMarc André Tanner1-1/+2
2020-09-19Add ignorecase optionEvan Gates1-1/+2
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/+15
2020-07-17support for primary clipboardJeremy Bobbin1-0/+1
2020-05-12vis: cleanup pre-processing of :-commandsMarc André Tanner1-5/+5
Not sure why we need to allocate space for an additional character. This also avoids creating out of bound pointers.
2020-03-18Merge branch 'single-cursor-is-primary' of https://github.com/3dc1d3/visMarc André Tanner1-2/+1
2020-03-17color-column: Don't change fg/bg if not set explicitlyGennadiy Volkov1-1/+6
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.
2020-03-17Set single cursor style as primary, not secondaryGennadiy Volkov1-2/+1
2020-02-07vis: restore mode when dot-repeatingGeorgi Kirilov1-0/+1
2020-02-07Merge branch 'fix-cc-cell' of https://github.com/zsugabubus/visMarc André Tanner1-5/+6
2020-02-04vis: make core code more robustMarc André Tanner1-13/+41
The core vis code was originally written under the assumption that there always exists at least one window. However, when being called from the Lua configuration file during start up this is not yet the case. In general, Lua code should always be placed within appropriate event handlers e.g. vis.events.INIT for global configuration. Invoking API functions depending on an active window from top level statements is not supported. Where before the editor simply crashed, these changes turn such code sections into NOPs. Fix #561
2020-01-27vis: make r<Enter> insert a new lineMarc André Tanner1-1/+1
Special case <C-v><Enter> to still insert a carriage return as discussed in #656 and changed in 2cfc9c867bdfd4cc3ae3246f31cf636633fe1a5f. Due to limitations of the current implementation <C-v> is not generic, i.e. combining it as r<C-v><Enter> will not work. Fixes #765
2020-01-27vis: pass absolute path to pre/post save eventsMarc André Tanner1-1/+1
2020-01-26vis: don't search off screen when highlighting matchesGeorgi Kirilov1-1/+2
2020-01-12vis: don't draw colorcolumn after the endzsugabubus1-5/+6
Check for end-of-text.
2018-05-30vis: add loadmethod optionMarc André Tanner1-1/+1
Valid values are `read`, `mmap` or `auto`.
2018-05-16vis: remove v and V in operator pending modeMarc André Tanner1-1/+1
2018-01-26vis: insert carriage return upon <C-v><C-j> in insert modeMarc André Tanner1-1/+1
Fix #656
2017-12-09vis: make selections visible when lua support has been disabledMarc André Tanner1-2/+6
When the fore and background colors are the same, swapping them has no effect. Instead use the specified cell attributes. Previously the CELL_ATTR_REVERSE used in the default selection style was ignored. In general the default style definitions for non-Lua builds could probably be improved further. Fix #635
2017-11-04vis: take symbolic keys into account when evaluating key prefixesMarc André Tanner1-6/+32
Previously `ci<` would have no immediate effect because in operator pending mode `i<` was wrongly treated as a powwible prefix of `i<Tab>`. Fix #624
2017-09-15vis: remove ! operatorMarc André Tanner1-11/+1
Use visual mode and :| to filter text through external commands. The mapping was already reused for selection complement.
2017-07-23vis: use strncpy to copy into fixed sized bufferMarc André Tanner1-1/+1
In practice this was never an issue also it is guaranteed that the terminating zero byte is already there. Fixes coverity issue 157023.
2017-07-23vis: only draw selections of currently active windowMarc André Tanner1-2/+3
This should make it easier to see which window is focused.