Skip to content

Commit 1759cc9

Browse files
authored
Merge pull request #16 from lambdalisue/fix-windows
🐛 Fix several bugs on Windows
2 parents 352daca + 9e65297 commit 1759cc9

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

autoload/guise.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ function! guise#open(address, argv) abort
1111
call s:request(chan, 'edit', [fnamemodify(filename, ':p')])
1212
endfor
1313
endif
14+
call s:close(chan)
1415
qall!
1516
catch
1617
call s:request(chan, 'error', [v:exception, v:throwpoint])
17-
cquit!
18-
finally
1918
call s:close(chan)
19+
cquit!
2020
endtry
2121
endfunction
2222

@@ -56,7 +56,7 @@ else
5656
\ 'mode': 'json',
5757
\ 'drop': 'auto',
5858
\ 'noblock': 1,
59-
\ 'timeout': 60 * 60 * 24 * 7,
59+
\ 'timeout': 60 * 60 * 24 * 7 * 1000,
6060
\})
6161
if ch_status(chan) !=# 'open'
6262
echohl WarningMsg

denops/guise/main.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,21 @@ export async function main(denops: Denops): Promise<void> {
4444
"-N", // No compatible
4545
"-n", // No swapfile
4646
"-X", // Do not try connecting to the X server
47-
"-es", // Ex batch mode
47+
// Ex mode
48+
// On Windows, when `-e` is specified, calls via non-terminal (e.g. job or Deno)
49+
// hang for some reason.
50+
// However, if you do not use `-e`, you will get the following warnings
51+
//
52+
// Vim: Warning: Output is not to a terminal
53+
// Vim: Warning: Input is not from a terminal
54+
//
55+
// For now, we don't know how to deal with these warnings, so we are treating
56+
// them as specifications.
57+
...(denops.meta.platform === "windows" ? [] : ["-e"]),
58+
// Silent batch mode
59+
// On Windows, if `-s` is specified, for some reason, it immediately terminates
60+
// and does not function properly.
61+
...(denops.meta.platform === "windows" ? [] : ["-s"]),
4862
];
4963
} else {
5064
args = [
@@ -53,7 +67,14 @@ export async function main(denops: Denops): Promise<void> {
5367
"--headless",
5468
];
5569
}
56-
await vars.e.set(denops, "EDITOR", `${config.progpath} ${args.join(" ")}`);
70+
const progpath = denops.meta.platform === "windows"
71+
? `"${config.progpath}"`
72+
: `'${config.progpath}'`;
73+
await vars.e.set(
74+
denops,
75+
"EDITOR",
76+
`${progpath} ${args.join(" ")}`,
77+
);
5778
}
5879
}
5980

0 commit comments

Comments
 (0)