summaryrefslogtreecommitdiff
path: root/vis-lua.c
AgeCommit message (Collapse)Author
2018-01-27vis-complete: send whole paths for completionTwoFinger
text_object_word() was only sending the last part of a pathname to vis-complete. text_object_longword() is better, but sometimes may send a bit too much, so leading delimiters for some languages are stripped additionally.
2017-11-21vis-lua: implement window:closeMarc André Tanner
2017-11-21vis-lua: do not enumerate internal windowsMarc André Tanner
This for example skips the command prompt window.
2017-07-23vis-lua: move marks array to window objectMarc André Tanner
Some marks (only '^ right now) are window specific while others have file file scope. This distinction is currently hidden in the API. Before this commit file.marks[...] would always operate on the currently active window.
2017-07-17vis: specify window in mark related APIMarc André Tanner
This should also fix coverity issue 157024.
2017-07-14vis-lua: make selection first class primitives in Lua APIMarc André Tanner
2017-07-11vis: cleanup register related APIMarc André Tanner
Also expose all register slots through the Lua API.
2017-07-11vis-lua: represent marks as array of rangesMarc André Tanner
2017-07-08vis: cleanup marks implementationMarc André Tanner
We now use ' to refer to marks. Mark a is set using 'am and restored using 'aM while this is slightly harder to type than ma and 'a it is consistent with register usage for yank/put and allows a default mark to be used which is handy for quick selection manipulation primitives.
2017-07-07vis: use marks instead of registers to store selectionsMarc André Tanner
The key binding remain the same, but the selections are now stored on a per-buffer basis.
2017-06-27Merge branch 'theme-tweaks-2' of https://github.com/p-e-w/visMarc André Tanner
Conflicts: view.c
2017-06-15view: do not automatically anchor selections when setting rangeMarc André Tanner
2017-06-15vis: rename uses of Cursor to SelectionMarc André Tanner
2017-06-15view: rename view_cursorsMarc André Tanner
2017-06-15view: rename view_cursors_numberMarc André Tanner
2017-06-15view: rename view_cursors_countMarc André Tanner
2017-06-15view: rename view_cursors_nextMarc André Tanner
2017-06-15view: rename view_cursors_selection_clearMarc André Tanner
2017-06-15view: rename view_cursors_selection_getMarc André Tanner
2017-06-15view: rename view_cursors_primary_{get,set}Marc André Tanner
2017-06-10More theme improvementsPhilipp Emanuel Weidmann
2017-05-27vis-lua: avoid nil values in table returned by vis:mappingMarc André Tanner
Also fix compilation with ./configure --disable-help.
2017-05-27vis-lua: expose functions to unmap key bindingsMarc André Tanner
2017-05-27vis-lua: expose currently active key bindings through APIMarc André Tanner
Close #563
2017-05-03text: remove text_insert_newline functionMarc André Tanner
This is no longer needed because we always insert \n never \r\n.
2017-04-20vis: start cleaning up register related codeMarc André Tanner
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-09vis: remove handling of \r\n line endingsMarc André Tanner
Use something like dos2unix(1) and unix2dos(1), if you need to edit such files.
2017-03-25Merge branch 'master' of https://github.com/joshaw/visMarc André Tanner
2017-03-24vis: properly redraw status bar of windows displaying internal filesMarc André Tanner
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-24vis-lua: register a panic handlerMarc André Tanner
The intention here is to catch any errors in unprotected mode, close the lua state and jump back to the mainloop to give the user the opportunity to take care of unsaved changes. We abuse the infrastructure Lua provides for custom memory allocators to associate our vis instance pointer with the lua state. In the panic handler we can then use lua_getallocf to get our context back. The actual memory allocater is equivalent to the one used by default and just forwards everything to the libc.
2017-03-24vis-lua: use better name for error handling functionMarc André Tanner
2017-03-24vis-lua: adjust return value validation of called lua functionsMarc André Tanner
While the invoked Lua functions are executed in protected mode, the validation of the return values currently happens in unprotected mode. Thus an invaid return value triggers a lua error and because we currently do not have a global panic handler registered this will terminate the editor process. This commit changes the return value validation to silently fall back to default values instead of raising errors. If we want to provide user friendly stack traces showing the origin of the offending value we would have to move the validation into the Lua code.
2017-03-24vis-lua: validate lua state on vis API entry pointsMarc André Tanner
2017-03-22vis-lua: add usage documentation to command_registerJosh Wainwright
2017-03-19vis-lua: allow operators to be defined as lua functionsMarc André Tanner
2017-03-19Move :set horizon option implementaiton to luaMarc André Tanner
2017-03-19Move :set theme option implementation to luaMarc André Tanner
2017-03-19Move :set syntax option implementation to luaMarc André Tanner
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-lua: make vis.win return nil if no window exists yetMarc André Tanner
This is only the case during editor startup before the first window is created.
2017-03-19vis-lua: expose option_unregister functionMarc André Tanner
2017-03-19vis-lua: expose option_register functionMarc André Tanner
2017-03-14Restructure display codeMarc André Tanner
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-07vis-lua: remove vis:open methodMarc André Tanner
The same functionality is available using vis:command and :open. If we decide a distinct API is useful, we should probably also provide a corresponding close method.
2017-03-05vis-lua: expose vis:pipe functionMarc André Tanner
2017-03-03vis-lua: add vis:exit functionMarc André Tanner
2017-03-02vis-lua: fix bogus URL in LDoc commentMarc André Tanner
2017-03-01vis-lua: fix invalid LDoc tagMarc André Tanner
2017-03-01vis-lua: make cursor.pos return nil if cursor position is invalidMarc André Tanner
It remains to be seen whether that is a good idea, but at least it will reveal possible bugs.
2017-03-01vis-lua: document cursor behaviorMarc André Tanner
2017-02-28vis-lua: correctly treat return value of input event handlerMarc André Tanner
Returning true from the event handler, indicating that the keys were consumed, should now prevent insertion as mentioned in the documentation. vis.events.subscribe(vis.events.INPUT, function(key) if key == ' ' then -- do something fancy here return true end end)