summaryrefslogtreecommitdiff
path: root/vis-lua.c
AgeCommit message (Collapse)Author
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)
2017-02-28vis-lua: fix wrong return value when setting vis.countMarc André Tanner
2017-02-27vis-lua: make vis:win assignableAlexandre Rames
2017-02-23vis-lua: use shorter type namesMarc André Tanner
2017-02-23vis-lua: cleanup type checks by using #define'sMarc André Tanner
2017-02-23vis-lua: make vis:count assignableMarc André Tanner
2017-02-22vis-lua: expose current count specifier as vis:countMarc André Tanner
2017-02-22vis-lua: expose type meta tables through vis.typesMarc André Tanner
This should allow the Lua code to add new methods even if it has no existing object references.
2017-02-22lua: expose vis:module_exist method, load lexer and lpeg module during startupMarc André Tanner
2017-02-22vis-lua: check for nil return value of text object callbackMarc André Tanner
2017-02-02update comment and readme about lua pathChristian Hesse
Commit 3570869c removed the lexers sub directory from the Lua search path. Update the comment and readme to reflect this change.
2017-02-02add /etc/vis to lua path for system-wide configuration by administratorChristian Hesse
2017-01-27vis-lua: introduce vis:replace functionMarc André Tanner
2017-01-27vis-lua: introduce vis:insert functionMarc André Tanner
2017-01-15vis-lua: pass pending keys to lua key handling functionsMarc André Tanner
2017-01-14vis-lua: allow mode changes by setting vis.modeMarc André Tanner
2017-01-10vis-lua: expose register names as vis:register_names()Marc André Tanner
2017-01-10vis-lua: expose valid marks as vis:mark_names()Marc André Tanner
2016-12-31vis: allow user registered :-commands to specify a help textMarc André Tanner
2016-12-29vis-lua: allow vis:map to set up key aliases and actionsMarc André Tanner
2016-12-29vis-lua: introduce vis:action_registerMarc André Tanner
2016-12-29vis: cleanup key action lifetime managementMarc André Tanner