Skip to content

Commit 30e12b7

Browse files
authored
Merge pull request #129 from vim-denops/fix-buffer
🐛 Ensure `modifiable` in `assign`
2 parents 30aa472 + a0d2d20 commit 30e12b7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

denops_std/buffer/buffer.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ export async function assign(
9898
findFileFormat(text, fileformats) ?? fileformat;
9999
const preprocessor = options.preprocessor ?? ((v: string[]) => v);
100100
const repl = preprocessor(splitText(text, ff));
101-
await batch.batch(denops, async (denops) => {
102-
await fn.setbufvar(denops, bufnr, "&fileformat", ff);
103-
await fn.setbufvar(denops, bufnr, "&fileencoding", enc);
104-
await replace(denops, bufnr, repl);
101+
await modifiable(denops, bufnr, async () => {
102+
await batch.batch(denops, async (denops) => {
103+
await fn.setbufvar(denops, bufnr, "&fileformat", ff);
104+
await fn.setbufvar(denops, bufnr, "&fileencoding", enc);
105+
await replace(denops, bufnr, repl);
106+
});
105107
});
106108
}
107109

0 commit comments

Comments
 (0)