aboutsummaryrefslogtreecommitdiff
path: root/vis.c
AgeCommit message (Collapse)AuthorFilesLines
2017-05-19vis: improve `:<` command implementationMarc André Tanner1-3/+13
When we have nothing to write to an external process, redirect stdin to /dev/null instead of using a pipe which is immediately closed. Some commands change their behavior when used in a shell pipeline. As an example the following did not work as expected: :< ag pattern Fix #556
2017-05-17vis: ensure complete ! command output is displayedMarc André Tanner1-3/+11
For interactive processes started using `:!` stdout is redirected to stderr normally used by vis to draw its user interface. For some reason the first byte written by the interactive application is not being displayed. I suspect it has something to do with the terminal state change. For now we are writing a dummy space (which is never shown) ourself to ensure that the complete output is visible. Fix #545
2017-05-12vis: immediately update screen after a vis_redraw callMarc André Tanner1-0/+1
By default we only update the screen once per main loop iteration. This might change in the future, but for now we force an update when a redraw is explicitly requested.
2017-05-06vis: add vis_interrupt{,requested} functionsMarc André Tanner1-0/+8
2017-05-06vis: add doxygen commentsMarc André Tanner1-2/+7
Rename some structures, add typedefs for function pointers, remove unused arguments from vis_run.
2017-05-04vis: improve job control for forked processMarc André Tanner1-2/+27
We need to unblock SIGTERM for the child process. Also we should deliver signals to the correct process group. This is still fragile and will need to be rewritten when we finally introduce a global event loop.
2017-05-03vis: introduce count iterator to handle interrupted flagMarc André Tanner1-0/+22
2017-05-03text: rename text_sigbus to text_mmapedMarc André Tanner1-1/+1
Add casts to uintptr_t to avoid unrelated pointer comparisons.
2017-04-24vis: fix newline insertion at end of fileMarc André Tanner1-1/+1
With enabled auto indentation and tab expansion in an empty buffer, the following would insert one newline too many: i<Tab><Enter>
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-57/+0
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-7/+24
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-18vis: rename vis_register_set to vis_registerMarc André Tanner1-1/+1
2017-04-14vis: make certain operations interruptible with <C-c>Marc André Tanner1-3/+11
As currently implemented this will only work for operations which are individually fast, but repeated many times (e.g. `1000000itext<Escape>`).
2017-04-09vis: remove handling of \r\n line endingsMarc André Tanner1-7/+6
Use something like dos2unix(1) and unix2dos(1), if you need to edit such files.
2017-04-04vis: remove unused struct memberMarc André Tanner1-1/+0
2017-04-04vis: automatically dispose invalid cursorsMarc André Tanner1-0/+7
2017-03-31vis: rename search related constantsMarc André Tanner1-1/+1
2017-03-24vis: properly redraw status bar of windows displaying internal filesMarc André Tanner1-1/+1
Currently the only "internal window" with a status bar is the information window used to display Lua stack traces. We do not want to trigger events for it, because that could result in further Lua errors. Nonetheless its status bar should be properly redrawn to avoid display artifacts. That is why we fall back to the built-in default status bar as used by non-Lua builds.
2017-03-22vis: fix syntax highlighting glitches with split windowsMarc André Tanner1-17/+14
When a file was being displayed in multiple windows and changes were performed to the one showing the preceding file region, the syntax highlighting of the window showing the later parts would get messed up.
2017-03-19vis: add infrastructure for user specified operatorsMarc André Tanner1-0/+3
2017-03-19Move :set horizon option implementaiton to luaMarc André Tanner1-2/+1
2017-03-19Move :set syntax option implementation to luaMarc André Tanner1-18/+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-19vis: add infrastructure to dynamically add :set optionsMarc André Tanner1-0/+4
2017-03-17vis: fix selection background colorMarc André Tanner1-1/+1
2017-03-16ui: further cleanup display codeMarc André Tanner1-2/+1
2017-03-16vis: remove special case when invalidating windowsMarc André Tanner1-2/+1
There is no need to treat the currently focused window specially.
2017-03-14Restructure display codeMarc André Tanner1-10/+177
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-03-05vis: add file argument to vis_pipe_collectMarc André Tanner1-2/+2
2017-03-03vis-lua: add vis:exit functionMarc André Tanner1-0/+3
2017-02-25vis: tweak handling of end inclusivenessMarc André Tanner1-2/+3
Only extend end of range when the motion did so too. As an example this prevents motions like `$dg_` from deleting the newline which was the starting position.
2017-02-25vis: add vis- prefix to pseudo editor keysMarc André Tanner1-3/+3
2017-02-24vis: remove unused struct memberMarc André Tanner1-4/+3
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-20/+20
$ ./configure --disable-help shrinks the binary by about 20K on a x86_64 system.
2017-02-24vis: fix display after newline insertion at the start of viewportMarc André Tanner1-2/+8
Previously the window content would not be scrolled down when inserting a newline exactly at the start of the display area as in the case when a file starts with an empty line and the following is performed: <PageDown><PageUp><PageUp>o
2017-02-22vis: add exact count motion flagMarc André Tanner1-1/+9
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-10vis: introduce vis_keys_utf8Marc André Tanner1-0/+9
2017-02-07vis: improve text object handlingMarc André Tanner1-3/+12
Fix `gN` and delimited inner variants when given a count.
2017-02-07vis: reformat text object definitionsMarc André Tanner1-1/+1
2017-02-05vis: set $vis_file{name,path} environment variables for external commandsMarc André Tanner1-0/+6
2017-02-05vis: add file argument to vis_pipeMarc André Tanner1-3/+4
2017-02-02Slight code cleanups, use buffer API where appropriateMarc André Tanner1-3/+7
2017-02-01vis: refactor autoindent handlingMarc André Tanner1-37/+44
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-31vis: improve cursor positioning after operators in visual modeMarc André Tanner1-0/+4
Make sure the selection setting code (used to restore selections) does not move the cursor. Fix #479
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-0/+8
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-20vis: slightly cleanup repeat code, always set dot registerMarc André Tanner1-8/+8
2017-01-20vis: improve new line handling at end of fileMarc André Tanner1-2/+18
<Enter> at the end of the file now inserts two newlines, unless there is already one in place. This ensures that in 'normal' operation the file is always new line terminated (as mandated by POSIX). It also means that there is no problem displaying the right amount of ~ symbols at the end of the file. Unlike in vim the cell beyond the end of the file remains adressable even in normal mode. This means something like the following (starting from an empty file) might be a little confusing: o<Escape><Left>dd Because the starting position is beyond the last newline of the file, nothing will be deleted. For now we prefer to avoid the additional complexity, and difference in behavior between normal and insert mode, needed to fix this slight inconsistency. Fix #294
2017-01-19vis: simplify count handling for insertionMarc André Tanner1-1/+1