<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rneovim.git/src/nvim/lua, branch master</title>
<subtitle>Neovim fork with Rahm's personal hacks.</subtitle>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/'/>
<entry>
<title>Merge pull request #42217 from bfredl/redirecting</title>
<updated>2026-10-06T12:33:55+00:00</updated>
<author>
<name>bfredl</name>
<email>bjorn.linse@gmail.com</email>
</author>
<published>2026-10-06T12:33:55+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=cae3a197f74d1f406319ef00a0d2080d98322a00'/>
<id>cae3a197f74d1f406319ef00a0d2080d98322a00</id>
<content type='text'>
fix(lua): regression with `print()` in headless mode when redirecting</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
fix(lua): regression with `print()` in headless mode when redirecting</pre>
</div>
</content>
</entry>
<entry>
<title>fix(lua): regression with `print()` in headless mode</title>
<updated>2026-10-06T09:05:43+00:00</updated>
<author>
<name>bfredl</name>
<email>bjorn.linse@gmail.com</email>
</author>
<published>2026-10-03T11:20:33+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=adc0700dc4589e59de2c17a2f8cfc2ba2fb1181f'/>
<id>adc0700dc4589e59de2c17a2f8cfc2ba2fb1181f</id>
<content type='text'>
This is a bunch of hacks so we can override msg_puts_printf specifically
while still allowing redirecting and "normal" message flow to happen,
as this still has observable side-effects (even with no screen attached,
screenstring() is still valid..)

fixes #42218
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is a bunch of hacks so we can override msg_puts_printf specifically
while still allowing redirecting and "normal" message flow to happen,
as this still has observable side-effects (even with no screen attached,
screenstring() is still valid..)

fixes #42218
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(lua): vim._with({ buf, win }) assertion failure #42244</title>
<updated>2026-10-05T15:57:32+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2026-10-05T15:57:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=7a8b7c04778d334f60766a0c83933b74e4e237b3'/>
<id>7a8b7c04778d334f60766a0c83933b74e4e237b3</id>
<content type='text'>
Problem:
`vim._with({ buf = 0, win = 0 }, f)` fails an assert in ctx_switch().
vim._with() allows `buf` with `win` when `win` shows `buf`, but
nlua_with() passes both, and ctx_switch() takes only one target.

Solution:
Ignore `buf` if `win` is given; the window implies its buffer.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
`vim._with({ buf = 0, win = 0 }, f)` fails an assert in ctx_switch().
vim._with() allows `buf` with `win` when `win` shows `buf`, but
nlua_with() passes both, and ctx_switch() takes only one target.

Solution:
Ignore `buf` if `win` is given; the window implies its buffer.</pre>
</div>
</content>
</entry>
<entry>
<title>feat(lua): in script mode -l, use raw output for print()</title>
<updated>2026-10-02T09:43:56+00:00</updated>
<author>
<name>bfredl</name>
<email>bjorn.linse@gmail.com</email>
</author>
<published>2026-09-24T12:31:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=58ce7218ec9aa85cc090cee4654e4573f6dd8570'/>
<id>58ce7218ec9aa85cc090cee4654e4573f6dd8570</id>
<content type='text'>
consider the following test_script.lua :

    print 'hello\n' -- TWO new lines
    print 'this is \027[31mRED FOR AN AMAZING REASON\027[0m'
    print 'foo'
    print '' -- newline despite empty!
    print 'bar'

    -- a bit later:
    os.execute 'sleep 2' -- CPU goes BRR, cursor in column zero
    print 'more bar'

before this PR, `nvim -l test_script.lua` had some weird behaviors
compared to `lua test_script.lua` or the now removed `nvim -ll
test_script.lua`.

- one extra '\n' at the end of a print is ignored, one would need
  TWO '\n' for a single extra '\n'

- an empty print'' is supposed to print an empty line

- print'\027[31mRED' is being escaped so it does not work

- the cursor gets stuck at the end of a message, instead of after
  emitting the new line, this looks like the CPU lag has something
  to do with the _last_ printed message which is likely not the case.

I consider these behaviors to be unintentional (a consequence of
stragglig through the message.c meta-machine, which is optimized
for message handling in _an interative text editor_) and getting
closer to plain lua behavior would be better.

An alternative would be to restore the builtin print(), but our
implemenation still has some benefits, like try
`print(setmetatable({}, {__tostring=error})` in plain lua..
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
consider the following test_script.lua :

    print 'hello\n' -- TWO new lines
    print 'this is \027[31mRED FOR AN AMAZING REASON\027[0m'
    print 'foo'
    print '' -- newline despite empty!
    print 'bar'

    -- a bit later:
    os.execute 'sleep 2' -- CPU goes BRR, cursor in column zero
    print 'more bar'

before this PR, `nvim -l test_script.lua` had some weird behaviors
compared to `lua test_script.lua` or the now removed `nvim -ll
test_script.lua`.

- one extra '\n' at the end of a print is ignored, one would need
  TWO '\n' for a single extra '\n'

- an empty print'' is supposed to print an empty line

- print'\027[31mRED' is being escaped so it does not work

- the cursor gets stuck at the end of a message, instead of after
  emitting the new line, this looks like the CPU lag has something
  to do with the _last_ printed message which is likely not the case.

I consider these behaviors to be unintentional (a consequence of
stragglig through the message.c meta-machine, which is optimized
for message handling in _an interative text editor_) and getting
closer to plain lua behavior would be better.

An alternative would be to restore the builtin print(), but our
implemenation still has some benefits, like try
`print(setmetatable({}, {__tostring=error})` in plain lua..
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(api): correct Lua command and completion types</title>
<updated>2026-09-28T13:43:14+00:00</updated>
<author>
<name>Lewis Russell</name>
<email>lewis6991@gmail.com</email>
</author>
<published>2026-09-28T13:19:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=b597af006fbb7c94c03ea9e7fa13cab7394b0501'/>
<id>b597af006fbb7c94c03ea9e7fa13cab7394b0501</id>
<content type='text'>
Problem: Command inputs and parsed modifiers have different optional
fields, and completion window IDs are annotated as floating-point
values.

Solution: Separate modifier input and return types, correct integer IDs,
and update the metadata generators and their output.

AI-assisted
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem: Command inputs and parsed modifiers have different optional
fields, and completion window IDs are annotated as floating-point
values.

Solution: Separate modifier input and return types, correct integer IDs,
and update the metadata generators and their output.

AI-assisted
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(lint): fix some warnings in clang-tidy 22</title>
<updated>2026-09-23T13:09:14+00:00</updated>
<author>
<name>bfredl</name>
<email>bjorn.linse@gmail.com</email>
</author>
<published>2026-09-23T09:52:10+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=a4773f1980113e57eeb44f222f9e4cbb8dc73d37'/>
<id>a4773f1980113e57eeb44f222f9e4cbb8dc73d37</id>
<content type='text'>
CI is currently using clang-tidy 21 but prepare for the future
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
CI is currently using clang-tidy 21 but prepare for the future
</pre>
</div>
</content>
</entry>
<entry>
<title>refactor(option): simplify error buffer handling</title>
<updated>2026-09-21T16:29:25+00:00</updated>
<author>
<name>Lewis Russell</name>
<email>lewis6991@gmail.com</email>
</author>
<published>2026-09-21T10:55:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=dc049cf0f98332e181d568d91620390ff2f7506b'/>
<id>dc049cf0f98332e181d568d91620390ff2f7506b</id>
<content type='text'>
Problem: Option validators and setters repeatedly pass error buffers and
their sizes separately. Some setters return messages in static storage.

Solution:

- Add CharBuf for borrowed writable storage, with its length including
  space for a terminating NUL.
- Move option error buffers to the callers that report errors. Preserve
  existing buffer sizes, truncation, and calls that do not need a
  message.
- Consolidate option error formatting and the duplicated code that lists
  valid option values.
- Return error messages directly from do_one_set_option().
- Remove unused arguments from get_option_newval() and
  set_option_value_for().
- Handle legacy TTY assignments in the existing callers and remove the
  redundant compatibility wrapper.
- Reuse CharBuf for Tree-sitter query errors.
- Pass CharBuf through the statusline and statuscolumn builders,
  retaining the buffer sizes provided by their callers, including title
  formatting.

AI-assisted
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem: Option validators and setters repeatedly pass error buffers and
their sizes separately. Some setters return messages in static storage.

Solution:

- Add CharBuf for borrowed writable storage, with its length including
  space for a terminating NUL.
- Move option error buffers to the callers that report errors. Preserve
  existing buffer sizes, truncation, and calls that do not need a
  message.
- Consolidate option error formatting and the duplicated code that lists
  valid option values.
- Return error messages directly from do_one_set_option().
- Remove unused arguments from get_option_newval() and
  set_option_value_for().
- Handle legacy TTY assignments in the existing callers and remove the
  redundant compatibility wrapper.
- Reuse CharBuf for Tree-sitter query errors.
- Pass CharBuf through the statusline and statuscolumn builders,
  retaining the buffer sizes provided by their callers, including title
  formatting.

AI-assisted
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(strings): non fatal errors for [NULL] safety in vim_snprintf</title>
<updated>2026-09-08T10:46:24+00:00</updated>
<author>
<name>bfredl</name>
<email>bjorn.linse@gmail.com</email>
</author>
<published>2026-09-07T11:39:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=97660307f5ac10d01febd7ffba63dfeb24d10351'/>
<id>97660307f5ac10d01febd7ffba63dfeb24d10351</id>
<content type='text'>
context: vim_snprintf provides a "portable" replacement for a system
vsnprintf(). However we rely on system vsnprintf() in places. This
is quite arbitrary. I want to use system vsnprintf() only, and
reduce the machinery in string.c for typval printf only, which will
delet a lot of duplicated code.

The biggest hurdle here is not "portably" (we only support sane c
runtimes) but the following discrepancy: standard libc printf()
considers NULL args to %s to be undefined behavior strictly
while vim_snprintf() _defacto_ allows this by replacement to "[NULL]"

IMO, this should be seen as "graceful" error handling (nicer than crashing
on the user), not a valid means to have the string "[NULL]" intentionally
be shoved in the users face. more robust code should explicitly
check for NULL and replace it with a _appropriate_ fallback for
the situation, depending on what a NULL string actually means in the
context (unnamed buffer? anonymous namespace? global augroup?)

soo, this PR provides the most _gently_ incremental nudge towards
considering this case again as an error one could possible imagine.
If sanitizers are complied in, this minor incursion gets printed
into the sanitizers' log as a "report-and-continue" error with a
traceback. This doesn't annoy the end user or "stop the world"
in the test suite, but the CI will see the reported error and
fail the build, just like other non-fatal CI errors.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
context: vim_snprintf provides a "portable" replacement for a system
vsnprintf(). However we rely on system vsnprintf() in places. This
is quite arbitrary. I want to use system vsnprintf() only, and
reduce the machinery in string.c for typval printf only, which will
delet a lot of duplicated code.

The biggest hurdle here is not "portably" (we only support sane c
runtimes) but the following discrepancy: standard libc printf()
considers NULL args to %s to be undefined behavior strictly
while vim_snprintf() _defacto_ allows this by replacement to "[NULL]"

IMO, this should be seen as "graceful" error handling (nicer than crashing
on the user), not a valid means to have the string "[NULL]" intentionally
be shoved in the users face. more robust code should explicitly
check for NULL and replace it with a _appropriate_ fallback for
the situation, depending on what a NULL string actually means in the
context (unnamed buffer? anonymous namespace? global augroup?)

soo, this PR provides the most _gently_ incremental nudge towards
considering this case again as an error one could possible imagine.
If sanitizers are complied in, this minor incursion gets printed
into the sanitizers' log as a "report-and-continue" error with a
traceback. This doesn't annoy the end user or "stop the world"
in the test suite, but the CI will see the reported error and
fail the build, just like other non-fatal CI errors.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(lua): blast radius of broken `_G.debug` #41507</title>
<updated>2026-08-27T10:14:24+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2026-08-27T10:14:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=02b0c80422bf8b0ae7a3e839d162bb5e28b81e65'/>
<id>02b0c80422bf8b0ae7a3e839d162bb5e28b81e65</id>
<content type='text'>
Problem:
`nlua_pcall()` references `_G.debug.traceback`. If user code deletes it
or breaks it some other way, various Lua features are broken.

    _G.debug = nil
    vim.schedule(function() end)
    vim.wait(100)

    E5113: Lua chunk: attempt to index a nil value
    stack traceback:
            [C]: in function 'loop_poll'
            [string "vim/_core/editor"]:176: in function 'wait'
            crash.lua:3: in main chunk
    PANIC: unprotected error in call to Lua API (attempt to index a nil value)

Solution:
Check `_G.debug.traceback` before using it as errfunc. If it's broken,
omit the traceback and say so in the error message.

Note: We could cache `_G.debug` in LUA_REGISTRYINDEX on startup, but
that would prevent plugins from providing custom functionality there
(and we happen to do so in `tui_spec.lua` for example).</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
`nlua_pcall()` references `_G.debug.traceback`. If user code deletes it
or breaks it some other way, various Lua features are broken.

    _G.debug = nil
    vim.schedule(function() end)
    vim.wait(100)

    E5113: Lua chunk: attempt to index a nil value
    stack traceback:
            [C]: in function 'loop_poll'
            [string "vim/_core/editor"]:176: in function 'wait'
            crash.lua:3: in main chunk
    PANIC: unprotected error in call to Lua API (attempt to index a nil value)

Solution:
Check `_G.debug.traceback` before using it as errfunc. If it's broken,
omit the traceback and say so in the error message.

Note: We could cache `_G.debug` in LUA_REGISTRYINDEX on startup, but
that would prevent plugins from providing custom functionality there
(and we happen to do so in `tui_spec.lua` for example).</pre>
</div>
</content>
</entry>
<entry>
<title>docs: misc #41452</title>
<updated>2026-08-23T16:38:07+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2026-08-23T16:38:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=354ea3bf2a3a11b69fb5eac78b6334e8131ce4c4'/>
<id>354ea3bf2a3a11b69fb5eac78b6334e8131ce4c4</id>
<content type='text'>
Co-authored-by: darkdi &lt;rantovov5@gmail.com&gt;
Co-authored-by: Qiaoxi Guo &lt;28090444+breadtitor@users.noreply.github.com&gt;
Co-authored-by: zaveshaa &lt;zaveshaa@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Co-authored-by: darkdi &lt;rantovov5@gmail.com&gt;
Co-authored-by: Qiaoxi Guo &lt;28090444+breadtitor@users.noreply.github.com&gt;
Co-authored-by: zaveshaa &lt;zaveshaa@gmail.com&gt;</pre>
</div>
</content>
</entry>
</feed>
