annotate src/testdir/test_channel_pipe.py @ 33079:5f201b734cb7 v9.0.1826

patch 9.0.1826: keytrans() doesn't translate recorded key typed in a GUI Commit: https://github.com/vim/vim/commit/1bed993c01c4b5e4c6ab55e80e2410ba87de487c Author: zeertzjq <zeertzjq@outlook.com> Date: Wed Aug 30 19:38:24 2023 +0200 patch 9.0.1826: keytrans() doesn't translate recorded key typed in a GUI Problem: keytrans() doesn't translate recorded key typed in a GUI Solution: Handle CSI like K_SPECIAL, like in mb_unescape() closes: #12964 closes: #12966 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author Christian Brabandt <cb@256bit.org>
date Wed, 30 Aug 2023 19:45:03 +0200
parents 06e3c6bac36d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8031
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 #!/usr/bin/python
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 #
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 # Server that will communicate over stdin/stderr
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 #
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 # This requires Python 2.6 or later.
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 from __future__ import print_function
27443
06e3c6bac36d patch 8.2.4250: channel out callback test is flaky on Mac
Bram Moolenaar <Bram@vim.org>
parents: 20293
diff changeset
8 import os
8031
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 import sys
9238
7d13d180a6ae commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents: 9003
diff changeset
10 import time
8031
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 if __name__ == "__main__":
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 if len(sys.argv) > 1:
8455
d0717262d802 commit https://github.com/vim/vim/commit/f65333c9b59654a70f2a07200f65c93dfcaa49b3
Christian Brabandt <cb@256bit.org>
parents: 8447
diff changeset
15 if sys.argv[1].startswith("err"):
d0717262d802 commit https://github.com/vim/vim/commit/f65333c9b59654a70f2a07200f65c93dfcaa49b3
Christian Brabandt <cb@256bit.org>
parents: 8447
diff changeset
16 print(sys.argv[1], file=sys.stderr)
d0717262d802 commit https://github.com/vim/vim/commit/f65333c9b59654a70f2a07200f65c93dfcaa49b3
Christian Brabandt <cb@256bit.org>
parents: 8447
diff changeset
17 sys.stderr.flush()
13010
c522585ce88d patch 8.0.1381: ch_readraw() waits for NL if channel mode is NL
Christian Brabandt <cb@256bit.org>
parents: 10845
diff changeset
18 elif sys.argv[1].startswith("incomplete"):
c522585ce88d patch 8.0.1381: ch_readraw() waits for NL if channel mode is NL
Christian Brabandt <cb@256bit.org>
parents: 10845
diff changeset
19 print(sys.argv[1], end='')
c522585ce88d patch 8.0.1381: ch_readraw() waits for NL if channel mode is NL
Christian Brabandt <cb@256bit.org>
parents: 10845
diff changeset
20 sys.stdout.flush()
c522585ce88d patch 8.0.1381: ch_readraw() waits for NL if channel mode is NL
Christian Brabandt <cb@256bit.org>
parents: 10845
diff changeset
21 sys.exit(0)
15764
208bf8b36075 patch 8.1.0889: MS-Windows: a channel write may hang
Bram Moolenaar <Bram@vim.org>
parents: 15621
diff changeset
22 elif sys.argv[1].startswith("busy"):
208bf8b36075 patch 8.1.0889: MS-Windows: a channel write may hang
Bram Moolenaar <Bram@vim.org>
parents: 15621
diff changeset
23 time.sleep(100)
208bf8b36075 patch 8.1.0889: MS-Windows: a channel write may hang
Bram Moolenaar <Bram@vim.org>
parents: 15621
diff changeset
24 sys.exit(0)
8455
d0717262d802 commit https://github.com/vim/vim/commit/f65333c9b59654a70f2a07200f65c93dfcaa49b3
Christian Brabandt <cb@256bit.org>
parents: 8447
diff changeset
25 else:
d0717262d802 commit https://github.com/vim/vim/commit/f65333c9b59654a70f2a07200f65c93dfcaa49b3
Christian Brabandt <cb@256bit.org>
parents: 8447
diff changeset
26 print(sys.argv[1])
d0717262d802 commit https://github.com/vim/vim/commit/f65333c9b59654a70f2a07200f65c93dfcaa49b3
Christian Brabandt <cb@256bit.org>
parents: 8447
diff changeset
27 sys.stdout.flush()
9003
072556995a8e commit https://github.com/vim/vim/commit/b2658a1ab02cd0ba848164f70c7c464fdc398162
Christian Brabandt <cb@256bit.org>
parents: 8455
diff changeset
28 if sys.argv[1].startswith("quit"):
072556995a8e commit https://github.com/vim/vim/commit/b2658a1ab02cd0ba848164f70c7c464fdc398162
Christian Brabandt <cb@256bit.org>
parents: 8455
diff changeset
29 sys.exit(0)
8031
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30
27443
06e3c6bac36d patch 8.2.4250: channel out callback test is flaky on Mac
Bram Moolenaar <Bram@vim.org>
parents: 20293
diff changeset
31 if os.getenv('CI'):
06e3c6bac36d patch 8.2.4250: channel out callback test is flaky on Mac
Bram Moolenaar <Bram@vim.org>
parents: 20293
diff changeset
32 try:
06e3c6bac36d patch 8.2.4250: channel out callback test is flaky on Mac
Bram Moolenaar <Bram@vim.org>
parents: 20293
diff changeset
33 import thread_util
06e3c6bac36d patch 8.2.4250: channel out callback test is flaky on Mac
Bram Moolenaar <Bram@vim.org>
parents: 20293
diff changeset
34 thread_util.set_high_priority()
06e3c6bac36d patch 8.2.4250: channel out callback test is flaky on Mac
Bram Moolenaar <Bram@vim.org>
parents: 20293
diff changeset
35 except Exception:
06e3c6bac36d patch 8.2.4250: channel out callback test is flaky on Mac
Bram Moolenaar <Bram@vim.org>
parents: 20293
diff changeset
36 pass
06e3c6bac36d patch 8.2.4250: channel out callback test is flaky on Mac
Bram Moolenaar <Bram@vim.org>
parents: 20293
diff changeset
37
8031
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 while True:
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 typed = sys.stdin.readline()
20293
62c209f02b04 patch 8.2.0702: running channel tests may leave running process behind
Bram Moolenaar <Bram@vim.org>
parents: 15764
diff changeset
40 if typed == "": # EOF -- stop
62c209f02b04 patch 8.2.0702: running channel tests may leave running process behind
Bram Moolenaar <Bram@vim.org>
parents: 15764
diff changeset
41 break
8031
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 if typed.startswith("quit"):
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 print("Goodbye!")
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 sys.stdout.flush()
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 break
8384
764dba33605c commit https://github.com/vim/vim/commit/c25558bff4ed10d2642e6f5c016701641c494916
Christian Brabandt <cb@256bit.org>
parents: 8084
diff changeset
46 if typed.startswith("echo "):
8031
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 print(typed[5:-1])
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 sys.stdout.flush()
10845
c31782d57569 patch 8.0.0312: failure when a channel receives a split json message
Christian Brabandt <cb@256bit.org>
parents: 9238
diff changeset
49 if typed.startswith("echosplit "):
c31782d57569 patch 8.0.0312: failure when a channel receives a split json message
Christian Brabandt <cb@256bit.org>
parents: 9238
diff changeset
50 for part in typed[10:-1].split('|'):
c31782d57569 patch 8.0.0312: failure when a channel receives a split json message
Christian Brabandt <cb@256bit.org>
parents: 9238
diff changeset
51 sys.stdout.write(part)
c31782d57569 patch 8.0.0312: failure when a channel receives a split json message
Christian Brabandt <cb@256bit.org>
parents: 9238
diff changeset
52 sys.stdout.flush()
c31782d57569 patch 8.0.0312: failure when a channel receives a split json message
Christian Brabandt <cb@256bit.org>
parents: 9238
diff changeset
53 time.sleep(0.05)
8447
6f26b680c243 commit https://github.com/vim/vim/commit/e98d12105213975f37b8d653bd909bd787a2cda9
Christian Brabandt <cb@256bit.org>
parents: 8384
diff changeset
54 if typed.startswith("double "):
6f26b680c243 commit https://github.com/vim/vim/commit/e98d12105213975f37b8d653bd909bd787a2cda9
Christian Brabandt <cb@256bit.org>
parents: 8384
diff changeset
55 print(typed[7:-1] + "\nAND " + typed[7:-1])
6f26b680c243 commit https://github.com/vim/vim/commit/e98d12105213975f37b8d653bd909bd787a2cda9
Christian Brabandt <cb@256bit.org>
parents: 8384
diff changeset
56 sys.stdout.flush()
9238
7d13d180a6ae commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents: 9003
diff changeset
57 if typed.startswith("split "):
7d13d180a6ae commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents: 9003
diff changeset
58 print(typed[6:-1], end='')
7d13d180a6ae commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents: 9003
diff changeset
59 sys.stdout.flush()
7d13d180a6ae commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents: 9003
diff changeset
60 time.sleep(0.05)
7d13d180a6ae commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents: 9003
diff changeset
61 print(typed[6:-1], end='')
7d13d180a6ae commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents: 9003
diff changeset
62 sys.stdout.flush()
7d13d180a6ae commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents: 9003
diff changeset
63 time.sleep(0.05)
7d13d180a6ae commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents: 9003
diff changeset
64 print(typed[6:-1])
7d13d180a6ae commit https://github.com/vim/vim/commit/bbe8d91e695184771d7e45315258fab8eb3e6b07
Christian Brabandt <cb@256bit.org>
parents: 9003
diff changeset
65 sys.stdout.flush()
8447
6f26b680c243 commit https://github.com/vim/vim/commit/e98d12105213975f37b8d653bd909bd787a2cda9
Christian Brabandt <cb@256bit.org>
parents: 8384
diff changeset
66 if typed.startswith("echoerr "):
8384
764dba33605c commit https://github.com/vim/vim/commit/c25558bff4ed10d2642e6f5c016701641c494916
Christian Brabandt <cb@256bit.org>
parents: 8084
diff changeset
67 print(typed[8:-1], file=sys.stderr)
764dba33605c commit https://github.com/vim/vim/commit/c25558bff4ed10d2642e6f5c016701641c494916
Christian Brabandt <cb@256bit.org>
parents: 8084
diff changeset
68 sys.stderr.flush()
8447
6f26b680c243 commit https://github.com/vim/vim/commit/e98d12105213975f37b8d653bd909bd787a2cda9
Christian Brabandt <cb@256bit.org>
parents: 8384
diff changeset
69 if typed.startswith("doubleerr "):
6f26b680c243 commit https://github.com/vim/vim/commit/e98d12105213975f37b8d653bd909bd787a2cda9
Christian Brabandt <cb@256bit.org>
parents: 8384
diff changeset
70 print(typed[10:-1] + "\nAND " + typed[10:-1], file=sys.stderr)
6f26b680c243 commit https://github.com/vim/vim/commit/e98d12105213975f37b8d653bd909bd787a2cda9
Christian Brabandt <cb@256bit.org>
parents: 8384
diff changeset
71 sys.stderr.flush()
15621
bfbdef46aa7d patch 8.1.0818: MS-Windows: cannot send large data with ch_sendraw()
Bram Moolenaar <Bram@vim.org>
parents: 13010
diff changeset
72 if typed.startswith("XXX"):
bfbdef46aa7d patch 8.1.0818: MS-Windows: cannot send large data with ch_sendraw()
Bram Moolenaar <Bram@vim.org>
parents: 13010
diff changeset
73 print(typed, end='')
bfbdef46aa7d patch 8.1.0818: MS-Windows: cannot send large data with ch_sendraw()
Bram Moolenaar <Bram@vim.org>
parents: 13010
diff changeset
74 sys.stderr.flush()
bfbdef46aa7d patch 8.1.0818: MS-Windows: cannot send large data with ch_sendraw()
Bram Moolenaar <Bram@vim.org>
parents: 13010
diff changeset
75 break
8031
ece323e2b57f commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76