| Age | Commit message (Collapse) | Author | Files | Lines |
|
... and replace the functions for unsigned integers with their
signed equivalents, using a type cast where needed.
Actually the functions for unsigned integers were deprecated since
lua 5.3...
https://www.lua.org/manual/5.3/manual.html#8.3
Also lua_newstate() requires a third argument since 5.5...
https://www.lua.org/manual/5.5/manual.html#8.3
Finally the key in a for loop is now const, so use a temporary
variable instead.
|
|
|
|
if vis actually wants to be a library exported symbols may need
mark up depending on the platform (eg. __declspec(dllexport)).
This needs to be hidden behind a macro because the way you export
is not the same on every platform.
I did this based on the assumption that vis.h was supposed to be
the only interface to the "vis" library. Since nobody actually
uses vis as a library I have no idea if this is actually correct.
Anyway marking up all prototypes like this allows for one to
convert all functions to static if a single translation unit is
used by inserting at the start:
#define VIS_INTERNAL static
#define VIS_EXPORT static
|
|
Allow theming the replacement characters shown for showspaces, showtabs,
and/or shownewlines.
|
|
A number of plugins, for example vis-spellcheck[0], want to
perform bulk edits on the file text. They may desire for those
edits to be split into multiple undo/redo points. This is
achievable by switching the mode between insert and normal mode
but that has other side effects. Instead introduce a method of
doing this directly.
[0]: https://gitlab.com/muhq/vis-spellcheck
|
|
we already have a function for filtering by a prefix. No need for
snprintf and extra grep process for filtering.
also use simpler buffer_append for appending instead of going
through string formatting
|
|
In the command prompt, press <tab> to get a list of all available
commands and pick one (using vis-menu). This works also after typing the
first letters of a command (p.e. `:la<tab>`).
Co-authored-by: Matěj Cepl <mcepl@cepl.eu>
|
|
These functions were only used for testing the text system. One of
them was moved to text-test.c to continue to facilitate this.
Otherwise these functions are just cluttering up the code and
making it hard to modify.
|
|
|
|
same as buffer commit Array is completely visible
|
|
|
|
Support the old behavior of using vis:pipe(cmd, fullscreen) without
input.
Properly distinguish between vis:pipe(text, cmd, fullscreen) and
vis:pipe(file, range, cmd).
|
|
Currently only Text objects can be piped to external commands.
This is tedious if data not available in any file should be passed
to an external process (e.g. building options and passing them to
vis-menu).
This adds the option to pass a buffer to _vis_pipe and provides wrapper
functions for the original behavior and the new one.
|
|
I already fixed the reason that this even existed (vis_event_emit
getting called at random times when the editor wasn't ready).
The option checking in main() was moved up because I noticed it
was in the wrong place while thinking about where to emit the INIT
event. There is no reason to do a bunch of useless work just to
print the version.
|
|
These are not seperate things and keeping them this way makes
gives this convoluted mess where both Wins and UiWins must have
linked lists to the other Wins and UiWins in the program despite
the fact that neither of them can exist in isolation.
This, like my previous cleanup commits, is part of a larger goal
of properly isolating the various subsystems in vis. Doing so is
required if we ever want to be able to have a vis-server and a
vis-client.
|
|
Same as previous commit each window only has a single View. No
need for it to be stored elsewhere in memory.
|
|
There only exists a single Ui so there is no need to force a
pointer redirection for accessing it.
The Ui member was moved down in vis-core.h to punt around an issue
with the way lua checks for existing objects. It may show up again
as I flatten more structs.
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
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.
|
|
These values are useful for calculating terminal positions.
|
|
This allows better control over styling, as well as potential for
entirely new UI elements implemented entirely using the Lua API.
|
|
|
|
This will break all plugins which currently use Win.viewport.
|
|
Currently, there's no mechanism for defining user styles without risk
of collision with default lexer and theme settings.
Very few lexers use more than 10,
let alone all 64 of the allowed styles, so
UI_STYLE_LEXER_MAX - (no. of user defined styles)
allows for a reasonably large number of user-defined styles
before collision becomes a problem.
|
|
|
|
|
|
When passing an invalid handler type (i.e., any type that isn't a
string, function, or KeyAction) to Vis:map/Window:map, the editor would
map the key to an empty (zeroed) KeyBinding struct. vis_keys_process()
doesn't take this into account, so the key is never consumed from
the input queue, causing the editor to get stuck in an infinite loop.
|
|
|
|
|
|
`SIZE_MAX` cannot be represented accurately in `lua_Number`. A correct
solution probably doesn't exist but we can silence the warning by
explicitly casting to `lua_Number` and changing the comparison to `<`
instead of `<=`.
checkpos() deals with large numbers for file ranges. For most users we
can assume no one is editing files that are `SIZE_MAX` bytes long (many
petabytes). For obscure systems where `SIZE_MAX` is a small number this
will result in a maximum range (in lua) of 1 byte less than before.
fixes #1120: vis-lua.c:504:21: warning: implicit conversion changes value
|
|
I thought I fixed these in the applied patch but I guess they slipped by
|
|
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.
|
|
The first point of this commit is to allow all options to be read from
lua. This has a number of uses for plugin writers. They are grouped into
a couple of tables depending on what they control:
`vis.options`: table with global configuration
`win.options`: table with window specific configuration
The second point is to allow you to set all these options as if they
were simply lua variables. Technically this is already possible by
using `vis:command("set ...")` but personally I think this interface
is cleaner. Note that this already possible for some things like the
current mode (eg. vis.mode = vis.modes.VISUAL). Examples:
`vis.options.ai = true`
`win.options.brk = " !?."`
`win.options = { showeof = true, showtabs = true }
There are a number of related issues and pull requests:
closes #803: Lua API: let plugins read the values of options
closes #812: Window layout property
supersedes/closes #717: Add ability to access tabwidth from Lua
supersedes/closes #1066: expose UI layout and allow it to be set from lua API
|
|
The only place where this behaviour was encountered was in
file_lines_iterator() and it was just being worked around.
|
|
When `file` was made optional the variable was changed to be initialized
by `vis->win->file` instead of a known safe file pointer. If `vis:pipe()`
is called based on the event `FILE_OPEN` the `file` parameter can be
valid even when `vis->win` is not yet present. Assuming `file` was
provided this would be handled later on if vis didn't segfault. By
initializing to NULL when `vis->win` isn't present `file` is given
a chance be handled later. In the case where `file` wasn't given and
`vis->win` is missing an error is thrown and `vis:pipe()` exits.
fixes #1107 - Lua API: vis:pipe() causes a segfault when called before
a window is open
|
|
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).
|
|
|
|
|
|
|
|
This reverts commit 22d4709e8a30c8feb9b4da7d78e0ea6a57af83e8.
erf mentioned[0] that this change broke a plugin. Revert for now
until have time to implement it without that bug.
[0] https://github.com/martanne/vis/issues/1034
|
|
The commit that added vis:message[0] used the existing vis_message_show
function which is used internaly to display lua stack traces. That
function uses the internal error_file. vis_event_emit does not trigger
events for internal files in order to avoid extra lua errors when already
printing a lua stack trace[1]. Due to this setup any usage of vis:message
showed the text in a window with default theme/syntax/status bar colors.
Instead of using the internal vis_message_show function, create a new
window and file that are not marked internal in the same manner as
cmd_help so themes are applied.
[0]: d815268 (vis-lua: implement vis:message(msg))
[1]: d555c90 (vis: properly redraw status bar of windows displaying internal files)
|
|
These are the permission bits of struct stat's st_mode field at the
time of the most recent load/save.
Close #861
|
|
|
|
|
|
|