aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/difftool_spec.lua
Commit message (Collapse)AuthorAge
* test: simplify functional test expectationsLewis Russell2026-10-05
| | | | | | | | | | | | Problem: Repeated default fields and field-by-field assertions obscure the values that each functional test is meant to check. Solution: Add eq_partial() to check selected record fields while preserving list length and order. Use local helpers to fill fixed expected defaults where tests need full equality. Keep explicit absence checks and test-specific values at the call sites. AI-assisted
* test(harness): migrate away from magic globalsJustin M. Keyes2026-07-21
| | | | | | | | | | | | | | | | | | | | | 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`.
* fix(difftool): handle filenames containing spaces #39740Jackson Ludwig2026-05-14
| | | | | | | | | | | Problem: Using the `DiffTool` plugin (e.g. through `nvim -d ...` or `:DiffTool <file1> <file2>` fails if a space is in one of the paths. This occurs because the `diff` wraps the paths with quotes (`'`) if space characters are present, which the line diff regex fails to parse. Solution: Update regex to handle quoted paths by matching the string within the quotes, if it exists.
* feat(difftool): replace old "nvim -d" automatically #38057Tomas Slusny2026-02-28
| | | | | | | | | | Problem: "nvim -d" doesn't leverage nvim.difftool. Solution: If nvim.difftool was enabled via :packadd, automatically handle "nvim -d" on startup. nvim -c "packadd nvim.difftool" -d dir1/ dir2/
* fix(difftool): don't reset quickfix list when closing quickfix window #38088Nicknamess962026-02-28
| | | | | | | | | | | | | | | | | Closing the quickfix window previously triggered a WinClosed autocmd that deleted all difftool autocmds and pushed an empty quickfix list, making the difftool non-functional. Users who close the quickfix window to gain screen real estate for viewing diffs had no way to continue navigating entries. Remove the qf_win tracking and its associated WinClosed autocmd so that closing the quickfix window no longer tears down the difftool state. Closing either diff window still performs full cleanup as before. The BufWinEnter handler no longer passes with_qf to diff_files, so navigating entries while the quickfix window is closed reuses the existing diff layout without forcing a layout rebuild. Fixes #37388
* fix(difftool): fully resolve symlinks when comparing paths #36147Tomas Slusny2025-10-12
| | | | | | | | | | | | | | | | | | | Fixes issue on mac where it was constantly reloading buffers as paths were not being normalized and resolved correctly (in relation to buffer name). Quickfix entry: /var/folders/pt/2s7dzyw12v36tsslrghfgpkr0000gn/T/git-difftool.m95lj8/right/app.vue Buffer name: /private/var/folders/pt/2s7dzyw12v36tsslrghfgpkr0000gn/T/git-difftool.m95lj8/right/app.vue /var was synlinked to /private/var and this was not being properly handled. Also added lazy redraw to avoid too many redraws when this happens in future and added test for symlink handling. Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
* fix(difftool): ensure split layout, use systemlist #36145Tomas Slusny2025-10-12
| | | | | | | | | | - Always open the right window to the right, regardless of 'splitright' setting, ensuring the left window is always leftmost. - Use `vim.fn.systemlist` for diffr output to avoid manual splitting. - Add a test to verify window layout consistency with 'splitright' and 'nosplitright' options. - Escape quotes in git difftool example properly. Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
* feat(plugins): nvim.difftool can compare directories #35448Tomas Slusny2025-10-11
Problem: Built-in diff mode (nvim -d) does not support directory diffing as required by git difftool -d. This makes it difficult to compare entire directories, detect renames, and navigate changes efficiently. Solution: Add a DiffTool plugin and command that enables side-by-side diffing of files and directories in Neovim. The plugin supports rename detection, highlights changes in the quickfix list, and provides a user command for easy invocation. This allows proper integration with git difftool -d for directory comparison. Example git config: ```ini [diff] tool = nvim_difftool [difftool "nvim_difftool"] cmd = nvim -c "packadd nvim.difftool" -c "DiffTool $LOCAL $REMOTE" ``` Signed-off-by: Tomas Slusny <slusnucky@gmail.com> Co-authored-by: Phạm Bình An <111893501+brianhuster@users.noreply.github.com> Co-authored-by: Justin M. Keyes <justinkz@gmail.com>