<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rneovim.git/test/functional/lua/with_spec.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>fix(api): nvim_buf_call() from expression for window in non-current tabpage #42352</title>
<updated>2026-10-14T15:43:58+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2026-10-14T15:43:58+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=c4452903e37bce5bc80d2b582d8ba54fa1edf89b'/>
<id>c4452903e37bce5bc80d2b582d8ba54fa1edf89b</id>
<content type='text'>
Problem:
- nvim_buf_call() aborts (assert) when called from an expression evaluated
  for a window in another tabpage ('foldexpr', 'statusline'), because
  `curwin` is not in `curtab`.
- After it returns, `curwin` is wrong if it switched windows.
- `vim._with{win=…, keepcwd=true}` does not undo `:lcd` if `win` is in
  another tabpage.

Solution:
- Allow `curwin` outside `curtab`, and restore if it was outside
  `curtab` at `ctx_switch()`.
- Find the target window in any tabpage when restoring its dirs.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
- nvim_buf_call() aborts (assert) when called from an expression evaluated
  for a window in another tabpage ('foldexpr', 'statusline'), because
  `curwin` is not in `curtab`.
- After it returns, `curwin` is wrong if it switched windows.
- `vim._with{win=…, keepcwd=true}` does not undo `:lcd` if `win` is in
  another tabpage.

Solution:
- Allow `curwin` outside `curtab`, and restore if it was outside
  `curtab` at `ctx_switch()`.
- Find the target window in any tabpage when restoring its dirs.</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>test: fix wrong order of args to eq(), neq() #41499</title>
<updated>2026-08-26T11:18:22+00:00</updated>
<author>
<name>zeertzjq</name>
<email>zeertzjq@outlook.com</email>
</author>
<published>2026-08-26T11:18:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=d393abad77c54ea84b1474d30e70517ff00ad334'/>
<id>d393abad77c54ea84b1474d30e70517ff00ad334</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>feat(vim._with): `keepcwd`</title>
<updated>2026-08-06T11:17:07+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2026-08-06T11:16:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=eb19a52b7c235ad5dd86167a6268b1beaf560df8'/>
<id>eb19a52b7c235ad5dd86167a6268b1beaf560df8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>feat(cwd): support explicit chdir (:bcd/:tcd/…) in temp context</title>
<updated>2026-08-06T11:17:07+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2026-08-05T09:20:05+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=1c1dc0558f784a66fb6d0f7dd3bae8d89274ad64'/>
<id>1c1dc0558f784a66fb6d0f7dd3bae8d89274ad64</id>
<content type='text'>
Problem:
- Explicit `:bcd` (etc.) persists from `nvim_buf_call()` but not from an
  autocmd handler targeting a hidden buf (`LspAttach`, `TermRequest`, …),
  which needs a `vim.schedule()` workaround.
- `vim._with()` is supposed to work as a "sandbox", discarding
  side-effects, but it leaks CWD changes: `:lcd` from a `win` context,
  any chdir from a visible-buffer context.

Solution:
- Explicit :cd/:tcd/:bcd during a temp context persists by default.
  - "Ambient" directory changes ('autochdir', existing win-local CWD,
    etc.) are still undone, as before.
- Add `kCtxKeepDirs`: snapshot/restore the target's full CWD state
  (w/b/tp-local, global, cwd). Used by `vim._with()` and `'inccommand'`,
  which must not leak state.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
- Explicit `:bcd` (etc.) persists from `nvim_buf_call()` but not from an
  autocmd handler targeting a hidden buf (`LspAttach`, `TermRequest`, …),
  which needs a `vim.schedule()` workaround.
- `vim._with()` is supposed to work as a "sandbox", discarding
  side-effects, but it leaks CWD changes: `:lcd` from a `win` context,
  any chdir from a visible-buffer context.

Solution:
- Explicit :cd/:tcd/:bcd during a temp context persists by default.
  - "Ambient" directory changes ('autochdir', existing win-local CWD,
    etc.) are still undone, as before.
- Add `kCtxKeepDirs`: snapshot/restore the target's full CWD state
  (w/b/tp-local, global, cwd). Used by `vim._with()` and `'inccommand'`,
  which must not leak state.
</pre>
</div>
</content>
</entry>
<entry>
<title>test(harness): migrate away from magic globals</title>
<updated>2026-07-21T11:22:39+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2026-07-20T15:16:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=6d8c8b18d551d0be0490640c00fabb816727ec10'/>
<id>6d8c8b18d551d0be0490640c00fabb816727ec10</id>
<content type='text'>
Problem:
The magic globals `it`, `describe`, etc., are more trouble than they are
worth.

- Hooking into `after_each` requires `getfenv()` hacks.
- They confuse luals/emmylua, because the top-level `.luarc.json` isn't
  merged with `test/.luarc.json` (apparently a luals limitation?)
- They totally defeat discoverability because the user just has to
  "know" about the various magic symbols.

So they harm DX, which means they serve no purpose at all.

Solution:
- Expose the test API from `testutil`, so tests can call `t.it()`,
  `t.describe()`, etc., in the conventional way.
- Drop `getfenv()` hacks.
- Drop the `setfenv()` injection in `load_chunk`.
- Drop `test/_meta.lua`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
The magic globals `it`, `describe`, etc., are more trouble than they are
worth.

- Hooking into `after_each` requires `getfenv()` hacks.
- They confuse luals/emmylua, because the top-level `.luarc.json` isn't
  merged with `test/.luarc.json` (apparently a luals limitation?)
- They totally defeat discoverability because the user just has to
  "know" about the various magic symbols.

So they harm DX, which means they serve no purpose at all.

Solution:
- Expose the test API from `testutil`, so tests can call `t.it()`,
  `t.describe()`, etc., in the conventional way.
- Drop `getfenv()` hacks.
- Drop the `setfenv()` injection in `load_chunk`.
- Drop `test/_meta.lua`.
</pre>
</div>
</content>
</entry>
<entry>
<title>refactor(ctx): drop aucmd_prepbuf/aucmd_restbuf #40692</title>
<updated>2026-07-11T16:04:31+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2026-07-11T16:04:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=0f1e0a79006f4b758f448606918597e6b213eb5d'/>
<id>0f1e0a79006f4b758f448606918597e6b213eb5d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>feat(lua): add `cwd` context to `vim._with()` #40653</title>
<updated>2026-07-09T11:07:14+00:00</updated>
<author>
<name>Evgeni Chasnovski</name>
<email>evgeni.chasnovski@gmail.com</email>
</author>
<published>2026-07-09T11:07:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=fce6d9a549f9d73a385f8b522f1316267861e0a1'/>
<id>fce6d9a549f9d73a385f8b522f1316267861e0a1</id>
<content type='text'>
Problem: No concise way to execute a callback with temporarily set
  working directory. This might be useful when sourcing nested files to
  allow them to assume that current working directory is their root
  directory.

Solution: Add `cwd` context to `vim._with().`</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem: No concise way to execute a callback with temporarily set
  working directory. This might be useful when sourcing nested files to
  allow them to assume that current working directory is their root
  directory.

Solution: Add `cwd` context to `vim._with().`</pre>
</div>
</content>
</entry>
<entry>
<title>fix(tests): use builtin default attributes in more places</title>
<updated>2026-06-19T17:42:28+00:00</updated>
<author>
<name>bfredl</name>
<email>bjorn.linse@gmail.com</email>
</author>
<published>2026-06-19T07:50:52+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=90157d3790cea38a991f2bf007d86dc7b5cd558d'/>
<id>90157d3790cea38a991f2bf007d86dc7b5cd558d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(lua): make `vim._with()` work with `buf=0` and `win=0` context #39151</title>
<updated>2026-04-18T16:04:28+00:00</updated>
<author>
<name>Evgeni Chasnovski</name>
<email>evgeni.chasnovski@gmail.com</email>
</author>
<published>2026-04-18T16:04:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=3a4cc5db0b8eb1d825a2a57d177853e1b4c90e28'/>
<id>3a4cc5db0b8eb1d825a2a57d177853e1b4c90e28</id>
<content type='text'>
Problem: Using `buf=0`/`win=0` context in `vim._with` should be
  equivalent to using explicit buffer/window identifier respectively.

Solution: Explicitly adjust context in case of `buf=0` or `win=0`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem: Using `buf=0`/`win=0` context in `vim._with` should be
  equivalent to using explicit buffer/window identifier respectively.

Solution: Explicitly adjust context in case of `buf=0` or `win=0`.</pre>
</div>
</content>
</entry>
</feed>
