| 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.
|
|
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.
|
|
There is a period during vis' initialization where our signal handler
is not yet registered and we potentially lose not handled signals.
This time window is dependent on the lua code executed during
the EVENT_INIT event and can be arbitrary long dependent of the user's
config.
Decrease the window for lost signals by registering our signal handler
and blocking the signals for the rest of the editor's startup
immediately after parsing the command options.
|
|
|
|
|
|
|
|
this is not really useful anymore
|
|
No one was checking this and there is not an error case for this
function.
|
|
|
|
|
|
|
|
|
|
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.
|
|
I think that having structs with the same name be completely
different depending on which part of the program you look at is
even less readable than having functions with same name.
|
|
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.
|
|
Reported by @kyx0r here: https://github.com/kyx0r/nextvi/issues/189#issuecomment-3650406932
The crash is relatively hard to reproduce as it relies on there
being no padding after the end of the memory allocation. This can
only happen if the text size is an exact multiple of the system
page size. In the linked backtrace it->start = 0x7ffff0e00000 and
it->end = 0x7ffff7200000 (page size was likely 4K or 0x1000) so
it->end, which is one past the last byte of the text, was pointing
to an entirely different page. Dereferencing it can cause a
segfault. If it doesn't segfault it is still incorrect to read
beyond the end of the text even if it happens to work due to
padding.
The underlying text_iterator_byte_{next,prev}() functions were
already handling this correctly. The fix is to not throw away
their work.
|
|
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
|
|
|
|
... and make search_{forward,backward} wrapper to that function.
|
|
the return of these functions already give all the necessary
information. this is not c standard library code, we have no need
of such a nonsensical error reporting mechanism
NOTE: since errno needs to be thread local accessing it from
non-libc code ends up being a function call and serves as a
pointless optimization barrier.
|
|
The amount of code we need to detect if this is present and handle
the fallback is more than if we just provide it ourselves.
Also we are passing in a difference of pointers so the argument
type should be ptrdiff_t. This avoids a C brain damage of having
unsigned size type which can wrap around if the caller is careful.
|
|
Just a version bump, no changes required.
|
|
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
|
|
... now that this is made with 12fc09a442939d0af09d700c7a8074cca9b1694e.
This unbreaks `make docker`, which triggered the catch-all target
and failed.
|
|
This commit refactors the lua test runner (`test.sh`) to support
running a test inside `gdb` when the `-d` or `--debug` flag is
passed.
|
|
|
|
Updated README to clarify repository purpose and structure.
|
|
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>
|
|
|
|
|
|
remove $ from environment variable name because environment variables
are referenced by name without it
|
|
Bugfixes:
- Fixed Pascal numeric literals.
- Fixed folding of HTML/XML comments and XML processing
instructions.
- Fixed incorrectly highlighting '..' range operators between
numbers.
Changes:
- Added Janet and todo.txt lexers.
- Updated Python lexer to recognize t-strings.
- Migrated ini and Dart lexers.
- Updated org lexer word lists.
|
|
functions such as [v]snprintf and sscanf require stdio and stdarg.
|
|
This would be less of an issue if vis was compiled as a single
translation unit but even then compiler may not inline them if
they are not marked as static.
|
|
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.
|
|
Having a failure case on allocing a TextSave is stupid. Ideally
there would be no allocations in the file saving path but we have
to replace the braindead dirname(3) with an internal
implementation.
|
|
|
|
|
|
|
|
|
|
This is an amalgamation of the following upstream commits:
- Overhauled API documentation for lexer.lua.
- Fixed Markdown to allow code fence blocks to be indented.
- Use GitHub Pages' Primer theme for documentation.
Build static pages with Jekyll, like GitHub Pages does.
- Migrated systemd lexer.
Thanks to Matěj Cepl.
- Migrated Lisp lexer and highlight character escapes.
Thanks to Matěj Cepl.
- Migrated rpmspec lexer and made some improvements.
Thanks to Matěj Cepl.
- Modernized reST lexer.
Thanks to Matěj Cepl.
- Markdown lexer should just tag the start of a blockquote.
The quote's contents may contain markdown.
- Output lexer can highlight CSI color sequences.
- Allow lexers to define their own fold functions.
- Added custom folder for Markdown headers.
- Added `lexer.line_start`, `lexer.line_end` and `lexer.text_range()`.
- Fixed Markdown lexer to not lex some continuation lines as code.
- Fixed SciTE not using Scintillua's markdown lexer.
- Markdown lexer should not highlight secondary paragraphs in list items as code blocks.
- Have SciTE recognize CMakeLists.txt.
|
|
|
|
|
|
|