aboutsummaryrefslogtreecommitdiff
path: root/scripts/lintcommit.lua
diff options
context:
space:
mode:
authorMatthew Chen <mattdev727@gmail.com>2026-03-31 12:27:06 -0700
committerGitHub <noreply@github.com>2026-03-31 15:27:06 -0400
commit410ba8374d6df17b46df9d5f475472e61a5570fe (patch)
tree98c0464cda6819eb8dcd184f571731bef3db6de2 /scripts/lintcommit.lua
parent75e5e37942a64dd7904799661580bb6c7ba3e97e (diff)
downloadrneovim-410ba8374d6df17b46df9d5f475472e61a5570fe.tar.gz
rneovim-410ba8374d6df17b46df9d5f475472e61a5570fe.tar.bz2
rneovim-410ba8374d6df17b46df9d5f475472e61a5570fe.zip
fix(tutor): open a temporary copy instead of original file #38522
Problem: `:Tutor` should open a copy of the tutor file instead of the original. This is because edits modify the original file buffer, and crashes or other misuse could potentially corrupt the original file even if it's WO. Solution: Copy the tutor file to a temp path before opening. Store the original path in `b:tutor_file` so metadata json loading still works. - `tutor#TutorCmd` will now copy the tutor file to a temp path via `tempname()` before opening with `drop`. Store the original path in `b:tutor_file` only after the buffer is created. - `tutor#LoadMetadata` now uses `b:tutor_file` to resolve the JSON path instead of `expand('%')`, which now points to the temp copy buffer - `ftplugin/tutor.vim` does not make the `tutor#LoadMetadata` call anymore. It was guarded by `filereadable(expand('%').'.json')` which fails for the new temp copy path logic . Instead, `tutor#LoadMetadata` is already called directly inside `tutor#TutorCmd` since we are already assumed to enable interactive. Co-authored-by: Phạm Bình An <111893501+brianhuster@users.noreply.github.com>
Diffstat (limited to 'scripts/lintcommit.lua')
0 files changed, 0 insertions, 0 deletions