mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 7.4.1621
Problem: Channel test doesn't work with Python 2.6. Solution: Add number in formatting placeholder. (Wiredool)
This commit is contained in:
@@ -35,7 +35,7 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
|||||||
if received == '':
|
if received == '':
|
||||||
print("=== socket closed ===")
|
print("=== socket closed ===")
|
||||||
break
|
break
|
||||||
print("received: {}".format(received))
|
print("received: {0}".format(received))
|
||||||
|
|
||||||
# We may receive two messages at once. Take the part up to the
|
# We may receive two messages at once. Take the part up to the
|
||||||
# matching "]" (recognized by finding "][").
|
# matching "]" (recognized by finding "][").
|
||||||
@@ -49,7 +49,7 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
|||||||
used = todo[:splitidx + 1]
|
used = todo[:splitidx + 1]
|
||||||
todo = todo[splitidx + 1:]
|
todo = todo[splitidx + 1:]
|
||||||
if used != received:
|
if used != received:
|
||||||
print("using: {}".format(used))
|
print("using: {0}".format(used))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
decoded = json.loads(used)
|
decoded = json.loads(used)
|
||||||
@@ -70,48 +70,48 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
|||||||
# replying to the request.
|
# replying to the request.
|
||||||
cmd = '["ex","call append(\\"$\\",\\"added1\\")"]'
|
cmd = '["ex","call append(\\"$\\",\\"added1\\")"]'
|
||||||
cmd += '["ex","call append(\\"$\\",\\"added2\\")"]'
|
cmd += '["ex","call append(\\"$\\",\\"added2\\")"]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
elif decoded[1] == 'do normal':
|
elif decoded[1] == 'do normal':
|
||||||
# Send a normal command.
|
# Send a normal command.
|
||||||
cmd = '["normal","G$s more\u001b"]'
|
cmd = '["normal","G$s more\u001b"]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
elif decoded[1] == 'eval-works':
|
elif decoded[1] == 'eval-works':
|
||||||
# Send an eval request. We ignore the response.
|
# Send an eval request. We ignore the response.
|
||||||
cmd = '["expr","\\"foo\\" . 123", -1]'
|
cmd = '["expr","\\"foo\\" . 123", -1]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
elif decoded[1] == 'eval-fails':
|
elif decoded[1] == 'eval-fails':
|
||||||
# Send an eval request that will fail.
|
# Send an eval request that will fail.
|
||||||
cmd = '["expr","xxx", -2]'
|
cmd = '["expr","xxx", -2]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
elif decoded[1] == 'eval-error':
|
elif decoded[1] == 'eval-error':
|
||||||
# Send an eval request that works but the result can't
|
# Send an eval request that works but the result can't
|
||||||
# be encoded.
|
# be encoded.
|
||||||
cmd = '["expr","function(\\"tr\\")", -3]'
|
cmd = '["expr","function(\\"tr\\")", -3]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
elif decoded[1] == 'eval-bad':
|
elif decoded[1] == 'eval-bad':
|
||||||
# Send an eval request missing the third argument.
|
# Send an eval request missing the third argument.
|
||||||
cmd = '["expr","xxx"]'
|
cmd = '["expr","xxx"]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
elif decoded[1] == 'malformed1':
|
elif decoded[1] == 'malformed1':
|
||||||
cmd = '["ex",":"]wrong!["ex","smi"]'
|
cmd = '["ex",":"]wrong!["ex","smi"]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
elif decoded[1] == 'malformed2':
|
elif decoded[1] == 'malformed2':
|
||||||
cmd = '"unterminated string'
|
cmd = '"unterminated string'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
# Need to wait for Vim to give up, otherwise the double
|
# Need to wait for Vim to give up, otherwise the double
|
||||||
@@ -119,7 +119,7 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
|||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
elif decoded[1] == 'malformed3':
|
elif decoded[1] == 'malformed3':
|
||||||
cmd = '["ex","missing ]"'
|
cmd = '["ex","missing ]"'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
# Need to wait for Vim to give up, otherwise the ]
|
# Need to wait for Vim to give up, otherwise the ]
|
||||||
@@ -127,37 +127,37 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
|||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
elif decoded[1] == 'split':
|
elif decoded[1] == 'split':
|
||||||
cmd = '["ex","let '
|
cmd = '["ex","let '
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
cmd = 'g:split = 123"]'
|
cmd = 'g:split = 123"]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
elif decoded[1] == 'an expr':
|
elif decoded[1] == 'an expr':
|
||||||
# Send an expr request.
|
# Send an expr request.
|
||||||
cmd = '["expr","setline(\\"$\\", [\\"one\\",\\"two\\",\\"three\\"])"]'
|
cmd = '["expr","setline(\\"$\\", [\\"one\\",\\"two\\",\\"three\\"])"]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
elif decoded[1] == 'call-func':
|
elif decoded[1] == 'call-func':
|
||||||
cmd = '["call","MyFunction",[1,2,3], 0]'
|
cmd = '["call","MyFunction",[1,2,3], 0]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
elif decoded[1] == 'redraw':
|
elif decoded[1] == 'redraw':
|
||||||
cmd = '["redraw",""]'
|
cmd = '["redraw",""]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
elif decoded[1] == 'redraw!':
|
elif decoded[1] == 'redraw!':
|
||||||
cmd = '["redraw","force"]'
|
cmd = '["redraw","force"]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
elif decoded[1] == 'empty-request':
|
elif decoded[1] == 'empty-request':
|
||||||
cmd = '[]'
|
cmd = '[]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
elif decoded[1] == 'eval-result':
|
elif decoded[1] == 'eval-result':
|
||||||
@@ -165,17 +165,17 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
|||||||
response = last_eval
|
response = last_eval
|
||||||
elif decoded[1] == 'call me':
|
elif decoded[1] == 'call me':
|
||||||
cmd = '[0,"we called you"]'
|
cmd = '[0,"we called you"]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "ok"
|
response = "ok"
|
||||||
elif decoded[1] == 'call me again':
|
elif decoded[1] == 'call me again':
|
||||||
cmd = '[0,"we did call you"]'
|
cmd = '[0,"we did call you"]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = ""
|
response = ""
|
||||||
elif decoded[1] == 'send zero':
|
elif decoded[1] == 'send zero':
|
||||||
cmd = '[0,"zero index"]'
|
cmd = '[0,"zero index"]'
|
||||||
print("sending: {}".format(cmd))
|
print("sending: {0}".format(cmd))
|
||||||
self.request.sendall(cmd.encode('utf-8'))
|
self.request.sendall(cmd.encode('utf-8'))
|
||||||
response = "sent zero"
|
response = "sent zero"
|
||||||
elif decoded[1] == 'close me':
|
elif decoded[1] == 'close me':
|
||||||
@@ -199,7 +199,7 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
|||||||
print("no response")
|
print("no response")
|
||||||
else:
|
else:
|
||||||
encoded = json.dumps([decoded[0], response])
|
encoded = json.dumps([decoded[0], response])
|
||||||
print("sending: {}".format(encoded))
|
print("sending: {0}".format(encoded))
|
||||||
self.request.sendall(encoded.encode('utf-8'))
|
self.request.sendall(encoded.encode('utf-8'))
|
||||||
|
|
||||||
# Negative numbers are used for "eval" responses.
|
# Negative numbers are used for "eval" responses.
|
||||||
@@ -212,7 +212,7 @@ class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
|
|||||||
def writePortInFile(port):
|
def writePortInFile(port):
|
||||||
# Write the port number in Xportnr, so that the test knows it.
|
# Write the port number in Xportnr, so that the test knows it.
|
||||||
f = open("Xportnr", "w")
|
f = open("Xportnr", "w")
|
||||||
f.write("{}".format(port))
|
f.write("{0}".format(port))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
@@ -238,7 +238,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
writePortInFile(port)
|
writePortInFile(port)
|
||||||
|
|
||||||
print("Listening on port {}".format(port))
|
print("Listening on port {0}".format(port))
|
||||||
|
|
||||||
# Main thread terminates, but the server continues running
|
# Main thread terminates, but the server continues running
|
||||||
# until server.shutdown() is called.
|
# until server.shutdown() is called.
|
||||||
|
@@ -748,6 +748,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1621,
|
||||||
/**/
|
/**/
|
||||||
1620,
|
1620,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user