aboutsummaryrefslogtreecommitdiff
path: root/vis-core.h
AgeCommit message (Collapse)AuthorFilesLines
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.
2017-01-28vis: keep track of most recently processed keys of input queueMarc André Tanner1-1/+3
Currently the key handling functions do not know through which mapping they were invoked. As an example the `count` handler exploits the implementation detail that the input queue is stored in contiguous memory, meaning `keys[-1]` gives access to the digit being pressed. This adds infrastructure to keep track of the two most recently processed keys of the input queue. The information is guaranteed to be accurate for the initial invocation of the key handler but will be overwritten in case new keys are pushed to the input queue (e.g. through vis_keys_feed).
2017-01-19vis: simplify count handling for insertionMarc André Tanner1-1/+0
2017-01-18vis: support count for insertion and replacementMarc André Tanner1-0/+1
Fix #372
2017-01-18vis: do not take undo snaphots while replaying a macroMarc André Tanner1-0/+1
The vis_keys_feed function is currently unaffected by this change. It still creates individual undo points. While this is probably undesirable from an API point of view, it keeps the lua based tests that use undo points working.
2017-01-16vis: cleanup regex header inclusionMarc André Tanner1-1/+0
2017-01-12sam: implement parallel grouping behaviorMarc André Tanner1-0/+8
2017-01-10vis: add register description to :help outputMarc André Tanner1-0/+3
2017-01-10vis: add valid marks to :help outputMarc André Tanner1-0/+6
2017-01-07buffer: remove redundant functionMarc André Tanner1-1/+1
For some reason we ended up with two identical functions: buffer_{clear,terminate}.
2016-12-29vis: cleanup key action lifetime managementMarc André Tanner1-0/+1
2016-12-27vis: properly free dynamic key bindingsMarc André Tanner1-0/+1
The handling of :unmap needs to be revisited at some point.
2016-12-14vis: add new :set savemethod auto|atomic|inplace optionMarc André Tanner1-0/+1
Specifies how the current file should be saved, `atomic` which uses rename(2) to atomically replace the file, `inplace` which truncates the file and then rewrites it or `auto` which tries the former before falling back to the latter. The rename method fails for symlinks, hardlinks, in case of insufficient directory permissions or when either the file owner, group, POSIX ACL or SELinux labels can not be restored. The option defaults to `auto`.
2016-11-27sam: stricter command parsingMarc André Tanner1-0/+1
Properly detect unbalanced curly braces and spurious output at the end of a group.
2016-11-27vis: cleanup signal handling codeMarc André Tanner1-0/+2
Move all signal handling code out of "library" code into user application.
2016-11-22vis-lua: introduce pre-save hookMarc André Tanner1-0/+1
The first argument is the file object while the second argument denotes the full path to which it will be written. Path might be `nil` if the file is going to be written to stdout. The Lua function is expected to return a boolean value indicating whether the write operation should proceed or be aborted.
2016-11-21vis-lua: rename file_save event to file_save_postMarc André Tanner1-1/+1
Indicating that the event is triggered *after* a successfull write.
2016-11-16vis: treat vis_keys_feed input like a macro replayMarc André Tanner1-0/+1
We need to push keys individually to the input queue such that the state machine can advance and record keys into the operator macro if necessary. Previously feeding the following input: isome text<Escape>. would not work as expected because the complete key stream was pushed to the input queue at the same time during which the operator macro was not yet active. Thus the dot command at the end would have nothing to repeat.
2016-11-15vis: defer UI initialization and overhaul argument parsingMarc André Tanner1-0/+1
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-15vis: overhaul and unify event generation codeMarc André Tanner1-0/+16
Add another layer of indirection, move actual event generation code to a dedicated function.
2016-11-15vis: generalize special stdin handlingMarc André Tanner1-1/+1
In preparation to move argument parsing code out of vis.c.
2016-11-11vis: attempt to use the default shell of the user to execute external commandsMarc André Tanner1-0/+1
We first try $SHELL and then fall back to the shell field of the password file entry (/etc/passwd).
2016-11-09vis: unify VIS_OP_{INSERT,REPLACE} implementationMarc André Tanner1-0/+1
They both perform a motion before changing mode.
2016-10-27vis: apply language map only to key values not modifiersMarc André Tanner1-0/+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-09-25vis: disable language map for replacement character of `r` commandMarc André Tanner1-0/+1
The character following the `r` command in normal mode should be treated as regular input given in insert/replace mode, that is no tranformation should be applied. Temporarily disable the language map for this reason. Close #382
2016-08-24vis: improve dot (repeat) command implmentationMarc André Tanner1-1/+1
Do not override implicit operator macro in command mode. Fix #334
2016-08-24vis: overhaul input queue handlingMarc André Tanner1-1/+0
Let vis_keys_feed always have an immediate effect. Previously, if called from a key input handler the keys would just be added to the input queue and processed once the current key handler returned. This also affects the exposed Lua API.
2016-05-28vis: try to reduce number of redrawsMarc André Tanner1-1/+1
This is a not yet successful attempt to reduce terminal flickering when resizing windows as is for example the case when entering command mode. UI related debug output can be enabled with: $ make CFLAGS=-DDEBUG_UI=1 $ ./vis > log
2016-05-26vis: use normalized absolute file names as internal representationMarc André Tanner1-0/+3
Try to display a shorthand version in the status bar, this currently only works for files below the current working directory of the editor process.
2016-05-22vis-lua: do not report errors recursivelyMarc André Tanner1-0/+1
Displaying an error might create a new window which in turn can trigger new events (all other windows are resized+redrawn) which might again cause errors. There is still no sane way to exit the editor in this case, but at least the error messages should be readable.
2016-05-22vis: consider :set horizon setting when syntax highlightingMarc André Tanner1-0/+1
2016-05-22vis: move syntax highlighting to pure Lua codeMarc André Tanner1-0/+3
2016-05-10Revert "vis: clean up interaction between vis and ui"Marc André Tanner1-2/+0
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: clean up interaction between vis and uiMarc André Tanner1-0/+2
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-05-04vis: make j and k a linewise inclusive motionMarc André Tanner1-2/+3
They behave like an inclusive motion, but only if they are also linewise (which they are by default). This should make `yjp` and `ykp` yank both the current and the next/previous line when the cursor is at the start of a line. See also 532f52e9e52b98dc5749396f7353295418e0227a and #237
2016-05-01vis: further cleanup input handling, introduce vis_keys_feed APIMarc André Tanner1-0/+1
2016-04-21vis: add infrastructure to register custom :-commandsMarc André Tanner1-0/+1
2016-04-18vis: use internal file to show lua errorsMarc André Tanner1-0/+1
This means no event handlers are run for it, hence there is no chance for recursive errors.
2016-04-05vis: remove left over from :sam commandMarc André Tanner1-1/+0