K.Takata's patch queue for Vim
Révision | 7f084e4fadf774cccc7566f5c29804fe1ed3847f (tree) |
---|---|
l'heure | 2020-11-25 17:59:02 |
Auteur | K.Takata <kentkt@csc....> |
Commiter | K.Takata |
Add a new patch
@@ -0,0 +1,59 @@ | ||
1 | +# HG changeset patch | |
2 | +# Parent f004115a5421c12c0931df83535d3b1dcee4624a | |
3 | + | |
4 | +diff --git a/src/testdir/test_swap.vim b/src/testdir/test_swap.vim | |
5 | +--- a/src/testdir/test_swap.vim | |
6 | ++++ b/src/testdir/test_swap.vim | |
7 | +@@ -403,6 +403,39 @@ func Test_swap_symlink() | |
8 | + call delete('Xswapdir', 'rf') | |
9 | + endfunc | |
10 | + | |
11 | ++func s:get_unused_pid(base) | |
12 | ++ if has('job') | |
13 | ++ " Execute 'echo' as a temporally job, and return its pid as an unused pid. | |
14 | ++ if has('win32') | |
15 | ++ let cmd = 'cmd /c echo' | |
16 | ++ else | |
17 | ++ let cmd = 'echo' | |
18 | ++ endif | |
19 | ++ let j = job_start(cmd) | |
20 | ++ while job_status(j) ==# 'run' | |
21 | ++ sleep 10m | |
22 | ++ endwhile | |
23 | ++ if job_status(j) ==# 'dead' | |
24 | ++ return job_info(j).process | |
25 | ++ endif | |
26 | ++ endif | |
27 | ++ " Must add four for MS-Windows to see it as a different one. | |
28 | ++ return a:base + 4 | |
29 | ++endfunc | |
30 | ++ | |
31 | ++func s:blob_to_pid(b) | |
32 | ++ return a:b[3] * 16777216 + a:b[2] * 65536 + a:b[1] * 256 + a:b[0] | |
33 | ++endfunc | |
34 | ++ | |
35 | ++func s:pid_to_blob(i) | |
36 | ++ let b = 0z | |
37 | ++ let b[0] = and(a:i, 0xff) | |
38 | ++ let b[1] = and(a:i / 256, 0xff) | |
39 | ++ let b[2] = and(a:i / 65536, 0xff) | |
40 | ++ let b[3] = and(a:i / 16777216, 0xff) | |
41 | ++ return b | |
42 | ++endfunc | |
43 | ++ | |
44 | + func Test_swap_auto_delete() | |
45 | + " Create a valid swapfile by editing a file with a special extension. | |
46 | + split Xtest.scr | |
47 | +@@ -416,9 +449,9 @@ func Test_swap_auto_delete() | |
48 | + " Forget about the file, recreate the swap file, then edit it again. The | |
49 | + " swap file should be automatically deleted. | |
50 | + bwipe! | |
51 | +- " Change the process ID to avoid the "still running" warning. Must add four | |
52 | +- " for MS-Windows to see it as a different one. | |
53 | +- let swapfile_bytes[24] = swapfile_bytes[24] + 4 | |
54 | ++ " Change the process ID to avoid the "still running" warning. | |
55 | ++ let swapfile_bytes[24:27] = s:pid_to_blob(s:get_unused_pid( | |
56 | ++ \ s:blob_to_pid(swapfile_bytes[24:27]))) | |
57 | + call writefile(swapfile_bytes, swapfile_name) | |
58 | + edit Xtest.scr | |
59 | + " will end up using the same swap file after deleting the existing one |
@@ -28,4 +28,5 @@ | ||
28 | 28 | win32-drop-support-for-pre-vista.patch |
29 | 29 | msvc-use-gf-flag.patch |
30 | 30 | win32-disable-quickedit-by-mouse.patch |
31 | +revise-test_swap.patch | |
31 | 32 | fix-config_cache-removal.patch #+rejected |