| Age | Commit message (Collapse) | Author | Files | Lines |
|
this is taken from one of my other projects. there was no reason
for there to be 2x the code
tests checking for surrogate characters and non characters were
removed. I see no reason why the user shouldn't be allowed to
insert those characters in text (they exist in the standard).
Also, in the case of non-characters only the first two were being
checked and not the other 64.
|
|
Without also saving and restoring the editor mode when the
selections were added to the cache almost no useful actions can be
performed.
While we are at it the 3 jumplist functions can just be combined
into one.
|
|
As far as I could tell from the code this was supposed to be a
fixed size LRU cache of sets of selection regions. The structure
had a maximum size member but it was never set or used.
Furthermore there was some very complicated management of 2
parallel sets of regions. Instead of that mess just treat the
cache as a circular buffer.
Note that this is really not that useful at the moment. While the
selection regions are saved and restored the editor mode is not.
Therefore the selection is visible but not in any way usable. That
will be fixed in the next commit.
|
|
|
|
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
|
|
This might be controversial to some but for the purposes of the
editor there will never be more than one instance of vis. This
allows the compiler to use more efficient rip relative addressing
in the places where it knows the code is referring to the global
instance.
Once the code is compiling in a single translation unit with all
functions declared static this will allow for much better
optimization.
From the perspective that vis is meant to be a library, which is
what Marc clearly intended, changing vis_new() to vis_init() and
vis_free() to vis_cleanup() is still better design. The library
user should be allowed to place the vis instance wherever they
want in memory.
|
|
The lists were very long and if you need to change anything in
them you need to do so in at least 3 different places to ensure
they remain in sync. The idiomatic way of solving this problem in
C (without using features outside the language) is to use a
sequence of X-macros.
This was motivated by the fact that many of the functions in this
file have names that collide with other names in the program. When
the program is compiled into separate object files this is not a
problem but I want to compile vis in a single translation unit. It
also adds more mental overhead when debugging if you have to keep
track of which file you are in as well as which function you are
in.
The macro definition for the function args is less common but is a
good way of ensuring that if you need to modify the type of the
function pointer (i.e. change its arguments) you will not have to
locate hundreds of locations throughout the code.
This also makes it much easier to potentially refactor the
KeyAction array of structs into separate arrays.
|
|
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>
|
|
|
|
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.
|
|
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.
|
|
This allows better control over styling, as well as potential for
entirely new UI elements implemented entirely using the Lua API.
|
|
|
|
This is in response to a comment left on a35e7ea. Backwards compatibility
is a good idea for at least a release.
|
|
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
|
|
Reading from curs_refresh(3X) from curses, calling doupdate() repeatedly
will cause 'several bursts of output to the screen'. wnoutrefresh() has
the smarts to only copy the changed lines to the copied virtual screen,
but doupdate() does not.
There have been several bug reports related to flickering but all seems
to be inconsistenly reproducible due to different terminal buffering
behavior. See #1032, #327
Unfortunately, when I am using a slow display, I still notice
flickering, so this commit changes the routines for opening new windows
and splitting windows to wait until the last change is finished before
calling doupdate().
|
|
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).
|
|
the message window gets closed like a normal window and nothing calls
this function. In fact, it wasn't even used when it was added 8 years
ago in 979ab79.
|
|
This was missed when pairwise selection combinators were removed in
404bb95..d1d5853.
|
|
|
|
|
|
These are currently not mapped by default but can be enabled by mappings
using their virtual key names.
|
|
This renames the functions and constants implementing the to/till motions.
The new names should indicate that matches are only returned within the
current line (not globally). Apart from the changed virtual key/command
name this contains no functional changes.
|
|
|
|
|
|
|
|
|
|
|
|
Use :, which is a short hand for :0,$ instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Use visual mode and :| to filter text through external commands.
The mapping was already reused for selection complement.
|
|
This should also fix coverity issue 157024.
|
|
Also expose all register slots through the Lua API.
|
|
|
|
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.
|
|
The key binding remain the same, but the selections are now stored on
a per-buffer basis.
|