mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-02 11:19:22 +02:00
Compare commits
121 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4cc617ec77 | |||
| 7f04847c21 | |||
| 8600ace876 | |||
| 254e00d714 | |||
| 0ba75a9714 | |||
| 1f6ef66254 | |||
| 1d6fbe6540 | |||
| 132006c3d0 | |||
| 40ea1da14b | |||
| ed5a78e11c | |||
| 223b723be0 | |||
| b6ff854d92 | |||
| 922d25f99c | |||
| 93bf558cae | |||
| 81661fb868 | |||
| ec70bdd68a | |||
| 74a97b1ea0 | |||
| 7f0608fb52 | |||
| 8b778d5599 | |||
| a1e24b9bc9 | |||
| a87e2c277e | |||
| b14fbbdd95 | |||
| 203219048f | |||
| cd39bbcd1d | |||
| 7451a718a5 | |||
| e74e8e7d75 | |||
| 910b8aac5d | |||
| 7d63f62460 | |||
| 418f81b5fa | |||
| 0c2c96e47c | |||
| ba093bc000 | |||
| 9a6e33a19b | |||
| 5d54a04598 | |||
| 6aa2cd4be2 | |||
| f8df7addc5 | |||
| acd58ef676 | |||
| d46ae142aa | |||
| 0943a09db8 | |||
| 5cefd40982 | |||
| e2fba9a94a | |||
| 12dcf024e9 | |||
| b6a7737938 | |||
| 97eba78f69 | |||
| 2368917d8f | |||
| 38a55639d6 | |||
| d807036d10 | |||
| a971df849f | |||
| 3bece9fee9 | |||
| 71b0f7b5c0 | |||
| 27f20f6d9f | |||
| f3f4ec59c6 | |||
| 44d571868f | |||
| 16eb4f8800 | |||
| 7b3ca76a45 | |||
| a3be996751 | |||
| 0727d362b4 | |||
| fa4bce7dd2 | |||
| 7707344dde | |||
| 5202a07b33 | |||
| bd7d4b4288 | |||
| e516c39ee9 | |||
| bfa1ffca8b | |||
| f8b7d890f1 | |||
| d090d7bab5 | |||
| 6463ca229c | |||
| 00af60bbb6 | |||
| 9d68c827c3 | |||
| 45c7f05473 | |||
| f02c5cffd8 | |||
| 76467dfcaf | |||
| 7c29f38781 | |||
| 8d6721a6ca | |||
| 7823a3bd2e | |||
| b6a4fee37e | |||
| 6119e6156e | |||
| 0d23826c84 | |||
| 1f56bfdee4 | |||
| 9b472f4242 | |||
| 39b21272d5 | |||
| 2ab375e54e | |||
| f6157284de | |||
| d6a8d48587 | |||
| 1227fce354 | |||
| a483326e3b | |||
| f068dcafcf | |||
| 4d8747cdfc | |||
| 7280140c08 | |||
| 374f09f533 | |||
| e56bf15c16 | |||
| 2fc83fcd1d | |||
| b92abad0c5 | |||
| b5e634ea67 | |||
| cbebd4879c | |||
| ee5aeae22b | |||
| 0fa98e7b85 | |||
| ae8eb3ca92 | |||
| 74f5e65bcc | |||
| 7a84dbe6be | |||
| cb00f03933 | |||
| 79c2c881bb | |||
| dc94a26a64 | |||
| 942d6b2268 | |||
| 768ce2435a | |||
| ea8c219ca8 | |||
| eba6d8c66c | |||
| 595e64e259 | |||
| 5b41cd52dd | |||
| 55fab439a6 | |||
| a6f72ba7c6 | |||
| fbc4b4db3a | |||
| cb4b01230b | |||
| 835dc636a5 | |||
| 7cd3390065 | |||
| c5f98ee987 | |||
| 1701481c53 | |||
| 3712792637 | |||
| 81e7a9c3fb | |||
| 4f8b8faec3 | |||
| 26dfc41335 | |||
| a03f233515 | |||
| ab9fc7e0cf |
@@ -1,4 +1,4 @@
|
||||
*change.txt* For Vim version 7.4. Last change: 2016 Jan 31
|
||||
*change.txt* For Vim version 7.4. Last change: 2016 Feb 10
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -98,10 +98,10 @@ These commands delete text. You can repeat them with the `.` command
|
||||
|
||||
An exception for the d{motion} command: If the motion is not linewise, the
|
||||
start and end of the motion are not in the same line, and there are only
|
||||
blanks before the start and after the end of the motion, the delete becomes
|
||||
linewise. This means that the delete also removes the line of blanks that you
|
||||
might expect to remain. Use the |o_v| operator to force the motion to be
|
||||
characterwise.
|
||||
blanks before the start and there are no non-blanks after the end of the
|
||||
motion, the delete becomes linewise. This means that the delete also removes
|
||||
the line of blanks that you might expect to remain. Use the |o_v| operator to
|
||||
force the motion to be characterwise.
|
||||
|
||||
Trying to delete an empty region of text (e.g., "d0" in the first column)
|
||||
is an error when 'cpoptions' includes the 'E' flag.
|
||||
|
||||
+307
-71
@@ -1,4 +1,4 @@
|
||||
*channel.txt* For Vim version 7.4. Last change: 2016 Feb 05
|
||||
*channel.txt* For Vim version 7.4. Last change: 2016 Feb 16
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -9,36 +9,72 @@
|
||||
DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT
|
||||
|
||||
Vim uses channels to communicate with other processes.
|
||||
A channel uses a socket. *socket-interface*
|
||||
A channel uses a socket or pipes *socket-interface*
|
||||
Jobs can be used to start processes and communicate with them.
|
||||
|
||||
Vim current supports up to 10 simultaneous channels.
|
||||
The Netbeans interface also uses a channel. |netbeans|
|
||||
|
||||
1. Demo |channel-demo|
|
||||
2. Opening a channel |channel-open|
|
||||
3. Using a JSON channel |channel-use|
|
||||
4. Vim commands |channel-commands|
|
||||
5. Using a raw channel |channel-use|
|
||||
6. Job control |job-control|
|
||||
1. Overview |job-channel-overview|
|
||||
2. Channel demo |channel-demo|
|
||||
3. Opening a channel |channel-open|
|
||||
4. Using a JSON or JS channel |channel-use|
|
||||
5. Channel commands |channel-commands|
|
||||
6. Using a RAW or NL channel |channel-raw|
|
||||
7. More channel functions |channel-more|
|
||||
8. Starting a job with a channel |job-start|
|
||||
9. Starting a job without a channel |job-start-nochannel|
|
||||
10. Job options |job-options|
|
||||
11. Controlling a job |job-control|
|
||||
|
||||
{Vi does not have any of these features}
|
||||
{only available when compiled with the |+channel| feature}
|
||||
{only when compiled with the |+channel| feature for channel stuff}
|
||||
{only when compiled with the |+job| feature for job stuff}
|
||||
|
||||
==============================================================================
|
||||
1. Demo *channel-demo*
|
||||
1. Overview *job-channel-overview*
|
||||
|
||||
There are four main types of jobs:
|
||||
1. A deamon, serving several Vim instances.
|
||||
Vim connects to it with a socket.
|
||||
2. One job working with one Vim instance, asynchronously.
|
||||
Uses a socket or pipes.
|
||||
3. A job performing some work for a short time, asynchronously.
|
||||
Uses a socket or pipes.
|
||||
4. Running a filter, synchronously.
|
||||
Uses pipes.
|
||||
|
||||
For when using sockets See |job-start|, |job-may-start| and |channel-open|.
|
||||
For 2 and 3, one or more jobs using pipes, see |job-start|.
|
||||
For 4 use the ":{range}!cmd" command, see |filter|.
|
||||
|
||||
Over the socket and pipes these protocols are available:
|
||||
RAW nothing known, Vim cannot tell where a message ends
|
||||
NL every message ends in a NL (newline) character
|
||||
JSON JSON encoding |json_encode()|
|
||||
JS JavaScript style JSON-like encoding |js_encode()|
|
||||
|
||||
Common combination are:
|
||||
- Using a job connected through pipes in NL mode. E.g., to run a style
|
||||
checker and receive errors and warnings.
|
||||
- Using a deamon, connecting over a socket in JSON mode. E.g. to lookup
|
||||
crosss-refrences in a database.
|
||||
|
||||
==============================================================================
|
||||
2. Channel demo *channel-demo*
|
||||
|
||||
This requires Python. The demo program can be found in
|
||||
$VIMRUNTIME/tools/demoserver.py
|
||||
Run it in one terminal. We will call this T1.
|
||||
|
||||
Run Vim in another terminal. Connect to the demo server with: >
|
||||
let handle = ch_open('localhost:8765')
|
||||
let channel = ch_open('localhost:8765')
|
||||
|
||||
In T1 you should see:
|
||||
=== socket opened === ~
|
||||
|
||||
You can now send a message to the server: >
|
||||
echo ch_sendexpr(handle, 'hello!')
|
||||
echo ch_sendexpr(channel, 'hello!')
|
||||
|
||||
The message is received in T1 and a response is sent back to Vim.
|
||||
You can see the raw messages in T1. What Vim sends is:
|
||||
@@ -54,87 +90,122 @@ And you should see the message in Vim. You can move the cursor a word forward:
|
||||
["normal","w"] ~
|
||||
|
||||
To handle asynchronous communication a callback needs to be used: >
|
||||
func MyHandler(handle, msg)
|
||||
func MyHandler(channel, msg)
|
||||
echo "from the handler: " . a:msg
|
||||
endfunc
|
||||
call ch_sendexpr(handle, 'hello!', "MyHandler")
|
||||
call ch_sendexpr(channel, 'hello!', "MyHandler")
|
||||
Vim will not wait for a response. Now the server can send the response later
|
||||
and MyHandler will be invoked.
|
||||
|
||||
Instead of giving a callback with every send call, it can also be specified
|
||||
when opening the channel: >
|
||||
call ch_close(handle)
|
||||
let handle = ch_open('localhost:8765', {'callback': "MyHandler"})
|
||||
call ch_sendexpr(handle, 'hello!', 0)
|
||||
call ch_close(channel)
|
||||
let channel = ch_open('localhost:8765', {'callback': "MyHandler"})
|
||||
call ch_sendexpr(channel, 'hello!', 0)
|
||||
|
||||
==============================================================================
|
||||
2. Opening a channel *channel-open*
|
||||
3. Opening a channel *channel-open*
|
||||
|
||||
To open a channel: >
|
||||
let handle = ch_open({address} [, {argdict}])
|
||||
let channel = ch_open({address} [, {options}])
|
||||
|
||||
Use |ch_status()| to see if the channel could be opened.
|
||||
|
||||
{address} has the form "hostname:port". E.g., "localhost:8765".
|
||||
|
||||
{argdict} is a dictionary with optional entries:
|
||||
{options} is a dictionary with optional entries:
|
||||
|
||||
"mode" can be: *channel-mode*
|
||||
"json" - Use JSON, see below; most convenient way. Default.
|
||||
"js" - Use JS (JavaScript) encoding, more efficient than JSON.
|
||||
"nl" - Use messages that end in a NL character
|
||||
"raw" - Use raw messages
|
||||
|
||||
*channel-callback*
|
||||
"callback" is a function that is called when a message is received that is not
|
||||
handled otherwise. It gets two arguments: the channel handle and the received
|
||||
message. Example: >
|
||||
func Handle(handle, msg)
|
||||
"callback" A function that is called when a message is received that is
|
||||
not handled otherwise. It gets two arguments: the channel
|
||||
handle and the received message. Example: >
|
||||
func Handle(channel, msg)
|
||||
echo 'Received: ' . a:msg
|
||||
endfunc
|
||||
let handle = ch_open("localhost:8765", 'json', "Handle")
|
||||
let channel = ch_open("localhost:8765", {"callback": "Handle"})
|
||||
<
|
||||
TODO:
|
||||
"err-cb" A function like "callback" but used for stderr. Only for when
|
||||
the channel uses pipes.
|
||||
|
||||
"waittime" is the time to wait for the connection to be made in milliseconds.
|
||||
The default is zero, don't wait, which is useful if the server is supposed to
|
||||
be running already. A negative number waits forever.
|
||||
TODO:
|
||||
"close-cb" A function that is called when the channel gets closed, other
|
||||
than by calling ch_close(). It should be defined like this: >
|
||||
func MyCloseHandler(channel)
|
||||
|
||||
"timeout" is the time to wait for a request when blocking, using
|
||||
ch_sendexpr(). Again in millisecons. The default si 2000 (2 seconds).
|
||||
"waittime" The time to wait for the connection to be made in
|
||||
milliseconds. The default is zero, don't wait, which is
|
||||
useful if the server is supposed to be running already. A
|
||||
negative number waits forever.
|
||||
|
||||
When "mode" is "json" the "msg" argument is the body of the received message,
|
||||
converted to Vim types.
|
||||
"timeout" The time to wait for a request when blocking, using
|
||||
ch_sendexpr(). Again in milliseconds. The default is 2000 (2
|
||||
seconds).
|
||||
|
||||
When "mode" is "json" or "js" the "msg" argument is the body of the received
|
||||
message, converted to Vim types.
|
||||
When "mode" is "raw" the "msg" argument is the whole message as a string.
|
||||
|
||||
When "mode" is "json" the "callback" is optional. When omitted it is only
|
||||
possible to receive a message after sending one.
|
||||
When "mode" is "json" or "js" the "callback" is optional. When omitted it is
|
||||
only possible to receive a message after sending one.
|
||||
|
||||
The handler can be added or changed later: >
|
||||
call ch_setcallback(handle, {callback})
|
||||
When "callback is empty (zero or an empty string) the handler is removed.
|
||||
NOT IMPLEMENTED YET
|
||||
TODO:
|
||||
To change the channel options after opening it use ch_setoptions(). The
|
||||
arguments are similar to what is passed to ch_open(), but "waittime" cannot be
|
||||
given, since that only applies to opening the channel.
|
||||
|
||||
The timeout can be changed later: >
|
||||
call ch_settimeout(handle, {msec})
|
||||
NOT IMPLEMENTED YET
|
||||
The handler can be added or changed: >
|
||||
call ch_setoptions(channel, {'callback': callback})
|
||||
When "callback" is empty (zero or an empty string) the handler is removed.
|
||||
|
||||
The timeout can be changed: >
|
||||
call ch_setoptions(channel, {'timeout': msec})
|
||||
<
|
||||
*E906*
|
||||
Once done with the channel, disconnect it like this: >
|
||||
call ch_close(handle)
|
||||
call ch_close(channel)
|
||||
When a socket is used this will close the socket for both directions. When
|
||||
pipes are used (stdin/stdout/stderr) they are all closed. This might not be
|
||||
what you want! Stopping the job with job_stop() might be better.
|
||||
|
||||
TODO:
|
||||
Currently up to 10 channels can be in use at the same time. *E897*
|
||||
|
||||
When the channel can't be opened you will get an error message.
|
||||
When the channel can't be opened you will get an error message. There is a
|
||||
difference between MS-Windows and Unix: On Unix when the port doesn't exist
|
||||
ch_open() fails quickly. On MS-Windows "waittime" applies.
|
||||
*E898* *E899* *E900* *E901* *E902*
|
||||
|
||||
If there is an error reading or writing a channel it will be closed.
|
||||
*E896* *E630* *E631*
|
||||
|
||||
==============================================================================
|
||||
3. Using a JSON channel *channel-use*
|
||||
4. Using a JSON or JS channel *channel-use*
|
||||
|
||||
If {mode} is "json" then a message can be sent synchronously like this: >
|
||||
let response = ch_sendexpr(handle, {expr})
|
||||
If mode is JSON then a message can be sent synchronously like this: >
|
||||
let response = ch_sendexpr(channel, {expr})
|
||||
This awaits a response from the other side.
|
||||
|
||||
When mode is JS this works the same, except that the messages use
|
||||
JavaScript encoding. See |js_encode()| for the difference.
|
||||
|
||||
To send a message, without handling a response: >
|
||||
call ch_sendexpr(handle, {expr}, 0)
|
||||
call ch_sendexpr(channel, {expr}, 0)
|
||||
|
||||
To send a message and letting the response handled by a specific function,
|
||||
asynchronously: >
|
||||
call ch_sendexpr(handle, {expr}, {callback})
|
||||
call ch_sendexpr(channel, {expr}, {callback})
|
||||
|
||||
Vim will match the response with the request using the message ID. Once the
|
||||
response is received the callback will be invoked. Further responses with the
|
||||
same ID will be ignored. If your server sends back multiple responses you
|
||||
need to send them with ID zero, they will be passed to the channel callback.
|
||||
|
||||
The {expr} is converted to JSON and wrapped in an array. An example of the
|
||||
message that the receiver will get when {expr} is the string "hello":
|
||||
@@ -165,12 +236,13 @@ channel does not have a handler the message is dropped.
|
||||
On read error or ch_close() the string "DETACH" is sent, if still possible.
|
||||
The channel will then be inactive.
|
||||
|
||||
It is also possible to use ch_sendraw() on a JSON or JS channel. The caller
|
||||
is then completely responsible for correct encoding and decoding.
|
||||
|
||||
==============================================================================
|
||||
4. Vim commands *channel-commands*
|
||||
5. Channel commands *channel-commands*
|
||||
|
||||
PARTLY IMPLEMENTED: only "ex" and "normal" work
|
||||
|
||||
With a "json" channel the process can send commands to Vim that will be
|
||||
With a JSON channel the process can send commands to Vim that will be
|
||||
handled by Vim internally, it does not require a handler for the channel.
|
||||
|
||||
Possible commands are: *E903* *E904* *E905*
|
||||
@@ -231,7 +303,8 @@ Here {number} is the same as what was in the request. Use a negative number
|
||||
to avoid confusion with message that Vim sends.
|
||||
|
||||
{result} is the result of the evaluation and is JSON encoded. If the
|
||||
evaluation fails it is the string "ERROR".
|
||||
evaluation fails or the result can't be encoded in JSON it is the string
|
||||
"ERROR".
|
||||
|
||||
|
||||
Command "expr" ~
|
||||
@@ -241,41 +314,204 @@ Example:
|
||||
["expr","setline('$', ['one', 'two', 'three'])"] ~
|
||||
|
||||
==============================================================================
|
||||
5. Using a raw channel *channel-raw*
|
||||
6. Using a RAW or NL channel *channel-raw*
|
||||
|
||||
If mode is RAW or NL then a message can be send like this: >
|
||||
let response = ch_sendraw(channel, {string})
|
||||
|
||||
If {mode} is "raw" then a message can be send like this: >
|
||||
let response = ch_sendraw(handle, {string})
|
||||
The {string} is sent as-is. The response will be what can be read from the
|
||||
channel right away. Since Vim doesn't know how to recognize the end of the
|
||||
message you need to take care of it yourself.
|
||||
message you need to take care of it yourself. The timeout applies for reading
|
||||
the first byte, after that it will not wait for anything more.
|
||||
|
||||
If mode is "nl" you can send a message in a similar way. You are expected
|
||||
to put in the NL after each message. Thus you can also send several messages
|
||||
ending in a NL at once. The response will be the text up to and including the
|
||||
first NL. This can also be just the NL for an empty response.
|
||||
If no NL was read before the channel timeout an empty string is returned.
|
||||
|
||||
To send a message, without expecting a response: >
|
||||
call ch_sendraw(handle, {string}, 0)
|
||||
call ch_sendraw(channel, {string}, 0)
|
||||
The process can send back a response, the channel handler will be called with
|
||||
it.
|
||||
|
||||
To send a message and letting the response handled by a specific function,
|
||||
asynchronously: >
|
||||
call ch_sendraw(handle, {string}, {callback})
|
||||
call ch_sendraw(channel, {string}, {callback})
|
||||
|
||||
This {string} can also be JSON, use |jsonencode()| to create it and
|
||||
|jsondecode()| to handle a received JSON message.
|
||||
This {string} can also be JSON, use |json_encode()| to create it and
|
||||
|json_decode()| to handle a received JSON message.
|
||||
|
||||
It is not possible to use |ch_sendexpr()| on a raw channel.
|
||||
|
||||
==============================================================================
|
||||
6. Job control *job-control*
|
||||
7. More channel functions *channel-more*
|
||||
|
||||
NOT IMPLEMENTED YET
|
||||
|
||||
To start another process: >
|
||||
call startjob({command})
|
||||
|
||||
This does not wait for {command} to exit.
|
||||
To obtain the status of a channel: ch_status(channel). The possible results
|
||||
are:
|
||||
"fail" Failed to open the channel.
|
||||
"open" The channel can be used.
|
||||
"closed" The channel was closed.
|
||||
|
||||
TODO:
|
||||
To objain the job associated with a channel: ch_getjob(channel)
|
||||
|
||||
let handle = startjob({command}, 's') # uses stdin/stdout
|
||||
let handle = startjob({command}, '', {address}) # uses socket
|
||||
let handle = startjob({command}, 'd', {address}) # start if connect fails
|
||||
TODO:
|
||||
To read one message from a channel: >
|
||||
let output = ch_read(channel)
|
||||
This uses the channel timeout. To read without a timeout, just get any
|
||||
message that is available: >
|
||||
let output = ch_read(channel, 0)
|
||||
When no message was available then the result is v:none for a JSON or JS mode
|
||||
channels, an empty string for a RAW or NL channel.
|
||||
|
||||
To read all output from a RAW or NL channel that is available: >
|
||||
let output = ch_readall(channel)
|
||||
To read the error output: >
|
||||
let output = ch_readall(channel, "err")
|
||||
TODO: use channel timeout, no timeout or specify timeout?
|
||||
|
||||
==============================================================================
|
||||
8. Starting a job with a channel *job-start* *job*
|
||||
|
||||
To start a job and open a channel for stdin/stdout/stderr: >
|
||||
let job = job_start(command, {options})
|
||||
|
||||
You can get the channel with: >
|
||||
let channel = job_getchannel(job)
|
||||
|
||||
The channel will use NL mode. If you want another mode it's best to specify
|
||||
this in {options}. When changing the mode later some text may have already
|
||||
been received and not parsed correctly.
|
||||
|
||||
If the command produces a line of output that you want to deal with, specify
|
||||
a handler for stdout: >
|
||||
let job = job_start(command, {"out-cb": "MyHandler"})
|
||||
The function will be called with the channel and a message. You would define
|
||||
it like this: >
|
||||
func MyHandler(channel, msg)
|
||||
|
||||
Without the handler you need to read the output with ch_read().
|
||||
|
||||
The handler defined for "out-cb" will also receive stderr. If you want to
|
||||
handle that separately, add an "err-cb" handler: >
|
||||
let job = job_start(command, {"out-cb": "MyHandler",
|
||||
\ "err-cb": "ErrHandler"})
|
||||
|
||||
You can send a message to the command with ch_sendraw(). If the channel is in
|
||||
JSON or JS mode you can use ch_sendexpr().
|
||||
|
||||
There are several options you can use, see |job-options|.
|
||||
|
||||
TODO:
|
||||
To run a job and read its output once it is done: >
|
||||
|
||||
let job = job_start({command}, {'exit-cb': 'MyHandler'})
|
||||
func MyHandler(job, status)
|
||||
let channel = job_getchannel()
|
||||
let output = ch_readall(channel)
|
||||
" parse output
|
||||
endfunc
|
||||
|
||||
==============================================================================
|
||||
9. Starting a job without a channel *job-start-nochannel*
|
||||
|
||||
To start another process without creating a channel: >
|
||||
let job = job_start(command, {"in-io": "null", "out-io": "null"})
|
||||
|
||||
This starts {command} in the background, Vim does not wait for it to finish.
|
||||
|
||||
TODO:
|
||||
When Vim sees that neither stdin, stdout or stderr are connected, no channel
|
||||
will be created. Often you will want to include redirection in the command to
|
||||
avoid it getting stuck.
|
||||
|
||||
There are several options you can use, see |job-options|.
|
||||
|
||||
TODO: *job-may-start*
|
||||
To start a job only when connecting to an address does not work use
|
||||
job_maystart('command', {address}, {options}), For Example: >
|
||||
let job = job_maystart(command, address, {"waittime": 1000})
|
||||
let channel = job_gethandle(job)
|
||||
|
||||
This comes down to: >
|
||||
let channel = ch_open(address, {"waittime": 0})
|
||||
if ch_status(channel) == "fail"
|
||||
let job = job_start(command)
|
||||
let channel = ch_open(address, {"waittime": 1000})
|
||||
call job_sethandle(channel)
|
||||
endif
|
||||
Note that the specified waittime applies to when the job has been started.
|
||||
This gives the job some time to make the port available.
|
||||
|
||||
==============================================================================
|
||||
10. Job options *job-options*
|
||||
|
||||
The {options} argument in job_start() is a dictionary. All entries are
|
||||
optional. The same options can be used with job_setoptions(job, {options}).
|
||||
|
||||
TODO: *job-out-cb*
|
||||
"callback": handler
|
||||
"out-cb": handler Callback for when there is something to read on
|
||||
stdout.
|
||||
TODO: *job-err-cb*
|
||||
"err-cb": handler Callback for when there is something to read on
|
||||
stderr. Defaults to the same callback as "out-cb".
|
||||
TODO: *job-close-cb*
|
||||
"close-cb": handler Callback for when the channel is closed. Same as
|
||||
"close-cb" on ch_open().
|
||||
TODO: *job-exit-cb*
|
||||
"exit-cb": handler Callback for when the job ends. The arguments are the
|
||||
job and the exit status.
|
||||
TODO: *job-killonexit*
|
||||
"killonexit": 1 Stop the job when Vim exits.
|
||||
"killonexit": 0 Do not stop the job when Vim exits.
|
||||
The default is 1.
|
||||
TODO: *job-term*
|
||||
"term": "open" Start a terminal and connect the job
|
||||
stdin/stdout/stderr to it.
|
||||
|
||||
TODO: *job-in-io*
|
||||
"in-io": "null" disconnect stdin
|
||||
"in-io": "pipe" stdin is connected to the channel (default)
|
||||
"in-io": "file" stdin reads from a file
|
||||
"in-file": "/path/file" the file to read from
|
||||
|
||||
TODO: *job-out-io*
|
||||
"out-io": "null" disconnect stdout
|
||||
"out-io": "pipe" stdout is connected to the channel (default)
|
||||
"out-io": "file" stdout writes to a file
|
||||
"out-file": "/path/file" the file to write to
|
||||
"out-io": "buffer" stdout appends to a buffer
|
||||
"out-buffer": "name" buffer to append to
|
||||
|
||||
TODO: *job-err-io*
|
||||
"err-io": "out" same type as stdout (default)
|
||||
"err-io": "null" disconnect stderr
|
||||
"err-io": "pipe" stderr is connected to the channel
|
||||
"err-io": "file" stderr writes to a file
|
||||
"err-file": "/path/file" the file to write to
|
||||
"err-io": "buffer" stderr appends to a buffer
|
||||
"err-buffer": "name" buffer to append to
|
||||
|
||||
TODO: more options
|
||||
|
||||
|
||||
==============================================================================
|
||||
11. Controlling a job *job-control*
|
||||
|
||||
To get the status of a job: >
|
||||
echo job_status(job)
|
||||
|
||||
To make a job stop running: >
|
||||
job_stop(job)
|
||||
|
||||
This is the normal way to end a job. On Unix it sends a SIGTERM to the job.
|
||||
It is possible to use other ways to stop the job, or even send arbitrary
|
||||
signals. E.g. to force a job to stop, "kill it": >
|
||||
job_stop(job, "kill")
|
||||
|
||||
For more options see |job_stop()|.
|
||||
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
||||
+15
-10
@@ -1,4 +1,4 @@
|
||||
*editing.txt* For Vim version 7.4. Last change: 2016 Feb 01
|
||||
*editing.txt* For Vim version 7.4. Last change: 2016 Feb 11
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -403,16 +403,21 @@ Note there are some commands where this works slightly differently, see
|
||||
Example: >
|
||||
:n **/*.txt
|
||||
Finds files:
|
||||
ttt.txt
|
||||
subdir/ttt.txt
|
||||
a/b/c/d/ttt.txt
|
||||
When non-wildcard characters are used these are only matched in the first
|
||||
directory. Example: >
|
||||
:n /usr/inc**/*.h
|
||||
aaa.txt ~
|
||||
subdir/bbb.txt ~
|
||||
a/b/c/d/ccc.txt ~
|
||||
When non-wildcard characters are used right before or after "**" these are
|
||||
only matched in the top directory. They are not used for directories further
|
||||
down in the tree. For example: >
|
||||
:n /usr/inc**/types.h
|
||||
Finds files:
|
||||
/usr/include/types.h
|
||||
/usr/include/sys/types.h
|
||||
/usr/inc_old/types.h
|
||||
/usr/include/types.h ~
|
||||
/usr/include/sys/types.h ~
|
||||
/usr/inc/old/types.h ~
|
||||
Note that the path with "/sys" is included because it does not need to match
|
||||
"/inc". Thus it's like matching "/usr/inc*/*/*...", not
|
||||
"/usr/inc*/inc*/inc*".
|
||||
|
||||
*backtick-expansion* *`-expansion*
|
||||
On Unix and a few other systems you can also use backticks for the file name
|
||||
argument, for example: >
|
||||
|
||||
+233
-62
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 7.4. Last change: 2016 Feb 05
|
||||
*eval.txt* For Vim version 7.4. Last change: 2016 Feb 16
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -37,7 +37,7 @@ done, the features in this document are not available. See |+eval| and
|
||||
|
||||
1.1 Variable types ~
|
||||
*E712*
|
||||
There are six types of variables:
|
||||
There are nine types of variables:
|
||||
|
||||
Number A 32 or 64 bit signed number. |expr-number| *Number*
|
||||
Examples: -123 0x10 0177
|
||||
@@ -49,9 +49,6 @@ Float A floating point number. |floating-point-format| *Float*
|
||||
String A NUL terminated string of 8-bit unsigned characters (bytes).
|
||||
|expr-string| Examples: "ab\txx\"--" 'x-z''a,c'
|
||||
|
||||
Funcref A reference to a function |Funcref|.
|
||||
Example: function("strlen")
|
||||
|
||||
List An ordered sequence of items |List|.
|
||||
Example: [1, 2, ['a', 'b']]
|
||||
|
||||
@@ -59,6 +56,15 @@ Dictionary An associative, unordered array: Each entry has a key and a
|
||||
value. |Dictionary|
|
||||
Example: {'blue': "#0000ff", 'red': "#ff0000"}
|
||||
|
||||
Funcref A reference to a function |Funcref|.
|
||||
Example: function("strlen")
|
||||
|
||||
Special v:false, v:true, v:none and v:null
|
||||
|
||||
Job Used for a job, see |job_start()|.
|
||||
|
||||
Channel Used for a channel, see |ch_open()|.
|
||||
|
||||
The Number and String types are converted automatically, depending on how they
|
||||
are used.
|
||||
|
||||
@@ -95,15 +101,16 @@ Note that in the command >
|
||||
"foo" is converted to 0, which means FALSE. To test for a non-empty string,
|
||||
use empty(): >
|
||||
:if !empty("foo")
|
||||
< *E745* *E728* *E703* *E729* *E730* *E731*
|
||||
List, Dictionary and Funcref types are not automatically converted.
|
||||
<
|
||||
*E745* *E728* *E703* *E729* *E730* *E731* *E908* *E910* *E913*
|
||||
List, Dictionary, Funcref and Job types are not automatically converted.
|
||||
|
||||
*E805* *E806* *E808*
|
||||
When mixing Number and Float the Number is converted to Float. Otherwise
|
||||
there is no automatic conversion of Float. You can use str2float() for String
|
||||
to Float, printf() for Float to String and float2nr() for Float to Number.
|
||||
|
||||
*E891* *E892* *E893* *E894*
|
||||
*E891* *E892* *E893* *E894* *E907* *E911* *E914*
|
||||
When expecting a Float a Number can also be used, but nothing else.
|
||||
|
||||
*E706* *sticky-type-checking*
|
||||
@@ -864,7 +871,7 @@ These three can be repeated and mixed. Examples:
|
||||
expr8 *expr8*
|
||||
-----
|
||||
expr8[expr1] item of String or |List| *expr-[]* *E111*
|
||||
|
||||
*E909*
|
||||
If expr8 is a Number or String this results in a String that contains the
|
||||
expr1'th single byte from expr8. expr8 is used as a String, expr1 as a
|
||||
Number. This doesn't recognize multi-byte encodings, see |byteidx()| for
|
||||
@@ -1411,7 +1418,7 @@ v:exception The value of the exception most recently caught and not
|
||||
|
||||
*v:false* *false-variable*
|
||||
v:false A Number with value zero. Used to put "false" in JSON. See
|
||||
|jsonencode()|.
|
||||
|json_encode()|.
|
||||
When used as a string this evaluates to "false". >
|
||||
echo v:false
|
||||
< false ~
|
||||
@@ -1551,7 +1558,7 @@ v:mouse_col Column number for a mouse click obtained with |getchar()|.
|
||||
|
||||
*v:none* *none-variable*
|
||||
v:none An empty String. Used to put an empty item in JSON. See
|
||||
|jsonencode()|.
|
||||
|json_encode()|.
|
||||
When used as a number this evaluates to zero.
|
||||
When used as a string this evaluates to "none". >
|
||||
echo v:none
|
||||
@@ -1559,7 +1566,7 @@ v:none An empty String. Used to put an empty item in JSON. See
|
||||
|
||||
*v:null* *null-variable*
|
||||
v:null An empty String. Used to put "null" in JSON. See
|
||||
|jsonencode()|.
|
||||
|json_encode()|.
|
||||
When used as a number this evaluates to zero.
|
||||
When used as a string this evaluates to "null". >
|
||||
echo v:null
|
||||
@@ -1732,7 +1739,7 @@ v:throwpoint The point where the exception most recently caught and not
|
||||
|
||||
*v:true* *true-variable*
|
||||
v:true A Number with value one. Used to put "true" in JSON. See
|
||||
|jsonencode()|.
|
||||
|json_encode()|.
|
||||
When used as a string this evaluates to "true". >
|
||||
echo v:true
|
||||
< true ~
|
||||
@@ -1811,11 +1818,14 @@ call( {func}, {arglist} [, {dict}])
|
||||
any call {func} with arguments {arglist}
|
||||
ceil( {expr}) Float round {expr} up
|
||||
ch_close( {handle}) none close a channel
|
||||
ch_logfile( {fname} [, {mode}]) none start logging channel activity
|
||||
ch_open( {address} [, {argdict})] Number open a channel to {address}
|
||||
ch_sendexpr( {handle}, {expr} [, {callback}])
|
||||
ch_readraw( {handle}) String read from channel {handle}
|
||||
ch_sendexpr( {handle}, {expr} [, {options}])
|
||||
any send {expr} over JSON channel {handle}
|
||||
ch_sendraw( {handle}, {string} [, {callback}])
|
||||
ch_sendraw( {handle}, {string} [, {options}])
|
||||
any send {string} over raw channel {handle}
|
||||
ch_status( {handle}) String status of channel {handle}
|
||||
changenr() Number current change number
|
||||
char2nr( {expr}[, {utf8}]) Number ASCII/UTF8 value of first char in {expr}
|
||||
cindent( {lnum}) Number C indent for line {lnum}
|
||||
@@ -1841,6 +1851,7 @@ delete( {fname} [, {flags}]) Number delete the file or directory {fname}
|
||||
did_filetype() Number TRUE if FileType autocommand event used
|
||||
diff_filler( {lnum}) Number diff filler lines about {lnum}
|
||||
diff_hlID( {lnum}, {col}) Number diff highlighting at {lnum}/{col}
|
||||
disable_char_avail_for_testing({expr}) none test without typeahead
|
||||
empty( {expr}) Number TRUE if {expr} is empty
|
||||
escape( {string}, {chars}) String escape {chars} in {string} with '\'
|
||||
eval( {string}) any evaluate {string} into its value
|
||||
@@ -1947,9 +1958,15 @@ invert( {expr}) Number bitwise invert
|
||||
isdirectory( {directory}) Number TRUE if {directory} is a directory
|
||||
islocked( {expr}) Number TRUE if {expr} is locked
|
||||
items( {dict}) List key-value pairs in {dict}
|
||||
job_getchannel( {job}) Number get the channel handle for {job}
|
||||
job_start( {command} [, {options}]) Job start a job
|
||||
job_status( {job}) String get the status of a job
|
||||
job_stop( {job} [, {how}]) Number stop a job
|
||||
join( {list} [, {sep}]) String join {list} items into one String
|
||||
jsondecode( {string}) any decode JSON
|
||||
jsonencode( {expr}) String encode JSON
|
||||
js_decode( {string}) any decode JS style JSON
|
||||
js_encode( {expr}) String encode JS style JSON
|
||||
json_decode( {string}) any decode JSON
|
||||
json_encode( {expr}) String encode JSON
|
||||
keys( {dict}) List keys in {dict}
|
||||
len( {expr}) Number the length of {expr}
|
||||
libcall( {lib}, {func}, {arg}) String call {func} in library {lib} with {arg}
|
||||
@@ -1969,9 +1986,9 @@ mapcheck( {name}[, {mode} [, {abbr}]])
|
||||
String check for mappings matching {name}
|
||||
match( {expr}, {pat}[, {start}[, {count}]])
|
||||
Number position where {pat} matches in {expr}
|
||||
matchadd( {group}, {pattern}[, {priority}[, {id}]])
|
||||
matchadd( {group}, {pattern}[, {priority}[, {id} [, {dict}]]])
|
||||
Number highlight {pattern} with {group}
|
||||
matchaddpos( {group}, {list}[, {priority}[, {id}]])
|
||||
matchaddpos( {group}, {pos}[, {priority}[, {id}[, {dict}]]])
|
||||
Number highlight positions with {group}
|
||||
matcharg( {nr}) List arguments of |:match|
|
||||
matchdelete( {id}) Number delete match identified by {id}
|
||||
@@ -2263,7 +2280,7 @@ assert_fails({cmd} [, {error}]) *assert_fails()*
|
||||
assert_false({actual} [, {msg}]) *assert_false()*
|
||||
When {actual} is not false an error message is added to
|
||||
|v:errors|, like with |assert_equal()|.
|
||||
A value is false when it is zero. When "{actual}" is not a
|
||||
A value is false when it is zero. When {actual} is not a
|
||||
number the assert fails.
|
||||
When {msg} is omitted an error in the form "Expected False but
|
||||
got {actual}" is produced.
|
||||
@@ -2431,7 +2448,6 @@ bufwinnr({expr}) *bufwinnr()*
|
||||
|:wincmd|.
|
||||
Only deals with the current tab page.
|
||||
|
||||
|
||||
byte2line({byte}) *byte2line()*
|
||||
Return the line number that contains the character at byte
|
||||
count {byte} in the current buffer. This includes the
|
||||
@@ -2666,8 +2682,19 @@ confirm({msg} [, {choices} [, {default} [, {type}]]])
|
||||
don't fit, a vertical layout is used anyway. For some systems
|
||||
the horizontal layout is always used.
|
||||
|
||||
ch_close({handle}) *ch_close()*
|
||||
ch_close({handle}) *ch_close()*
|
||||
Close channel {handle}. See |channel|.
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_logfile( {fname} [, {mode}]) *ch_logfile()*
|
||||
Start logging channel activity to {fname}.
|
||||
When {fname} is an empty string: stop logging.
|
||||
|
||||
When {mode} is omitted or "a" append to the file.
|
||||
When {mode} is "w" start with an empty file.
|
||||
|
||||
The file is flushed after every message, on Unix you can use
|
||||
"tail -f" to see what is going on in real time.
|
||||
|
||||
ch_open({address} [, {argdict}]) *ch_open()*
|
||||
Open a channel to {address}. See |channel|.
|
||||
@@ -2677,36 +2704,61 @@ ch_open({address} [, {argdict}]) *ch_open()*
|
||||
{address} has the form "hostname:port", e.g.,
|
||||
"localhost:8765".
|
||||
|
||||
If {argdict} is given it must be a |Directory|. The optional
|
||||
If {argdict} is given it must be a |Dictionary|. The optional
|
||||
items are:
|
||||
mode "raw" or "json".
|
||||
mode "raw", "js" or "json".
|
||||
Default "json".
|
||||
callback function to call for requests with a zero
|
||||
sequence number. See |channel-callback|.
|
||||
Default: none.
|
||||
waittime Specify connect timeout as milliseconds.
|
||||
Negative means forever.
|
||||
Default: 0.
|
||||
Default: 0 (don't wait)
|
||||
timeout Specify response read timeout value as
|
||||
milliseconds.
|
||||
Default: 2000.
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_sendexpr({handle}, {expr} [, {callback}]) *ch_sendexpr()*
|
||||
Send {expr} over JSON channel {handle}. See |channel-use|.
|
||||
ch_readraw({handle}) *ch_readraw()*
|
||||
Read from channel {handle} and return the received message.
|
||||
This uses the channel timeout. When there is nothing to read
|
||||
within that time an empty string is returned.
|
||||
TODO: depends on channel mode.
|
||||
|
||||
When {callback} is given returns immediately. Without
|
||||
{callback} waits for a JSON response and returns the decoded
|
||||
expression. When there is an error or timeout returns an
|
||||
empty string.
|
||||
ch_sendexpr({handle}, {expr} [, {options}]) *ch_sendexpr()*
|
||||
Send {expr} over channel {handle}. The {expr} is encoded
|
||||
according to the type of channel. The function cannot be used
|
||||
with a raw channel. See |channel-use|. *E912*
|
||||
|
||||
When {callback} is zero no response is expected.
|
||||
Otherwise {callback} must be a Funcref or the name of a
|
||||
function. It is called when the response is received. See
|
||||
|channel-callback|.
|
||||
{options} must be a Dictionary.
|
||||
When "callback" is a Funcref or the name of a function,
|
||||
ch_sendexpr() returns immediately. The callback is invoked
|
||||
when the response is received. See |channel-callback|.
|
||||
|
||||
ch_sendraw({handle}, {string} [, {callback}]) *ch_sendraw()*
|
||||
Send {string} over raw channel {handle}. See |channel-raw|.
|
||||
Works like |ch_sendexpr()|, but does not decode the response.
|
||||
Without "callback" ch_sendexpr() waits for a response and
|
||||
returns the decoded expression. When there is an error or
|
||||
timeout it returns an empty string.
|
||||
|
||||
When "callback" is zero no response is expected.
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_sendraw({handle}, {string} [, {options}]) *ch_sendraw()*
|
||||
Send {string} over channel {handle}.
|
||||
Works like |ch_sendexpr()|, but does not encode the request or
|
||||
decode the response. The caller is responsible for the
|
||||
correct contents. Also does not add a newline for a channel
|
||||
in NL mode, the caller must do that. The NL in the response
|
||||
is removed.
|
||||
See |channel-use|.
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_status({handle}) *ch_status()*
|
||||
Return the status of channel {handle}:
|
||||
"fail" failed to open the channel
|
||||
"open" channel can be used
|
||||
"closed" channel can not be used
|
||||
|
||||
*copy()*
|
||||
copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't
|
||||
@@ -2714,8 +2766,9 @@ copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't
|
||||
When {expr} is a |List| a shallow copy is created. This means
|
||||
that the original |List| can be changed without changing the
|
||||
copy, and vice versa. But the items are identical, thus
|
||||
changing an item changes the contents of both |Lists|. Also
|
||||
see |deepcopy()|.
|
||||
changing an item changes the contents of both |Lists|.
|
||||
A |Dictionary| is copied in a similar way as a |List|.
|
||||
Also see |deepcopy()|.
|
||||
|
||||
cos({expr}) *cos()*
|
||||
Return the cosine of {expr}, measured in radians, as a |Float|.
|
||||
@@ -2823,9 +2876,11 @@ deepcopy({expr}[, {noref}]) *deepcopy()* *E698*
|
||||
different from using {expr} directly.
|
||||
When {expr} is a |List| a full copy is created. This means
|
||||
that the original |List| can be changed without changing the
|
||||
copy, and vice versa. When an item is a |List|, a copy for it
|
||||
is made, recursively. Thus changing an item in the copy does
|
||||
not change the contents of the original |List|.
|
||||
copy, and vice versa. When an item is a |List| or
|
||||
|Dictionary|, a copy for it is made, recursively. Thus
|
||||
changing an item in the copy does not change the contents of
|
||||
the original |List|.
|
||||
A |Dictionary| is copied in a similar way as a |List|.
|
||||
When {noref} is omitted or zero a contained |List| or
|
||||
|Dictionary| is only copied once. All references point to
|
||||
this single copy. With {noref} set to 1 every occurrence of a
|
||||
@@ -2886,11 +2941,23 @@ diff_hlID({lnum}, {col}) *diff_hlID()*
|
||||
The highlight ID can be used with |synIDattr()| to obtain
|
||||
syntax information about the highlighting.
|
||||
|
||||
*disable_char_avail_for_testing()*
|
||||
disable_char_avail_for_testing({expr})
|
||||
When {expr} is 1 the internal char_avail() function will
|
||||
return FALSE. When {expr} is 0 the char_avail() function will
|
||||
function normally.
|
||||
Only use this for a test where typeahead causes the test not
|
||||
to work. E.g., to trigger the CursorMovedI autocommand event.
|
||||
|
||||
empty({expr}) *empty()*
|
||||
Return the Number 1 if {expr} is empty, zero otherwise.
|
||||
A |List| or |Dictionary| is empty when it does not have any
|
||||
items. A Number is empty when its value is zero.
|
||||
|v:false|, |v:none| and |v:null| are empty, |v:true| is not.
|
||||
- A |List| or |Dictionary| is empty when it does not have any
|
||||
items.
|
||||
- A Number and Float is empty when its value is zero.
|
||||
- |v:false|, |v:none| and |v:null| are empty, |v:true| is not.
|
||||
- A Job is empty when it failed to start.
|
||||
- A Channel is empty when it is closed.
|
||||
|
||||
For a long |List| this is much faster than comparing the
|
||||
length with zero.
|
||||
|
||||
@@ -3913,7 +3980,7 @@ glob2regpat({expr}) *glob2regpat()*
|
||||
empty string.
|
||||
|
||||
*globpath()*
|
||||
globpath({path}, {expr} [, {nosuf} [, {list} [, {allinks}]]])
|
||||
globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]])
|
||||
Perform glob() on all directories in {path} and concatenate
|
||||
the results. Example: >
|
||||
:echo globpath(&rtp, "syntax/c.vim")
|
||||
@@ -3939,7 +4006,7 @@ globpath({path}, {expr} [, {nosuf} [, {list} [, {allinks}]]])
|
||||
they are separated by <NL> characters. Example: >
|
||||
:echo globpath(&rtp, "syntax/c.vim", 0, 1)
|
||||
<
|
||||
{allinks} is used as with |glob()|.
|
||||
{alllinks} is used as with |glob()|.
|
||||
|
||||
The "**" item can be used to search in a directory tree.
|
||||
For example, to find all "README.txt" files in the directories
|
||||
@@ -4286,6 +4353,91 @@ items({dict}) *items()*
|
||||
order.
|
||||
|
||||
|
||||
job_getchannel({job}) *job_getchannel()*
|
||||
Get the channel handle that {job} is using.
|
||||
{only available when compiled with the |+job| feature}
|
||||
|
||||
job_start({command} [, {options}]) *job_start()*
|
||||
Start a job and return a Job object. Unlike |system()| and
|
||||
|:!cmd| this does not wait for the job to finish.
|
||||
|
||||
{command} can be a String. This works best on MS-Windows. On
|
||||
Unix it is split up in white-separated parts to be passed to
|
||||
execvp(). Arguments in double quotes can contain white space.
|
||||
|
||||
{command} can be a List, where the first item is the executable
|
||||
and further items are the arguments. All items are converted
|
||||
to String. This works best on Unix.
|
||||
|
||||
On MS-Windows, job_start() makes a GUI application hidden. If
|
||||
want to show it, Use |:!start| instead.
|
||||
|
||||
The command is executed directly, not through a shell, the
|
||||
'shell' option is not used. To use the shell: >
|
||||
let job = job_start(["/bin/sh", "-c", "echo hello"])
|
||||
< Or: >
|
||||
let job = job_start('/bin/sh -c "echo hello"')
|
||||
< Note that this will start two processes, the shell and the
|
||||
command it executes. If you don't want this use the "exec"
|
||||
shell command.
|
||||
|
||||
On Unix $PATH is used to search for the executable only when
|
||||
the command does not contain a slash.
|
||||
|
||||
The job will use the same terminal as Vim. If it reads from
|
||||
stdin the job and Vim will be fighting over input, that
|
||||
doesn't work. Redirect stdin and stdout to avoid problems: >
|
||||
let job = job_start(['sh', '-c', "myserver </dev/null >/dev/null"])
|
||||
<
|
||||
The returned Job object can be used to get the status with
|
||||
|job_status()| and stop the job with |job_stop()|.
|
||||
|
||||
{options} must be a Dictionary. It can contain many optional
|
||||
items, see |job-options|.
|
||||
|
||||
{only available when compiled with the |+job| feature}
|
||||
|
||||
job_status({job}) *job_status()*
|
||||
Returns a String with the status of {job}:
|
||||
"run" job is running
|
||||
"fail" job failed to start
|
||||
"dead" job died or was stopped after running
|
||||
|
||||
{only available when compiled with the |+job| feature}
|
||||
|
||||
job_stop({job} [, {how}]) *job_stop()*
|
||||
Stop the {job}. This can also be used to signal the job.
|
||||
|
||||
When {how} is omitted or is "term" the job will be terminated
|
||||
normally. For Unix SIGTERM is sent. For MS-Windows
|
||||
CTRL_BREAK will be sent. This goes to the process group, thus
|
||||
children may also be affected.
|
||||
|
||||
Other values for Unix:
|
||||
"hup" Unix: SIGHUP
|
||||
"quit" Unix: SIGQUIT
|
||||
"kill" Unix: SIGKILL (strongest way to stop)
|
||||
number Unix: signal with that number
|
||||
|
||||
Other values for MS-Windows:
|
||||
"int" Windows: CTRL_C
|
||||
"kill" Windows: terminate process forcedly
|
||||
Others Windows: CTRL_BREAK
|
||||
|
||||
On Unix the signal is sent to the process group. This means
|
||||
that when the job is "sh -c command" it affects both the shell
|
||||
and the command.
|
||||
|
||||
The result is a Number: 1 if the operation could be executed,
|
||||
0 if "how" is not supported on the system.
|
||||
Note that even when the operation was executed, whether the
|
||||
job was actually stopped needs to be checked with
|
||||
job_status().
|
||||
The status of the job isn't checked, the operation will even
|
||||
be done when Vim thinks the job isn't running.
|
||||
|
||||
{only available when compiled with the |+job| feature}
|
||||
|
||||
join({list} [, {sep}]) *join()*
|
||||
Join the items in {list} together into one String.
|
||||
When {sep} is specified it is put in between the items. If
|
||||
@@ -4297,24 +4449,40 @@ join({list} [, {sep}]) *join()*
|
||||
converted into a string like with |string()|.
|
||||
The opposite function is |split()|.
|
||||
|
||||
jsondecode({string}) *jsondecode()*
|
||||
js_decode({string}) *js_decode()*
|
||||
This is similar to |json_decode()| with these differences:
|
||||
- Object key names do not have to be in quotes.
|
||||
- Empty items in an array (between two commas) are allowed and
|
||||
result in v:none items.
|
||||
|
||||
js_encode({expr}) *js_encode()*
|
||||
This is similar to |json_encode()| with these differences:
|
||||
- Object key names are not in quotes.
|
||||
- v:none items in an array result in an empty item between
|
||||
commas.
|
||||
For example, the Vim object:
|
||||
[1,v:none,{"one":1},v:none] ~
|
||||
Will be encoded as:
|
||||
[1,,{one:1},,] ~
|
||||
While json_encode() would produce:
|
||||
[1,null,{"one":1},null] ~
|
||||
This encoding is valid for JavaScript. It is more efficient
|
||||
than JSON, especially when using an array with optional items.
|
||||
|
||||
|
||||
json_decode({string}) *json_decode()*
|
||||
This parses a JSON formatted string and returns the equivalent
|
||||
in Vim values. See |jsonencode()| for the relation between
|
||||
in Vim values. See |json_encode()| for the relation between
|
||||
JSON and Vim values.
|
||||
The decoding is permissive:
|
||||
- A trailing comma in an array and object is ignored.
|
||||
- An empty item in an array, two commas with nothing or white
|
||||
space in between, results in v:none.
|
||||
- When an object member name is not a string it is converted
|
||||
to a string. E.g. the number 123 is used as the string
|
||||
"123".
|
||||
- More floating point numbers are recognized, e.g. "1." for
|
||||
"1.0".
|
||||
The result must be a valid Vim type:
|
||||
- An empty object member name is not allowed.
|
||||
- Duplicate object member names are not allowed.
|
||||
|
||||
jsonencode({expr}) *jsonencode()*
|
||||
json_encode({expr}) *json_encode()*
|
||||
Encode {expr} as JSON and return this as a string.
|
||||
The encoding is specified in:
|
||||
https://tools.ietf.org/html/rfc7159.html
|
||||
@@ -4329,7 +4497,7 @@ jsonencode({expr}) *jsonencode()*
|
||||
used recursively: {}
|
||||
v:false "false"
|
||||
v:true "true"
|
||||
v:none nothing
|
||||
v:none "null"
|
||||
v:null "null"
|
||||
Note that using v:none is permitted, although the JSON
|
||||
standard does not allow empty items. This can be useful for
|
||||
@@ -4666,7 +4834,7 @@ match({expr}, {pat}[, {start}[, {count}]]) *match()*
|
||||
done like 'magic' is set and 'cpoptions' is empty.
|
||||
|
||||
*matchadd()* *E798* *E799* *E801*
|
||||
matchadd({group}, {pattern}[, {priority}[, {id} [, {dict}]]])
|
||||
matchadd({group}, {pattern}[, {priority}[, {id}[, {dict}]]])
|
||||
Defines a pattern to be highlighted in the current window (a
|
||||
"match"). It will be highlighted with {group}. Returns an
|
||||
identification number (ID), which can be used to delete the
|
||||
@@ -4702,7 +4870,7 @@ matchadd({group}, {pattern}[, {priority}[, {id} [, {dict}]]])
|
||||
highlighted matches. The dict can have the following members:
|
||||
|
||||
conceal Special character to show instead of the
|
||||
match (only for |hl-Conceal| highlighed
|
||||
match (only for |hl-Conceal| highlighted
|
||||
matches, see |:syn-cchar|)
|
||||
|
||||
The number of matches is not limited, as it is the case with
|
||||
@@ -6692,6 +6860,8 @@ type({expr}) The result is a Number, depending on the type of {expr}:
|
||||
Float: 5
|
||||
Boolean: 6 (v:false and v:true)
|
||||
None 7 (v:null and v:none)
|
||||
Job 8
|
||||
Channel 9
|
||||
To avoid the magic numbers it should be used this way: >
|
||||
:if type(myvar) == type(0)
|
||||
:if type(myvar) == type("")
|
||||
@@ -6700,7 +6870,7 @@ type({expr}) The result is a Number, depending on the type of {expr}:
|
||||
:if type(myvar) == type({})
|
||||
:if type(myvar) == type(0.0)
|
||||
:if type(myvar) == type(v:false)
|
||||
:if type(myvar) == type(v:none
|
||||
:if type(myvar) == type(v:none)
|
||||
|
||||
undofile({name}) *undofile()*
|
||||
Return the name of the undo file that would be used for a file
|
||||
@@ -7110,8 +7280,9 @@ listcmds Compiled with commands for the buffer list |:files|
|
||||
and the argument list |arglist|.
|
||||
localmap Compiled with local mappings and abbr. |:map-local|
|
||||
lua Compiled with Lua interface |Lua|.
|
||||
mac Macintosh version of Vim.
|
||||
macunix Macintosh version of Vim, using Unix files (OS-X).
|
||||
mac Any Macintosh version of Vim.
|
||||
macunix Compiled for OS X, with darwin
|
||||
osx Compiled for OS X, with or without darwin
|
||||
menu Compiled with support for |:menu|.
|
||||
mksession Compiled with support for |:mksession|.
|
||||
modify_fname Compiled with file name modifiers. |filename-modifiers|
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*options.txt* For Vim version 7.4. Last change: 2016 Feb 01
|
||||
*options.txt* For Vim version 7.4. Last change: 2016 Feb 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -3109,17 +3109,17 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
|
||||
item default Used for ~
|
||||
stl:c ' ' or '^' statusline of the current window
|
||||
stlnc:c ' ' or '-' statusline of the non-current windows
|
||||
stlnc:c ' ' or '=' statusline of the non-current windows
|
||||
vert:c '|' vertical separators |:vsplit|
|
||||
fold:c '-' filling 'foldtext'
|
||||
diff:c '-' deleted lines of the 'diff' option
|
||||
|
||||
Any one that is omitted will fall back to the default. For "stl" and
|
||||
"stlnc" the space will be used when there is highlighting, '^' or '-'
|
||||
"stlnc" the space will be used when there is highlighting, '^' or '='
|
||||
otherwise.
|
||||
|
||||
Example: >
|
||||
:set fillchars=stl:^,stlnc:-,vert:\|,fold:-,diff:-
|
||||
:set fillchars=stl:^,stlnc:=,vert:\|,fold:-,diff:-
|
||||
< This is similar to the default, except that these characters will also
|
||||
be used when there is highlighting.
|
||||
|
||||
@@ -7710,6 +7710,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
non-keyword characters (white space is preferred). Maximum line
|
||||
length is 510 bytes.
|
||||
To obtain a file to be used here, check out this ftp site:
|
||||
[Sorry this link doesn't work anymore, do you know the right one?]
|
||||
ftp://ftp.ox.ac.uk/pub/wordlists/ First get the README file.
|
||||
To include a comma in a file name precede it with a backslash. Spaces
|
||||
after a comma are ignored, otherwise spaces are included in the file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*repeat.txt* For Vim version 7.4. Last change: 2016 Jan 16
|
||||
*repeat.txt* For Vim version 7.4. Last change: 2016 Feb 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -490,7 +490,7 @@ Additionally, these commands can be used:
|
||||
bt
|
||||
where
|
||||
*>frame*
|
||||
frame N Goes to N bactrace level. + and - signs make movement
|
||||
frame N Goes to N backtrace level. + and - signs make movement
|
||||
relative. E.g., ":frame +3" goes three frames up.
|
||||
*>up*
|
||||
up Goes one level up from call stacktrace.
|
||||
|
||||
+40
-2
@@ -9,6 +9,7 @@ $MYVIMRC starting.txt /*$MYVIMRC*
|
||||
$VIM starting.txt /*$VIM*
|
||||
$VIM-use version5.txt /*$VIM-use*
|
||||
$VIMRUNTIME starting.txt /*$VIMRUNTIME*
|
||||
$VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
% motion.txt /*%*
|
||||
%:. cmdline.txt /*%:.*
|
||||
%:8 cmdline.txt /*%:8*
|
||||
@@ -1235,6 +1236,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
|
||||
+iconv various.txt /*+iconv*
|
||||
+iconv/dyn various.txt /*+iconv\/dyn*
|
||||
+insert_expand various.txt /*+insert_expand*
|
||||
+job various.txt /*+job*
|
||||
+jumplist various.txt /*+jumplist*
|
||||
+keymap various.txt /*+keymap*
|
||||
+langmap various.txt /*+langmap*
|
||||
@@ -4484,7 +4486,16 @@ E902 channel.txt /*E902*
|
||||
E903 channel.txt /*E903*
|
||||
E904 channel.txt /*E904*
|
||||
E905 channel.txt /*E905*
|
||||
E906 channel.txt /*E906*
|
||||
E907 eval.txt /*E907*
|
||||
E908 eval.txt /*E908*
|
||||
E909 eval.txt /*E909*
|
||||
E91 options.txt /*E91*
|
||||
E910 eval.txt /*E910*
|
||||
E911 eval.txt /*E911*
|
||||
E912 eval.txt /*E912*
|
||||
E913 eval.txt /*E913*
|
||||
E914 eval.txt /*E914*
|
||||
E92 message.txt /*E92*
|
||||
E93 windows.txt /*E93*
|
||||
E94 windows.txt /*E94*
|
||||
@@ -5209,9 +5220,12 @@ cc change.txt /*cc*
|
||||
ceil() eval.txt /*ceil()*
|
||||
ch.vim syntax.txt /*ch.vim*
|
||||
ch_close() eval.txt /*ch_close()*
|
||||
ch_logfile() eval.txt /*ch_logfile()*
|
||||
ch_open() eval.txt /*ch_open()*
|
||||
ch_readraw() eval.txt /*ch_readraw()*
|
||||
ch_sendexpr() eval.txt /*ch_sendexpr()*
|
||||
ch_sendraw() eval.txt /*ch_sendraw()*
|
||||
ch_status() eval.txt /*ch_status()*
|
||||
change-list-jumps motion.txt /*change-list-jumps*
|
||||
change-name tips.txt /*change-name*
|
||||
change-tabs change.txt /*change-tabs*
|
||||
@@ -5242,6 +5256,7 @@ channel-callback channel.txt /*channel-callback*
|
||||
channel-commands channel.txt /*channel-commands*
|
||||
channel-demo channel.txt /*channel-demo*
|
||||
channel-mode channel.txt /*channel-mode*
|
||||
channel-more channel.txt /*channel-more*
|
||||
channel-open channel.txt /*channel-open*
|
||||
channel-raw channel.txt /*channel-raw*
|
||||
channel-use channel.txt /*channel-use*
|
||||
@@ -5612,6 +5627,7 @@ dip motion.txt /*dip*
|
||||
dircolors.vim syntax.txt /*dircolors.vim*
|
||||
dis motion.txt /*dis*
|
||||
disable-menus gui.txt /*disable-menus*
|
||||
disable_char_avail_for_testing() eval.txt /*disable_char_avail_for_testing()*
|
||||
discard editing.txt /*discard*
|
||||
distribute-script usr_41.txt /*distribute-script*
|
||||
distribution intro.txt /*distribution*
|
||||
@@ -6869,11 +6885,32 @@ java-indenting indent.txt /*java-indenting*
|
||||
java.vim syntax.txt /*java.vim*
|
||||
javascript-cinoptions indent.txt /*javascript-cinoptions*
|
||||
javascript-indenting indent.txt /*javascript-indenting*
|
||||
job channel.txt /*job*
|
||||
job-channel-overview channel.txt /*job-channel-overview*
|
||||
job-close-cb channel.txt /*job-close-cb*
|
||||
job-control channel.txt /*job-control*
|
||||
job-err-cb channel.txt /*job-err-cb*
|
||||
job-err-io channel.txt /*job-err-io*
|
||||
job-exit-cb channel.txt /*job-exit-cb*
|
||||
job-in-io channel.txt /*job-in-io*
|
||||
job-killonexit channel.txt /*job-killonexit*
|
||||
job-may-start channel.txt /*job-may-start*
|
||||
job-options channel.txt /*job-options*
|
||||
job-out-cb channel.txt /*job-out-cb*
|
||||
job-out-io channel.txt /*job-out-io*
|
||||
job-start channel.txt /*job-start*
|
||||
job-start-nochannel channel.txt /*job-start-nochannel*
|
||||
job-term channel.txt /*job-term*
|
||||
job_getchannel() eval.txt /*job_getchannel()*
|
||||
job_start() eval.txt /*job_start()*
|
||||
job_status() eval.txt /*job_status()*
|
||||
job_stop() eval.txt /*job_stop()*
|
||||
join() eval.txt /*join()*
|
||||
js_decode() eval.txt /*js_decode()*
|
||||
js_encode() eval.txt /*js_encode()*
|
||||
jsbterm-mouse options.txt /*jsbterm-mouse*
|
||||
jsondecode() eval.txt /*jsondecode()*
|
||||
jsonencode() eval.txt /*jsonencode()*
|
||||
json_decode() eval.txt /*json_decode()*
|
||||
json_encode() eval.txt /*json_encode()*
|
||||
jtags tagsrch.txt /*jtags*
|
||||
jump-motions motion.txt /*jump-motions*
|
||||
jumplist motion.txt /*jumplist*
|
||||
@@ -8664,6 +8701,7 @@ undo-tree undo.txt /*undo-tree*
|
||||
undo-two-ways undo.txt /*undo-two-ways*
|
||||
undo.txt undo.txt /*undo.txt*
|
||||
undo_ftplugin usr_41.txt /*undo_ftplugin*
|
||||
undo_indent usr_41.txt /*undo_indent*
|
||||
undofile() eval.txt /*undofile()*
|
||||
undotree() eval.txt /*undotree()*
|
||||
unicode mbyte.txt /*unicode*
|
||||
|
||||
+111
-46
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 7.4. Last change: 2016 Feb 04
|
||||
*todo.txt* For Vim version 7.4. Last change: 2016 Feb 15
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -34,6 +34,100 @@ not be repeated below, unless there is extra information.
|
||||
*known-bugs*
|
||||
-------------------- Known bugs and current work -----------------------
|
||||
|
||||
+channel:
|
||||
- Move netbeans NL handling to channel.c, use it for NL mode channel
|
||||
- ch_open fails when socket isn't present yet. (Marcin Szamotulski)
|
||||
Retry when error is "connection refused".
|
||||
- channel test waittime is disabled for MS-Windows, causes a crash.
|
||||
- channel needs both stdout and stderr (GUI implementation)
|
||||
- implement TODO items in ":help channel":
|
||||
- implement ch_setoptions(handle, {options})
|
||||
- job_setoptions(job, {options})
|
||||
- ch_close() closes stdin/stdout/stderr
|
||||
- out-cb
|
||||
- err-cb
|
||||
- exit-cb move code from mch_clear_job()
|
||||
- job argument: killonexit
|
||||
- ch_read() for stderr
|
||||
- ch_getjob(handle)
|
||||
- ch_read(handle [, timeout])
|
||||
- ch_readall(handle [, timeout])
|
||||
- job_info() should remove usable info: process ID, run/dead, etc.
|
||||
- job_maystart()
|
||||
- job_gethandle(), job_sethandle()
|
||||
- add ch_status(): Whether channel is open. Perhaps also mode, timeout.
|
||||
- When channel closes invoke "close-cb".
|
||||
- Move more details from eval.txt to channel.txt. Add tags in eval.txt.
|
||||
- When receiving malformed json starting with a quote it doesn't get
|
||||
discarded.
|
||||
- When message in queue but there is no callback, drop it after a while?
|
||||
- Crash when closing channel after ch_sendexpr() with callback and outstanding
|
||||
request (Christian Robinson).
|
||||
- cleanup on exit? in mch_getout() and getout().
|
||||
- On Mac a 1 msec waittime is needed in ch_open(), why?
|
||||
- Add more log calls, basically at every branch, before every callback, etc.
|
||||
- Add timestamp to queued messages and callbacks with ID, remove after a
|
||||
minute.
|
||||
- add remark about undo sync, is there a way to force it?
|
||||
- When starting a job, have an option to open the server socket, so we know
|
||||
the port, and pass it to the command with --socket-fd {nr}. (Olaf Dabrunz,
|
||||
Feb 9) How to do this on MS-Windows?
|
||||
- Add more unit-testing in json_test.c
|
||||
- Add a test where ["eval","getline(123)"] gets a line with special
|
||||
characters (NUL, 0x80, etc.). Check that it isn't garbled.
|
||||
- make sure errors lead to a useful error msg. ["ex","foobar"]
|
||||
- json: implement UTF-16 surrogate pair.
|
||||
- For connection to server, a "keep open" flag would be useful. Retry
|
||||
connecting in the main loop with zero timeout.
|
||||
More plugin support:
|
||||
- Have a way to install a callback from the main loop. Called every second or
|
||||
so.
|
||||
- Need way to uniquely identify a window, no matter how windows are
|
||||
rearranged. Same for tab pages.
|
||||
getwinid() ID of current winow
|
||||
getwinid({nr}) ID of window {nr}
|
||||
getwinid({nr}, {tab}) ID of window {nr} in tab page {tab}
|
||||
getwinnr({id}) window nr of {id} or -1 if not open
|
||||
gettabnr({id}) tab page nr of {id} or -1 if not open
|
||||
gotowin({id})
|
||||
Make it so that the window ID can be used where currently a window nr is used
|
||||
|
||||
Patch on #608: (Ken Takata)
|
||||
https://bitbucket.org/k_takata/vim-ktakata-mq/src/479934b94fd56b064c9e4bd8737585c5df69d56a/fix-gvimext-loadlibrary.patch?fileviewer=file-view-default
|
||||
|
||||
This difference is unexpected:
|
||||
echo v:true == 1
|
||||
1
|
||||
echo [v:true] == [1]
|
||||
0
|
||||
It's because tv_equal() works different.
|
||||
|
||||
Add "runtime/bundles" ?
|
||||
runtime/bundles/netrw/spec.vim
|
||||
runtime/bundles/netrw/autoload/netrw.vim
|
||||
runtime/bundles/netrw/syntax/netrw.vim
|
||||
etc.
|
||||
Need an alternative for 'runtimepath' that tells where bundles are to be
|
||||
found. 'bundlepath' ?
|
||||
The plugins under 'bundlepath' would always be loaded. Also have a path for
|
||||
optional plugins? 'optbundlepath'? Or have directories "bundlesdef" and
|
||||
"bundlesopt"?
|
||||
Then use a command "loadplugin" to find a plugin in "optional".
|
||||
"bundles" is used by some plugin managers, need another name. "packages"?
|
||||
Add a "requires" / "provides" mechanism?
|
||||
if my_feature_enabled
|
||||
require +python
|
||||
endif
|
||||
require my_other_plugin
|
||||
~/vim/packages/netrw/def/netrw/plugin/netrw.vim
|
||||
~/vim/packages/netrw/opt/nwdebug/plugin/nwdebug.vim
|
||||
|
||||
Why does this: echo "a" . 1.1
|
||||
result in: a11
|
||||
Should recognize float (so long as it's not ".1.1").
|
||||
|
||||
Allow for an empty dictionary key.
|
||||
|
||||
Regexp problems:
|
||||
- The regexp engines are not reentrant, causing havoc when interrupted by a
|
||||
remote expression or something else. Move global variables onto the stack
|
||||
@@ -76,49 +170,8 @@ Regexp problems:
|
||||
matches the empty string. (Dominique Pelle, 2015 Oct 2, Nov 24)
|
||||
- Search for \\~ causes error E874.
|
||||
|
||||
- "\%1l^#.*" does not match on a line starting with "#". The zero-width match
|
||||
clears the start-of-line flag.
|
||||
Patch by Christian, 2016 Jan 29.
|
||||
|
||||
+channel:
|
||||
- use a timeout for connect()
|
||||
Patch from Yasuhiro Matsumoto, Feb 2
|
||||
Change connect() second argument to a dict with items:
|
||||
mode
|
||||
timeout
|
||||
callback
|
||||
- When receiving malformed json starting with a quote it doesn't get
|
||||
discarded.
|
||||
- add ch_setcallback()
|
||||
- add ch_settimeout()
|
||||
- cleanup on exit? in mch_getout() and getout().
|
||||
- Add more contents to channel.txt
|
||||
- implement debug log
|
||||
- implement job control:
|
||||
let job = job_start('command', {options})
|
||||
call job_stop(job)
|
||||
let job = job_maystart('command', {address}, {options})
|
||||
options:
|
||||
- keep running when Vim exits
|
||||
- add remark undo sync, is there a way to force it?
|
||||
- Add a test with a server that can send canned responses.
|
||||
- Add more testing in json_test.c
|
||||
- make sure errors lead to a useful error msg. ["ex","foobar"]
|
||||
- set timeout for channel.
|
||||
- implement check for ID in response.
|
||||
- json: implement UTF-16 surrogate pair.
|
||||
|
||||
Patch on #608: (Ken Takata)
|
||||
https://bitbucket.org/k_takata/vim-ktakata-mq/src/479934b94fd56b064c9e4bd8737585c5df69d56a/fix-gvimext-loadlibrary.patch?fileviewer=file-view-default
|
||||
|
||||
This difference is unexpected:
|
||||
echo v:true == 1
|
||||
1
|
||||
echo [v:true] == [1]
|
||||
0
|
||||
It's because tv_equal() works different.
|
||||
|
||||
Allow for an empty dictionary key.
|
||||
Also include update_curswant() fix for getcurpos(). (Christian Brabandt, 2016
|
||||
Feb 9)
|
||||
|
||||
Patch to put undo options together in undo window.
|
||||
(Gary Johnson, 2016 Jan 28)
|
||||
@@ -217,6 +270,14 @@ Patch to fix display of listchars on the cursorline. (Nayuri Aohime, 2013)
|
||||
Update suggested by Yasuhiro Matsumoto, 2014 Nov 25:
|
||||
https://gist.github.com/presuku/d3d6b230b9b6dcfc0477
|
||||
|
||||
Patch to make the behavior of "w" more straightforward, but not Vi compatible.
|
||||
With a 'cpo' flag. (Christian Brabandt, 2016 Feb 8)
|
||||
|
||||
Patch to add TagNotFound autocommand. (Anton Lindqvist, 2016 Feb 3)
|
||||
|
||||
Patch to add Error autocommand. (Anton Lindqvist, 2016 Feb 14)
|
||||
Only remembers one error.
|
||||
|
||||
Illegal memory access, requires ASAN to see. (Dominique Pelle, 2015 Jul 28)
|
||||
|
||||
Gvim: when both Tab and CTRL-I are mapped, use CTRL-I not for Tab.
|
||||
@@ -265,6 +326,9 @@ Can we cache the syntax attributes, so that updates for 'relativenumber' and
|
||||
Build with Python on Mac does not always use the right library.
|
||||
(Kazunobu Kuriyama, 2015 Mar 28)
|
||||
|
||||
Patch to add GTK 3 support. (Kazunobu Kuriyama, 2016 Feb 13)
|
||||
Does not fully work yet.
|
||||
|
||||
Need a Vim equivalent of Python's None and a way to test for it.
|
||||
Use v:none. var == v:none
|
||||
|
||||
@@ -488,7 +552,7 @@ Bug: Autocompleting ":tag/pat" replaces "/pat" with a match but does not
|
||||
insert a space. (Micha Mos, 2014 Nov 7)
|
||||
|
||||
Patch to add the :bvimgrep command. (Christian Brabandt, 2014 Nov 12)
|
||||
Update Dec 6.
|
||||
Updated 2016 Feb 10
|
||||
|
||||
Patch to add argument to :cquit. (Thinca, 2014 Oct 12)
|
||||
|
||||
@@ -621,6 +685,7 @@ Patch to add ":undorecover", get as much text out of the undo file as
|
||||
possible. (Christian Brabandt, 2014 Mar 12, update Aug 22)
|
||||
|
||||
Include Haiku port? (Adrien Destugues, Siarzhuk Zharski, 2013 Oct 24)
|
||||
It can replace the BeOS code, which is likely not used anymore.
|
||||
|
||||
Updated spec ftplugin. (Matěj Cepl, 2013 Oct 16)
|
||||
|
||||
@@ -2607,7 +2672,7 @@ GUI:
|
||||
Need better separation of Vim core and GUI code.
|
||||
8 When fontset support is enabled, setting 'guifont' to a single font
|
||||
doesn't work.
|
||||
8 Menu priority for sub-menus for: Amiga, BeOS.
|
||||
8 Menu priority for sub-menus for: Amiga.
|
||||
8 When translating menus ignore the part after the Tab, the shortcut. So
|
||||
that the same menu item with a different shortcut (e.g., for the Mac) are
|
||||
still translated.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_41.txt* For Vim version 7.4. Last change: 2016 Feb 02
|
||||
*usr_41.txt* For Vim version 7.4. Last change: 2016 Feb 14
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -2235,7 +2235,7 @@ This construct makes sure the function is only defined once: >
|
||||
:endif
|
||||
<
|
||||
|
||||
UNDO *undo_ftplugin*
|
||||
UNDO *undo_indent* *undo_ftplugin*
|
||||
|
||||
When the user does ":setfiletype xyz" the effect of the previous filetype
|
||||
should be undone. Set the b:undo_ftplugin variable to the commands that will
|
||||
@@ -2250,6 +2250,9 @@ global value. That is mostly the best way to reset the option value.
|
||||
This does require removing the "C" flag from 'cpoptions' to allow line
|
||||
continuation, as mentioned above |use-cpo-save|.
|
||||
|
||||
For undoing the effect of an indent script, the b:undo_indent variable should
|
||||
be set accordingly.
|
||||
|
||||
|
||||
FILE NAME
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*various.txt* For Vim version 7.4. Last change: 2016 Jan 31
|
||||
*various.txt* For Vim version 7.4. Last change: 2016 Feb 15
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -359,6 +359,7 @@ m *+hangul_input* Hangul input support |hangul|
|
||||
*+iconv* Compiled with the |iconv()| function
|
||||
*+iconv/dyn* Likewise |iconv-dynamic| |/dyn|
|
||||
N *+insert_expand* |insert_expand| Insert mode completion
|
||||
m *+job* starting and stopping jobs |job|
|
||||
N *+jumplist* |jumplist|
|
||||
B *+keymap* |'keymap'|
|
||||
B *+langmap* |'langmap'|
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*vi_diff.txt* For Vim version 7.4. Last change: 2015 Nov 01
|
||||
*vi_diff.txt* For Vim version 7.4. Last change: 2016 Feb 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -960,7 +960,7 @@ Only Vim is able to accept options in between and after the file names.
|
||||
In 2005 the POSIX test suite was run to check the compatibility of Vim. Most
|
||||
of the test was executed properly. There are the few things where Vim
|
||||
is not POSIX compliant, even when run in Vi compatibility mode.
|
||||
|
||||
*$VIM_POSIX*
|
||||
Set the $VIM_POSIX environment variable to have 'cpoptions' include the POSIX
|
||||
flags when Vim starts up. This makes Vim run as POSIX as it can. That's
|
||||
a bit different from being Vi compatible.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: man
|
||||
" Maintainer: SungHyun Nam <goweol@gmail.com>
|
||||
" Last Change: 2015 Nov 24
|
||||
" Last Change: 2016 Feb 04
|
||||
|
||||
" To make the ":Man" command available before editing a manual page, source
|
||||
" this script from your startup vimrc file.
|
||||
@@ -160,7 +160,9 @@ func <SID>GetPage(...)
|
||||
|
||||
setl ma nonu nornu nofen
|
||||
silent exec "norm 1GdG"
|
||||
let $MANWIDTH = winwidth(0)
|
||||
if empty($MANWIDTH)
|
||||
let $MANWIDTH = winwidth(0)
|
||||
endif
|
||||
silent exec "r!/usr/bin/man ".s:GetCmdArg(sect, page)." | col -b"
|
||||
" Remove blank lines from top and bottom.
|
||||
while getline(1) =~ '^\s*$'
|
||||
|
||||
+33
-27
@@ -3,8 +3,8 @@
|
||||
" Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr>
|
||||
" URL: http://www.2072productions.com/vim/indent/php.vim
|
||||
" Home: https://github.com/2072/PHP-Indenting-for-VIm
|
||||
" Last Change: 2014 November 26th
|
||||
" Version: 1.57
|
||||
" Last Change: 2015 September 8th
|
||||
" Version: 1.60
|
||||
"
|
||||
"
|
||||
" Type :help php-indent for available options
|
||||
@@ -50,16 +50,25 @@ let b:did_indent = 1
|
||||
|
||||
let g:php_sync_method = 0
|
||||
|
||||
if exists('*shiftwidth')
|
||||
function! s:sw()
|
||||
return shiftwidth()
|
||||
endfunction
|
||||
else
|
||||
function! s:sw()
|
||||
return &shiftwidth
|
||||
endfunction
|
||||
endif
|
||||
|
||||
|
||||
if exists("PHP_default_indenting")
|
||||
let b:PHP_default_indenting = PHP_default_indenting * &sw
|
||||
let b:PHP_default_indenting = PHP_default_indenting * s:sw()
|
||||
else
|
||||
let b:PHP_default_indenting = 0
|
||||
endif
|
||||
|
||||
if exists("PHP_outdentSLComments")
|
||||
let b:PHP_outdentSLComments = PHP_outdentSLComments * &sw
|
||||
let b:PHP_outdentSLComments = PHP_outdentSLComments * s:sw()
|
||||
else
|
||||
let b:PHP_outdentSLComments = 0
|
||||
endif
|
||||
@@ -124,7 +133,7 @@ endif
|
||||
|
||||
if exists("*GetPhpIndent")
|
||||
call ResetPhpOptions()
|
||||
finish " XXX -- comment this line for easy dev
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
@@ -135,7 +144,7 @@ let s:functionDecl = '\<function\>\%(\s\+'.s:PHP_validVariable.'\)\=\s*(.*'
|
||||
let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$'
|
||||
|
||||
|
||||
let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)\|^[^''"`]*[''"`]$'
|
||||
let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<\s*[''"]\=\a\w*[''"]\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)\|^[^''"`]*[''"`]$'
|
||||
let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!'
|
||||
|
||||
|
||||
@@ -200,7 +209,7 @@ function! GetLastRealCodeLNum(startline) " {{{
|
||||
|
||||
|
||||
elseif lastline =~? '^\a\w*;\=$' && lastline !~? s:notPhpHereDoc
|
||||
let tofind=substitute( lastline, '\(\a\w*\);\=', '<<<''\\=\1''\\=$', '')
|
||||
let tofind=substitute( lastline, '\(\a\w*\);\=', '<<<\\s*[''"]\\=\1[''"]\\=$', '')
|
||||
while getline(lnum) !~? tofind && lnum > 1
|
||||
let lnum = lnum - 1
|
||||
endwhile
|
||||
@@ -314,7 +323,7 @@ function! FindTheSwitchIndent (lnum) " {{{
|
||||
let test = GetLastRealCodeLNum(a:lnum - 1)
|
||||
|
||||
if test <= 1
|
||||
return indent(1) - &sw * b:PHP_vintage_case_default_indent
|
||||
return indent(1) - s:sw() * b:PHP_vintage_case_default_indent
|
||||
end
|
||||
|
||||
while getline(test) =~ '^\s*}' && test > 1
|
||||
@@ -328,7 +337,7 @@ function! FindTheSwitchIndent (lnum) " {{{
|
||||
if getline(test) =~# '^\s*switch\>'
|
||||
return indent(test)
|
||||
elseif getline(test) =~# s:defaultORcase
|
||||
return indent(test) - &sw * b:PHP_vintage_case_default_indent
|
||||
return indent(test) - s:sw() * b:PHP_vintage_case_default_indent
|
||||
else
|
||||
return FindTheSwitchIndent(test)
|
||||
endif
|
||||
@@ -401,7 +410,7 @@ function! GetPhpIndent()
|
||||
endif
|
||||
|
||||
if b:PHP_default_indenting
|
||||
let b:PHP_default_indenting = g:PHP_default_indenting * &sw
|
||||
let b:PHP_default_indenting = g:PHP_default_indenting * s:sw()
|
||||
endif
|
||||
|
||||
let cline = getline(v:lnum)
|
||||
@@ -439,6 +448,7 @@ function! GetPhpIndent()
|
||||
|
||||
if !b:InPHPcode_checked " {{{ One time check
|
||||
let b:InPHPcode_checked = 1
|
||||
let b:UserIsTypingComment = 0
|
||||
|
||||
let synname = ""
|
||||
if cline !~ '<?.*?>'
|
||||
@@ -447,8 +457,7 @@ function! GetPhpIndent()
|
||||
|
||||
if synname!=""
|
||||
if synname == "SpecStringEntrails"
|
||||
let b:InPHPcode = -1 " thumb down
|
||||
let b:UserIsTypingComment = 0
|
||||
let b:InPHPcode = -1
|
||||
let b:InPHPcode_tofind = ""
|
||||
elseif synname != "phpHereDoc" && synname != "phpHereDocDelimiter"
|
||||
let b:InPHPcode = 1
|
||||
@@ -456,8 +465,7 @@ function! GetPhpIndent()
|
||||
|
||||
if synname =~# '^php\%(Doc\)\?Comment'
|
||||
let b:UserIsTypingComment = 1
|
||||
else
|
||||
let b:UserIsTypingComment = 0
|
||||
let b:InPHPcode_checked = 0
|
||||
endif
|
||||
|
||||
if synname =~? '^javaScript'
|
||||
@@ -466,18 +474,16 @@ function! GetPhpIndent()
|
||||
|
||||
else
|
||||
let b:InPHPcode = 0
|
||||
let b:UserIsTypingComment = 0
|
||||
|
||||
let lnum = v:lnum - 1
|
||||
while getline(lnum) !~? '<<<''\=\a\w*''\=$' && lnum > 1
|
||||
while getline(lnum) !~? '<<<\s*[''"]\=\a\w*[''"]\=$' && lnum > 1
|
||||
let lnum = lnum - 1
|
||||
endwhile
|
||||
|
||||
let b:InPHPcode_tofind = substitute( getline(lnum), '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '')
|
||||
let b:InPHPcode_tofind = substitute( getline(lnum), '^.*<<<\s*[''"]\=\(\a\w*\)[''"]\=$', '^\\s*\1;\\=$', '')
|
||||
endif
|
||||
else
|
||||
let b:InPHPcode = 0
|
||||
let b:UserIsTypingComment = 0
|
||||
let b:InPHPcode_tofind = s:PHP_startindenttag
|
||||
endif
|
||||
endif "!b:InPHPcode_checked }}}
|
||||
@@ -537,9 +543,9 @@ function! GetPhpIndent()
|
||||
elseif last_line =~ '^[^''"`]\+[''"`]$'
|
||||
let b:InPHPcode = -1
|
||||
let b:InPHPcode_tofind = substitute( last_line, '^.*\([''"`]\).*$', '^[^\1]*\1[;,]$', '')
|
||||
elseif last_line =~? '<<<''\=\a\w*''\=$'
|
||||
elseif last_line =~? '<<<\s*[''"]\=\a\w*[''"]\=$'
|
||||
let b:InPHPcode = 0
|
||||
let b:InPHPcode_tofind = substitute( last_line, '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '')
|
||||
let b:InPHPcode_tofind = substitute( last_line, '^.*<<<\s*[''"]\=\(\a\w*\)[''"]\=$', '^\\s*\1;\\=$', '')
|
||||
|
||||
elseif !UserIsEditing && cline =~ '^\s*/\*\%(.*\*/\)\@!' && getline(v:lnum + 1) !~ '^\s*\*'
|
||||
let b:InPHPcode = 0
|
||||
@@ -660,7 +666,7 @@ function! GetPhpIndent()
|
||||
let b:PHP_CurrentIndentLevel = b:PHP_default_indenting
|
||||
return indent(FindTheIfOfAnElse(v:lnum, 1))
|
||||
elseif cline =~# s:defaultORcase
|
||||
return FindTheSwitchIndent(v:lnum) + &sw * b:PHP_vintage_case_default_indent
|
||||
return FindTheSwitchIndent(v:lnum) + s:sw() * b:PHP_vintage_case_default_indent
|
||||
elseif cline =~ '^\s*)\=\s*{'
|
||||
let previous_line = last_line
|
||||
let last_line_num = lnum
|
||||
@@ -672,7 +678,7 @@ function! GetPhpIndent()
|
||||
let ind = indent(last_line_num)
|
||||
|
||||
if b:PHP_BracesAtCodeLevel
|
||||
let ind = ind + &sw
|
||||
let ind = ind + s:sw()
|
||||
endif
|
||||
|
||||
return ind
|
||||
@@ -683,7 +689,7 @@ function! GetPhpIndent()
|
||||
endwhile
|
||||
|
||||
elseif last_line =~# unstated && cline !~ '^\s*);\='.endline
|
||||
let ind = ind + &sw
|
||||
let ind = ind + s:sw()
|
||||
return ind + addSpecial
|
||||
|
||||
elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated
|
||||
@@ -782,7 +788,7 @@ function! GetPhpIndent()
|
||||
endif
|
||||
|
||||
if !dontIndent && (!b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{')
|
||||
let ind = ind + &sw
|
||||
let ind = ind + s:sw()
|
||||
endif
|
||||
|
||||
if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1
|
||||
@@ -800,17 +806,17 @@ function! GetPhpIndent()
|
||||
endif
|
||||
|
||||
elseif last_line =~ '^\s*'.s:blockstart
|
||||
let ind = ind + &sw
|
||||
let ind = ind + s:sw()
|
||||
|
||||
|
||||
elseif AntepenultimateLine =~ '{'.endline || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase
|
||||
let ind = ind + &sw
|
||||
let ind = ind + s:sw()
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
if cline =~ '^\s*[)\]];\='
|
||||
let ind = ind - &sw
|
||||
let ind = ind - s:sw()
|
||||
endif
|
||||
|
||||
let b:PHP_CurrentIndentLevel = ind
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
" Vim plugin for showing matching parens
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2015 Dec 31
|
||||
" Last Change: 2016 Feb 09
|
||||
|
||||
" Exit quickly when:
|
||||
" - this plugin was already loaded (or disabled)
|
||||
@@ -97,6 +97,7 @@ function! s:Highlight_Matching_Pair()
|
||||
if has_getcurpos
|
||||
" getcurpos() is more efficient but doesn't exist before 7.4.313.
|
||||
let save_cursor = getcurpos()
|
||||
let g:saved_cursor = save_cursor
|
||||
else
|
||||
let save_cursor = winsaveview()
|
||||
endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim syntax file
|
||||
" Language: C
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2015 Mar 05
|
||||
" Last Change: 2016 Feb 08
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
@@ -264,7 +264,7 @@ syn keyword cStorageClass static register auto volatile extern const
|
||||
if exists("c_gnu")
|
||||
syn keyword cStorageClass inline __attribute__
|
||||
endif
|
||||
if !exists("c_no_c99")
|
||||
if !exists("c_no_c99") && s:ft !=# 'cpp'
|
||||
syn keyword cStorageClass inline restrict
|
||||
endif
|
||||
if !exists("c_no_c11")
|
||||
|
||||
@@ -1255,7 +1255,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>96</string>
|
||||
<string>97</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
|
||||
@@ -56,7 +56,6 @@ extern NSTimeInterval MMBalloonEvalInternalDelay;
|
||||
unsigned numWholeLineChanges;
|
||||
unsigned offsetForDrawDataPrune;
|
||||
BOOL imState;
|
||||
NSMutableDictionary *channelDict;
|
||||
int winposX;
|
||||
int winposY;
|
||||
#ifdef FEAT_BEVAL
|
||||
@@ -156,8 +155,8 @@ extern NSTimeInterval MMBalloonEvalInternalDelay;
|
||||
- (BOOL)imState;
|
||||
- (void)setImState:(BOOL)activated;
|
||||
|
||||
- (void)addChannel:(int)idx fileDescriptor:(int)fd;
|
||||
- (void)removeChannel:(int)idx;
|
||||
- (void *)addChannel:(channel_T *)channel which:(int)which;
|
||||
- (void)removeChannel:(void *)cookie;
|
||||
|
||||
#ifdef FEAT_BEVAL
|
||||
- (void)setLastToolTip:(NSString *)toolTip;
|
||||
|
||||
+26
-21
@@ -164,11 +164,14 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
|
||||
|
||||
|
||||
@interface MMChannel : NSObject {
|
||||
channel_T *channel;
|
||||
int which;
|
||||
CFSocketRef socket;
|
||||
CFRunLoopSourceRef runLoopSource;
|
||||
}
|
||||
|
||||
- (id)initWithIndex:(int)idx fileDescriptor:(int)fd;
|
||||
- (id)initWithChannel:(channel_T *)c which:(int)w;
|
||||
- (void)read;
|
||||
@end
|
||||
|
||||
|
||||
@@ -241,7 +244,6 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
|
||||
connectionNameDict = [[NSMutableDictionary alloc] init];
|
||||
clientProxyDict = [[NSMutableDictionary alloc] init];
|
||||
serverReplyDict = [[NSMutableDictionary alloc] init];
|
||||
channelDict = [[NSMutableDictionary alloc] init];
|
||||
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
NSString *path = [mainBundle pathForResource:@"Colors" ofType:@"plist"];
|
||||
@@ -273,7 +275,6 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
|
||||
gui_mch_free_font(oldWideFont); oldWideFont = NOFONT;
|
||||
[blinkTimer release]; blinkTimer = nil;
|
||||
[alternateServerName release]; alternateServerName = nil;
|
||||
[channelDict release]; channelDict = nil;
|
||||
[serverReplyDict release]; serverReplyDict = nil;
|
||||
[clientProxyDict release]; clientProxyDict = nil;
|
||||
[connectionNameDict release]; connectionNameDict = nil;
|
||||
@@ -1684,21 +1685,17 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
|
||||
[self flushQueue:YES];
|
||||
}
|
||||
|
||||
- (void)addChannel:(int)idx fileDescriptor:(int)fd
|
||||
- (void *)addChannel:(channel_T *)channel which:(int)which
|
||||
{
|
||||
if (fd == -1)
|
||||
return;
|
||||
|
||||
NSNumber *key = [NSNumber numberWithInt:idx];
|
||||
MMChannel *channel =
|
||||
[[[MMChannel alloc] initWithIndex:idx fileDescriptor:fd] autorelease];
|
||||
[channelDict setObject:channel forKey:key];
|
||||
MMChannel *mmChannel =
|
||||
[[MMChannel alloc] initWithChannel:channel which:which];
|
||||
return (__bridge void *)mmChannel;
|
||||
}
|
||||
|
||||
- (void)removeChannel:(int)idx
|
||||
- (void)removeChannel:(void *)cookie
|
||||
{
|
||||
NSNumber *key = [NSNumber numberWithInt:idx];
|
||||
[channelDict removeObjectForKey:key];
|
||||
MMChannel *mmChannel = (__bridge MMChannel *)cookie;
|
||||
[mmChannel release];
|
||||
}
|
||||
|
||||
#ifdef FEAT_BEVAL
|
||||
@@ -3431,21 +3428,22 @@ static void socketReadCallback(CFSocketRef s,
|
||||
const void *data,
|
||||
void *info)
|
||||
{
|
||||
#ifdef FEAT_CHANNEL
|
||||
int idx = (int)(intptr_t)info;
|
||||
channel_read(idx);
|
||||
#endif
|
||||
MMChannel *mmChannel = (__bridge MMChannel *)info;
|
||||
[mmChannel read];
|
||||
}
|
||||
|
||||
- (id)initWithIndex:(int)idx fileDescriptor:(int)fd
|
||||
- (id)initWithChannel:(channel_T *)c which:(int)w
|
||||
{
|
||||
self = [super init];
|
||||
if (!self) return nil;
|
||||
|
||||
channel = c;
|
||||
which = w;
|
||||
|
||||
// Tell CFRunLoop that we are interested in channel socket input.
|
||||
CFSocketContext ctx = {0, (void *)(intptr_t)idx, NULL, NULL, NULL};
|
||||
CFSocketContext ctx = {0, (__bridge void *)self, NULL, NULL, NULL};
|
||||
socket = CFSocketCreateWithNative(kCFAllocatorDefault,
|
||||
fd,
|
||||
channel->ch_pfd[which].ch_fd,
|
||||
kCFSocketReadCallBack,
|
||||
&socketReadCallback,
|
||||
&ctx);
|
||||
@@ -3459,4 +3457,11 @@ static void socketReadCallback(CFSocketRef s,
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)read
|
||||
{
|
||||
#ifdef FEAT_CHANNEL
|
||||
channel_read(channel, which, "MMChannel_read");
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>15C50</string>
|
||||
<string>15E27e</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
@@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.13.0</string>
|
||||
<string>1.13.1 git-2afc553</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
@@ -25,7 +25,7 @@
|
||||
<string>MacOSX</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.13.0</string>
|
||||
<string>1.13.1</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>15C50</string>
|
||||
<string>15E27e</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
@@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.13.0</string>
|
||||
<string>1.13.1 git-2afc553</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
@@ -25,7 +25,7 @@
|
||||
<string>MacOSX</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.13.0</string>
|
||||
<string>1.13.1</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
|
||||
Binary file not shown.
@@ -2241,16 +2241,16 @@ static int vimModMaskToEventModifierFlags(int mods)
|
||||
|
||||
// -- Channel Support ------------------------------------------------------
|
||||
|
||||
void
|
||||
gui_macvim_add_channel(int idx, int fd)
|
||||
void *
|
||||
gui_macvim_add_channel(channel_T *channel, int which)
|
||||
{
|
||||
[[MMBackend sharedInstance] addChannel:idx fileDescriptor:fd];
|
||||
return [[MMBackend sharedInstance] addChannel:channel which:which];
|
||||
}
|
||||
|
||||
void
|
||||
gui_macvim_remove_channel(int idx)
|
||||
gui_macvim_remove_channel(void *cookie)
|
||||
{
|
||||
[[MMBackend sharedInstance] removeChannel:idx];
|
||||
[[MMBackend sharedInstance] removeChannel:cookie];
|
||||
}
|
||||
|
||||
|
||||
|
||||
+12
-13
@@ -42,7 +42,7 @@ DIRECTX=no
|
||||
FEATURES=HUGE
|
||||
# Set to one of i386, i486, i586, i686 as the minimum target processor.
|
||||
# For amd64/x64 architecture set ARCH=x86-64 .
|
||||
ARCH=i386
|
||||
ARCH=i686
|
||||
# Set to yes to cross-compile from unix; no=native Windows (and Cygwin).
|
||||
CROSS=no
|
||||
# Set to path to iconv.h and libiconv.a to enable using 'iconv.dll'.
|
||||
@@ -58,9 +58,9 @@ DYNAMIC_IME=yes
|
||||
POSTSCRIPT=no
|
||||
# Set to yes to enable OLE support.
|
||||
OLE=no
|
||||
# Set the default $(WINVER) to make it work with pre-Win2k.
|
||||
# Set the default $(WINVER) to make it work with WinXP.
|
||||
ifndef WINVER
|
||||
WINVER = 0x0500
|
||||
WINVER = 0x0501
|
||||
endif
|
||||
# Set to yes to enable Cscope support.
|
||||
CSCOPE=yes
|
||||
@@ -264,7 +264,7 @@ ifndef DYNAMIC_PYTHON3_DLL
|
||||
DYNAMIC_PYTHON3_DLL=python$(PYTHON3_VER).dll
|
||||
endif
|
||||
ifdef PYTHON3_HOME
|
||||
PYTHON3_HOME_DEF=-DPYTHON3_HOME=\"$(PYTHON3_HOME)\"
|
||||
PYTHON3_HOME_DEF=-DPYTHON3_HOME=L\"$(PYTHON3_HOME)\"
|
||||
endif
|
||||
|
||||
ifeq (no,$(DYNAMIC_PYTHON3))
|
||||
@@ -414,7 +414,7 @@ WINDRES_CC = $(CC)
|
||||
#>>>>> end of choices
|
||||
###########################################################################
|
||||
|
||||
CFLAGS = -Iproto $(DEFINES) -pipe -w -march=$(ARCH) -Wall
|
||||
CFLAGS = -Iproto $(DEFINES) -pipe -march=$(ARCH) -Wall
|
||||
WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED
|
||||
EXTRA_LIBS =
|
||||
|
||||
@@ -483,14 +483,14 @@ endif
|
||||
endif
|
||||
|
||||
ifdef PYTHON
|
||||
CFLAGS += -DFEAT_PYTHON
|
||||
CFLAGS += -DFEAT_PYTHON
|
||||
ifeq (yes, $(DYNAMIC_PYTHON))
|
||||
CFLAGS += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"$(DYNAMIC_PYTHON_DLL)\"
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef PYTHON3
|
||||
CFLAGS += -DFEAT_PYTHON3
|
||||
ifdef PYTHON3
|
||||
CFLAGS += -DFEAT_PYTHON3
|
||||
ifeq (yes, $(DYNAMIC_PYTHON3))
|
||||
CFLAGS += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"$(DYNAMIC_PYTHON3_DLL)\"
|
||||
endif
|
||||
@@ -679,20 +679,19 @@ ifneq ($(CHANNEL),yes)
|
||||
# Cannot use Netbeans without CHANNEL
|
||||
NETBEANS=no
|
||||
else
|
||||
# Only allow NETBEANS for a GUI build.
|
||||
ifeq (yes, $(GUI))
|
||||
ifneq (yes, $(GUI))
|
||||
# Cannot use Netbeans without GUI.
|
||||
NETBEANS=no
|
||||
else
|
||||
OBJ += $(OUTDIR)/netbeans.o
|
||||
LIB += -lwsock32
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CHANNEL),yes)
|
||||
OBJ += $(OUTDIR)/channel.o
|
||||
ifneq ($(NETBEANS),yes)
|
||||
LIB += -lwsock32
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(DIRECTX),yes)
|
||||
# Only allow DIRECTX for a GUI build.
|
||||
|
||||
+2
-3
@@ -113,7 +113,7 @@
|
||||
# Processor Version: CPUNR=[i386, i486, i586, i686, pentium4] (default is
|
||||
# i386)
|
||||
#
|
||||
# Version Support: WINVER=[0x0400, 0x0500] (default is 0x0400)
|
||||
# Version Support: WINVER=[0x0501, 0x0600] (default is 0x0501)
|
||||
#
|
||||
# Debug version: DEBUG=yes
|
||||
# Mapfile: MAP=[no, yes or lines] (default is yes)
|
||||
@@ -370,9 +370,8 @@ CON_LIB = $(CON_LIB) /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib
|
||||
!endif
|
||||
|
||||
### Set the default $(WINVER) to make it work with VC++7.0 (VS.NET)
|
||||
# When set to 0x0500 ":browse" stops working.
|
||||
!ifndef WINVER
|
||||
WINVER = 0x0400
|
||||
WINVER = 0x0501
|
||||
!endif
|
||||
|
||||
# If you have a fixed directory for $VIM or $VIMRUNTIME, other than the normal
|
||||
|
||||
+1252
-639
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -452,7 +452,7 @@ run_command(char *cmd)
|
||||
/*
|
||||
* Append a backslash to "name" if there isn't one yet.
|
||||
*/
|
||||
static void
|
||||
void
|
||||
add_pathsep(char *name)
|
||||
{
|
||||
int len = strlen(name);
|
||||
|
||||
+6
-1
@@ -328,7 +328,7 @@ edit(
|
||||
{
|
||||
int c = 0;
|
||||
char_u *ptr;
|
||||
int lastc;
|
||||
int lastc = 0;
|
||||
int mincol;
|
||||
static linenr_T o_lnum = 0;
|
||||
int i;
|
||||
@@ -1620,7 +1620,12 @@ ins_redraw(
|
||||
# endif
|
||||
# ifdef FEAT_AUTOCMD
|
||||
if (has_cursormovedI())
|
||||
{
|
||||
/* Make sure curswant is correct, an autocommand may call
|
||||
* getcurpos(). */
|
||||
update_curswant();
|
||||
apply_autocmds(EVENT_CURSORMOVEDI, NULL, NULL, FALSE, curbuf);
|
||||
}
|
||||
# endif
|
||||
# ifdef FEAT_CONCEAL
|
||||
if (curwin->w_p_cole > 0)
|
||||
|
||||
+998
-264
File diff suppressed because it is too large
Load Diff
+9
-3
@@ -3268,6 +3268,7 @@ do_ecmd(
|
||||
int did_get_winopts = FALSE;
|
||||
#endif
|
||||
int readfile_flags = 0;
|
||||
int did_inc_redrawing_disabled = FALSE;
|
||||
|
||||
if (eap != NULL)
|
||||
command = eap->do_ecmd_cmd;
|
||||
@@ -3600,6 +3601,11 @@ do_ecmd(
|
||||
oldbuf = (flags & ECMD_OLDBUF);
|
||||
}
|
||||
|
||||
/* Don't redraw until the cursor is in the right line, otherwise
|
||||
* autocommands may cause ml_get errors. */
|
||||
++RedrawingDisabled;
|
||||
did_inc_redrawing_disabled = TRUE;
|
||||
|
||||
#ifdef FEAT_AUTOCMD
|
||||
buf = curbuf;
|
||||
#endif
|
||||
@@ -3697,9 +3703,6 @@ do_ecmd(
|
||||
/*
|
||||
* If we get here we are sure to start editing
|
||||
*/
|
||||
/* don't redraw until the cursor is in the right line */
|
||||
++RedrawingDisabled;
|
||||
|
||||
/* Assume success now */
|
||||
retval = OK;
|
||||
|
||||
@@ -3899,6 +3902,7 @@ do_ecmd(
|
||||
#endif
|
||||
|
||||
--RedrawingDisabled;
|
||||
did_inc_redrawing_disabled = FALSE;
|
||||
if (!skip_redraw)
|
||||
{
|
||||
n = p_so;
|
||||
@@ -3933,6 +3937,8 @@ do_ecmd(
|
||||
#endif
|
||||
|
||||
theend:
|
||||
if (did_inc_redrawing_disabled)
|
||||
--RedrawingDisabled;
|
||||
#ifdef FEAT_AUTOCMD
|
||||
if (did_set_swapcommand)
|
||||
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
|
||||
|
||||
+29
-11
@@ -1010,6 +1010,24 @@ profile_msg(proftime_T *tm)
|
||||
return buf;
|
||||
}
|
||||
|
||||
# if defined(FEAT_FLOAT) || defined(PROTO)
|
||||
/*
|
||||
* Return a float that represents the time in "tm".
|
||||
*/
|
||||
float_T
|
||||
profile_float(proftime_T *tm)
|
||||
{
|
||||
# ifdef WIN3264
|
||||
LARGE_INTEGER fr;
|
||||
|
||||
QueryPerformanceFrequency(&fr);
|
||||
return (float_T)tm->QuadPart / (float_T)fr.QuadPart;
|
||||
# else
|
||||
return (float_T)tm->tv_sec + (float_T)tm->tv_usec / 1000000.0;
|
||||
# endif
|
||||
}
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Put the time "msec" past now in "tm".
|
||||
*/
|
||||
@@ -4204,16 +4222,16 @@ ex_checktime(exarg_T *eap)
|
||||
#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
|
||||
&& (defined(FEAT_EVAL) || defined(FEAT_MULTI_LANG))
|
||||
# define HAVE_GET_LOCALE_VAL
|
||||
static char *get_locale_val(int what);
|
||||
static char_u *get_locale_val(int what);
|
||||
|
||||
static char *
|
||||
static char_u *
|
||||
get_locale_val(int what)
|
||||
{
|
||||
char *loc;
|
||||
char_u *loc;
|
||||
|
||||
/* Obtain the locale value from the libraries. For DJGPP this is
|
||||
* redefined and it doesn't use the arguments. */
|
||||
loc = setlocale(what, NULL);
|
||||
loc = (char_u *)setlocale(what, NULL);
|
||||
|
||||
# ifdef WIN32
|
||||
if (loc != NULL)
|
||||
@@ -4277,7 +4295,7 @@ gettext_lang(char_u *name)
|
||||
|
||||
for (i = 0; mtable[i] != NULL; i += 2)
|
||||
if (STRNICMP(mtable[i], name, STRLEN(mtable[i])) == 0)
|
||||
return mtable[i + 1];
|
||||
return (char_u *)mtable[i + 1];
|
||||
return name;
|
||||
}
|
||||
#endif
|
||||
@@ -4294,13 +4312,13 @@ get_mess_lang(void)
|
||||
|
||||
# ifdef HAVE_GET_LOCALE_VAL
|
||||
# if defined(LC_MESSAGES)
|
||||
p = (char_u *)get_locale_val(LC_MESSAGES);
|
||||
p = get_locale_val(LC_MESSAGES);
|
||||
# else
|
||||
/* This is necessary for Win32, where LC_MESSAGES is not defined and $LANG
|
||||
* may be set to the LCID number. LC_COLLATE is the best guess, LC_TIME
|
||||
* and LC_MONETARY may be set differently for a Japanese working in the
|
||||
* US. */
|
||||
p = (char_u *)get_locale_val(LC_COLLATE);
|
||||
p = get_locale_val(LC_COLLATE);
|
||||
# endif
|
||||
# else
|
||||
p = mch_getenv((char_u *)"LC_ALL");
|
||||
@@ -4345,7 +4363,7 @@ get_mess_env(void)
|
||||
p = NULL; /* ignore something like "1043" */
|
||||
# ifdef HAVE_GET_LOCALE_VAL
|
||||
if (p == NULL || *p == NUL)
|
||||
p = (char_u *)get_locale_val(LC_CTYPE);
|
||||
p = get_locale_val(LC_CTYPE);
|
||||
# endif
|
||||
}
|
||||
}
|
||||
@@ -4365,7 +4383,7 @@ set_lang_var(void)
|
||||
char_u *loc;
|
||||
|
||||
# ifdef HAVE_GET_LOCALE_VAL
|
||||
loc = (char_u *)get_locale_val(LC_CTYPE);
|
||||
loc = get_locale_val(LC_CTYPE);
|
||||
# else
|
||||
/* setlocale() not supported: use the default value */
|
||||
loc = (char_u *)"C";
|
||||
@@ -4375,14 +4393,14 @@ set_lang_var(void)
|
||||
/* When LC_MESSAGES isn't defined use the value from $LC_MESSAGES, fall
|
||||
* back to LC_CTYPE if it's empty. */
|
||||
# if defined(HAVE_GET_LOCALE_VAL) && defined(LC_MESSAGES)
|
||||
loc = (char_u *)get_locale_val(LC_MESSAGES);
|
||||
loc = get_locale_val(LC_MESSAGES);
|
||||
# else
|
||||
loc = get_mess_env();
|
||||
# endif
|
||||
set_vim_var_string(VV_LANG, loc, -1);
|
||||
|
||||
# ifdef HAVE_GET_LOCALE_VAL
|
||||
loc = (char_u *)get_locale_val(LC_TIME);
|
||||
loc = get_locale_val(LC_TIME);
|
||||
# endif
|
||||
set_vim_var_string(VV_LC_TIME, loc, -1);
|
||||
}
|
||||
|
||||
@@ -1562,7 +1562,11 @@ ex_catch(exarg_T *eap)
|
||||
}
|
||||
save_cpo = p_cpo;
|
||||
p_cpo = (char_u *)"";
|
||||
/* Disable error messages, it will make current_exception
|
||||
* invalid. */
|
||||
++emsg_off;
|
||||
regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
|
||||
--emsg_off;
|
||||
regmatch.rm_ic = FALSE;
|
||||
if (end != NULL)
|
||||
*end = save_char;
|
||||
|
||||
+2
-2
@@ -626,8 +626,8 @@ getcmdline(
|
||||
#endif
|
||||
if (vim_ispathsep(ccline.cmdbuff[j])
|
||||
#ifdef BACKSLASH_IN_FILENAME
|
||||
&& vim_strchr(" *?[{`$%#", ccline.cmdbuff[j + 1])
|
||||
== NULL
|
||||
&& vim_strchr((char_u *)" *?[{`$%#",
|
||||
ccline.cmdbuff[j + 1]) == NULL
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
||||
+8
-1
@@ -1269,12 +1269,19 @@
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The Channel feature requires +eval.
|
||||
* The +channel feature requires +eval.
|
||||
*/
|
||||
#if !defined(FEAT_EVAL) && defined(FEAT_CHANNEL)
|
||||
# undef FEAT_CHANNEL
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The +job feature requires +eval and Unix or MS-Windows.
|
||||
*/
|
||||
#if (defined(UNIX) || defined(WIN32)) && defined(FEAT_EVAL)
|
||||
# define FEAT_JOB
|
||||
#endif
|
||||
|
||||
/*
|
||||
* +signs Allow signs to be displayed to the left of text lines.
|
||||
* Adds the ":sign" command.
|
||||
|
||||
+3
-3
@@ -2350,7 +2350,7 @@ failed:
|
||||
{
|
||||
int fdflags = fcntl(fd, F_GETFD);
|
||||
if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0)
|
||||
fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC);
|
||||
(void)fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC);
|
||||
}
|
||||
#endif
|
||||
vim_free(buffer);
|
||||
@@ -7518,11 +7518,11 @@ vim_tempname(
|
||||
}
|
||||
strcpy(buf4, "VIM");
|
||||
buf4[2] = extra_char; /* make it "VIa", "VIb", etc. */
|
||||
if (GetTempFileName(szTempFile, buf4, 0, itmp) == 0)
|
||||
if (GetTempFileName(szTempFile, buf4, 0, (LPSTR)itmp) == 0)
|
||||
return NULL;
|
||||
if (!keep)
|
||||
/* GetTempFileName() will create the file, we don't want that */
|
||||
(void)DeleteFile(itmp);
|
||||
(void)DeleteFile((LPSTR)itmp);
|
||||
|
||||
/* Backslashes in a temp file name cause problems when filtering with
|
||||
* "sh". NOTE: This also checks 'shellcmdflag' to help those people who
|
||||
|
||||
@@ -1888,6 +1888,12 @@ char_avail(void)
|
||||
{
|
||||
int retval;
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
/* When disable_char_avail_for_testing(1) was called pretend there is no
|
||||
* typeahead. */
|
||||
if (disable_char_avail_for_testing)
|
||||
return FALSE;
|
||||
#endif
|
||||
++no_mapping;
|
||||
retval = vpeekc();
|
||||
--no_mapping;
|
||||
|
||||
@@ -1625,6 +1625,8 @@ EXTERN alloc_id_T alloc_fail_id INIT(= aid_none);
|
||||
EXTERN int alloc_fail_countdown INIT(= -1);
|
||||
/* set by alloc_fail(), number of times alloc() returns NULL */
|
||||
EXTERN int alloc_fail_repeat INIT(= 0);
|
||||
|
||||
EXTERN int disable_char_avail_for_testing INIT(= 0);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
+35
-33
@@ -57,7 +57,6 @@ directx_enabled(void)
|
||||
gui_mch_set_rendering_options(char_u *s)
|
||||
{
|
||||
#ifdef FEAT_DIRECTX
|
||||
int retval = FAIL;
|
||||
char_u *p, *q;
|
||||
|
||||
int dx_enable = 0;
|
||||
@@ -95,36 +94,36 @@ gui_mch_set_rendering_options(char_u *s)
|
||||
else if (STRCMP(name, "gamma") == 0)
|
||||
{
|
||||
dx_flags |= 1 << 0;
|
||||
dx_gamma = (float)atof(value);
|
||||
dx_gamma = (float)atof((char *)value);
|
||||
}
|
||||
else if (STRCMP(name, "contrast") == 0)
|
||||
{
|
||||
dx_flags |= 1 << 1;
|
||||
dx_contrast = (float)atof(value);
|
||||
dx_contrast = (float)atof((char *)value);
|
||||
}
|
||||
else if (STRCMP(name, "level") == 0)
|
||||
{
|
||||
dx_flags |= 1 << 2;
|
||||
dx_level = (float)atof(value);
|
||||
dx_level = (float)atof((char *)value);
|
||||
}
|
||||
else if (STRCMP(name, "geom") == 0)
|
||||
{
|
||||
dx_flags |= 1 << 3;
|
||||
dx_geom = atoi(value);
|
||||
dx_geom = atoi((char *)value);
|
||||
if (dx_geom < 0 || dx_geom > 2)
|
||||
return FAIL;
|
||||
}
|
||||
else if (STRCMP(name, "renmode") == 0)
|
||||
{
|
||||
dx_flags |= 1 << 4;
|
||||
dx_renmode = atoi(value);
|
||||
dx_renmode = atoi((char *)value);
|
||||
if (dx_renmode < 0 || dx_renmode > 6)
|
||||
return FAIL;
|
||||
}
|
||||
else if (STRCMP(name, "taamode") == 0)
|
||||
{
|
||||
dx_flags |= 1 << 5;
|
||||
dx_taamode = atoi(value);
|
||||
dx_taamode = atoi((char *)value);
|
||||
if (dx_taamode < 0 || dx_taamode > 3)
|
||||
return FAIL;
|
||||
}
|
||||
@@ -1131,7 +1130,7 @@ _WndProc(
|
||||
|
||||
if (STRLEN(str) < sizeof(lpdi->szText)
|
||||
|| ((tt_text = vim_strsave(str)) == NULL))
|
||||
vim_strncpy(lpdi->szText, str,
|
||||
vim_strncpy((char_u *)lpdi->szText, str,
|
||||
sizeof(lpdi->szText) - 1);
|
||||
else
|
||||
lpdi->lpszText = tt_text;
|
||||
@@ -1670,6 +1669,7 @@ gui_mch_init(void)
|
||||
if (s_textArea == NULL)
|
||||
return FAIL;
|
||||
|
||||
#ifdef FEAT_LIBCALL
|
||||
/* Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico. */
|
||||
{
|
||||
HANDLE hIcon = NULL;
|
||||
@@ -1677,6 +1677,7 @@ gui_mch_init(void)
|
||||
if (mch_icon_load(&hIcon) == OK && hIcon != NULL)
|
||||
SendMessage(s_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_MENU
|
||||
s_menuBar = CreateMenu();
|
||||
@@ -1747,9 +1748,9 @@ gui_mch_init(void)
|
||||
|
||||
/* Initialise the struct */
|
||||
s_findrep_struct.lStructSize = sizeof(s_findrep_struct);
|
||||
s_findrep_struct.lpstrFindWhat = alloc(MSWIN_FR_BUFSIZE);
|
||||
s_findrep_struct.lpstrFindWhat = (LPSTR)alloc(MSWIN_FR_BUFSIZE);
|
||||
s_findrep_struct.lpstrFindWhat[0] = NUL;
|
||||
s_findrep_struct.lpstrReplaceWith = alloc(MSWIN_FR_BUFSIZE);
|
||||
s_findrep_struct.lpstrReplaceWith = (LPSTR)alloc(MSWIN_FR_BUFSIZE);
|
||||
s_findrep_struct.lpstrReplaceWith[0] = NUL;
|
||||
s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE;
|
||||
s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE;
|
||||
@@ -1770,7 +1771,7 @@ gui_mch_init(void)
|
||||
# if !defined(_MSC_VER) || (_MSC_VER < 1400)
|
||||
/* Define HandleToLong for old MS and non-MS compilers if not defined. */
|
||||
# ifndef HandleToLong
|
||||
# define HandleToLong(h) ((long)(h))
|
||||
# define HandleToLong(h) ((long)(intptr_t)(h))
|
||||
# endif
|
||||
# endif
|
||||
/* set the v:windowid variable */
|
||||
@@ -2099,7 +2100,7 @@ GetCompositionString_inUCS2(HIMC hIMC, DWORD GCS, int *lenp)
|
||||
pImmGetCompositionStringA(hIMC, GCS, buf, ret);
|
||||
|
||||
/* convert from codepage to UCS-2 */
|
||||
MultiByteToWideChar_alloc(GetACP(), 0, buf, ret, &wbuf, lenp);
|
||||
MultiByteToWideChar_alloc(GetACP(), 0, (LPCSTR)buf, ret, &wbuf, lenp);
|
||||
vim_free(buf);
|
||||
|
||||
return (short_u *)wbuf;
|
||||
@@ -3028,7 +3029,7 @@ rebuild_tearoff(vimmenu_T *menu)
|
||||
|
||||
HWND thwnd = menu->tearoff_handle;
|
||||
|
||||
GetWindowText(thwnd, tbuf, 127);
|
||||
GetWindowText(thwnd, (LPSTR)tbuf, 127);
|
||||
if (GetWindowRect(thwnd, &trect)
|
||||
&& GetWindowRect(s_hwnd, &rct)
|
||||
&& GetClientRect(s_hwnd, &roct))
|
||||
@@ -3174,7 +3175,7 @@ dialog_callback(
|
||||
else
|
||||
# endif
|
||||
GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2,
|
||||
s_textfield, IOSIZE);
|
||||
(LPSTR)s_textfield, IOSIZE);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3216,7 +3217,7 @@ dialog_callback(
|
||||
* If stubbing out this fn, return 1.
|
||||
*/
|
||||
|
||||
static const char_u *dlg_icons[] = /* must match names in resource file */
|
||||
static const char *dlg_icons[] = /* must match names in resource file */
|
||||
{
|
||||
"IDR_VIM",
|
||||
"IDR_VIM_ERROR",
|
||||
@@ -3353,7 +3354,7 @@ gui_mch_dialog(
|
||||
fontHeight = fontInfo.tmHeight;
|
||||
|
||||
/* Minimum width for horizontal button */
|
||||
minButtonWidth = GetTextWidth(hdc, "Cancel", 6);
|
||||
minButtonWidth = GetTextWidth(hdc, (char_u *)"Cancel", 6);
|
||||
|
||||
/* Maximum width of a dialog, if possible */
|
||||
if (s_hwnd == NULL)
|
||||
@@ -3617,7 +3618,7 @@ gui_mch_dialog(
|
||||
+ 2 * fontHeight * i),
|
||||
PixelToDialogX(dlgwidth - 2 * DLG_VERT_PADDING_X),
|
||||
(WORD)(PixelToDialogY(2 * fontHeight) - 1),
|
||||
(WORD)(IDCANCEL + 1 + i), (WORD)0x0080, pstart);
|
||||
(WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3628,7 +3629,7 @@ gui_mch_dialog(
|
||||
PixelToDialogY(buttonYpos), /* TBK */
|
||||
PixelToDialogX(buttonWidths[i]),
|
||||
(WORD)(PixelToDialogY(2 * fontHeight) - 1),
|
||||
(WORD)(IDCANCEL + 1 + i), (WORD)0x0080, pstart);
|
||||
(WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart);
|
||||
}
|
||||
pstart = pend + 1; /*next button*/
|
||||
}
|
||||
@@ -3649,7 +3650,7 @@ gui_mch_dialog(
|
||||
PixelToDialogY(dlgPaddingY),
|
||||
(WORD)(PixelToDialogX(messageWidth) + 1),
|
||||
PixelToDialogY(msgheight),
|
||||
DLG_NONBUTTON_CONTROL + 1, (WORD)0x0081, message);
|
||||
DLG_NONBUTTON_CONTROL + 1, (WORD)0x0081, (char *)message);
|
||||
|
||||
/* Edit box */
|
||||
if (textfield != NULL)
|
||||
@@ -3659,7 +3660,7 @@ gui_mch_dialog(
|
||||
PixelToDialogY(2 * dlgPaddingY + msgheight),
|
||||
PixelToDialogX(dlgwidth - 4 * dlgPaddingX),
|
||||
PixelToDialogY(fontHeight + dlgPaddingY),
|
||||
DLG_NONBUTTON_CONTROL + 2, (WORD)0x0081, textfield);
|
||||
DLG_NONBUTTON_CONTROL + 2, (WORD)0x0081, (char *)textfield);
|
||||
*pnumitems += 1;
|
||||
}
|
||||
|
||||
@@ -3798,7 +3799,7 @@ nCopyAnsiToWideChar(
|
||||
if (enc_codepage == 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
/* Not a codepage, use our own conversion function. */
|
||||
wn = enc_to_utf16(lpAnsiIn, NULL);
|
||||
wn = enc_to_utf16((char_u *)lpAnsiIn, NULL);
|
||||
if (wn != NULL)
|
||||
{
|
||||
wcscpy(lpWCStr, wn);
|
||||
@@ -4043,7 +4044,7 @@ gui_mch_tearoff(
|
||||
|
||||
/* Calculate width of a single space. Used for padding columns to the
|
||||
* right width. */
|
||||
spaceWidth = GetTextWidth(hdc, " ", 1);
|
||||
spaceWidth = GetTextWidth(hdc, (char_u *)" ", 1);
|
||||
|
||||
/* Figure out max width of the text column, the accelerator column and the
|
||||
* optional submenu column. */
|
||||
@@ -4086,7 +4087,7 @@ gui_mch_tearoff(
|
||||
textWidth = columnWidths[0] + columnWidths[1];
|
||||
if (submenuWidth != 0)
|
||||
{
|
||||
submenuWidth = GetTextWidth(hdc, TEAROFF_SUBMENU_LABEL,
|
||||
submenuWidth = GetTextWidth(hdc, (char_u *)TEAROFF_SUBMENU_LABEL,
|
||||
(int)STRLEN(TEAROFF_SUBMENU_LABEL));
|
||||
textWidth += submenuWidth;
|
||||
}
|
||||
@@ -4262,7 +4263,7 @@ gui_mch_tearoff(
|
||||
(WORD)(sepPadding + 1 + 13 * (*pnumitems)),
|
||||
(WORD)PixelToDialogX(dlgwidth - 2 * TEAROFF_PADDING_X),
|
||||
(WORD)12,
|
||||
menuID, (WORD)0x0080, label);
|
||||
menuID, (WORD)0x0080, (char *)label);
|
||||
vim_free(label);
|
||||
(*pnumitems)++;
|
||||
}
|
||||
@@ -4360,7 +4361,7 @@ get_toolbar_bitmap(vimmenu_T *menu)
|
||||
gui_find_iconfile(menu->iconfile, fname, "bmp");
|
||||
hbitmap = LoadImage(
|
||||
NULL,
|
||||
fname,
|
||||
(LPCSTR)fname,
|
||||
IMAGE_BITMAP,
|
||||
TOOLBAR_BUTTON_WIDTH,
|
||||
TOOLBAR_BUTTON_HEIGHT,
|
||||
@@ -4381,7 +4382,7 @@ get_toolbar_bitmap(vimmenu_T *menu)
|
||||
menu->dname, fname, "bmp") == OK))
|
||||
hbitmap = LoadImage(
|
||||
NULL,
|
||||
fname,
|
||||
(LPCSTR)fname,
|
||||
IMAGE_BITMAP,
|
||||
TOOLBAR_BUTTON_WIDTH,
|
||||
TOOLBAR_BUTTON_HEIGHT,
|
||||
@@ -4629,14 +4630,15 @@ gui_mch_register_sign(char_u *signfile)
|
||||
do_load = 0;
|
||||
|
||||
if (do_load)
|
||||
sign.hImage = (HANDLE)LoadImage(NULL, signfile, sign.uType,
|
||||
sign.hImage = (HANDLE)LoadImage(NULL, (LPCSTR)signfile, sign.uType,
|
||||
gui.char_width * 2, gui.char_height,
|
||||
LR_LOADFROMFILE | LR_CREATEDIBSECTION);
|
||||
#ifdef FEAT_XPM_W32
|
||||
if (!STRICMP(ext, ".xpm"))
|
||||
{
|
||||
sign.uType = IMAGE_XPM;
|
||||
LoadXpmImage(signfile, (HBITMAP *)&sign.hImage, (HBITMAP *)&sign.hShape);
|
||||
LoadXpmImage((char *)signfile, (HBITMAP *)&sign.hImage,
|
||||
(HBITMAP *)&sign.hShape);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -4740,13 +4742,13 @@ multiline_balloon_available(void)
|
||||
UINT vlen = 0;
|
||||
void *data = alloc(len);
|
||||
|
||||
if (data != NULL
|
||||
if ((data != NULL
|
||||
&& GetFileVersionInfo(comctl_dll, 0, len, data)
|
||||
&& VerQueryValue(data, "\\", (void **)&ver, &vlen)
|
||||
&& vlen
|
||||
&& HIWORD(ver->dwFileVersionMS) > 4
|
||||
|| (HIWORD(ver->dwFileVersionMS) == 4
|
||||
&& LOWORD(ver->dwFileVersionMS) >= 70))
|
||||
&& HIWORD(ver->dwFileVersionMS) > 4)
|
||||
|| ((HIWORD(ver->dwFileVersionMS) == 4
|
||||
&& LOWORD(ver->dwFileVersionMS) >= 70)))
|
||||
{
|
||||
vim_free(data);
|
||||
multiline_tip = TRUE;
|
||||
@@ -4908,7 +4910,7 @@ gui_mch_post_balloon(BalloonEval *beval, char_u *mesg)
|
||||
{
|
||||
gui_mch_disable_beval_area(cur_beval);
|
||||
beval->showState = ShS_SHOWING;
|
||||
make_tooltip(beval, mesg, pt);
|
||||
make_tooltip(beval, (char *)mesg, pt);
|
||||
}
|
||||
// TRACE0("gui_mch_post_balloon }}}");
|
||||
}
|
||||
|
||||
+45
-32
@@ -534,7 +534,8 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
|
||||
else
|
||||
{
|
||||
string[0] = ch;
|
||||
len = MultiByteToWideChar(GetACP(), 0, string, 1, wstring, 2);
|
||||
len = MultiByteToWideChar(GetACP(), 0, (LPCSTR)string,
|
||||
1, wstring, 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -551,7 +552,7 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
|
||||
if (enc_codepage > 0)
|
||||
{
|
||||
len = WideCharToMultiByte(enc_codepage, 0, wstring, len,
|
||||
string, slen, 0, NULL);
|
||||
(LPSTR)string, slen, 0, NULL);
|
||||
/* If we had included the ALT key into the character but now the
|
||||
* upper bit is no longer set, that probably means the conversion
|
||||
* failed. Convert the original character and set the upper bit
|
||||
@@ -560,7 +561,7 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
|
||||
{
|
||||
wstring[0] = ch & 0x7f;
|
||||
len = WideCharToMultiByte(enc_codepage, 0, wstring, len,
|
||||
string, slen, 0, NULL);
|
||||
(LPSTR)string, slen, 0, NULL);
|
||||
if (len == 1) /* safety check */
|
||||
string[0] |= 0x80;
|
||||
}
|
||||
@@ -921,7 +922,7 @@ findrep_atow(LPFINDREPLACEW lpfrw, LPFINDREPLACE lpfr)
|
||||
lpfrw->hwndOwner = lpfr->hwndOwner;
|
||||
lpfrw->Flags = lpfr->Flags;
|
||||
|
||||
wp = enc_to_utf16(lpfr->lpstrFindWhat, NULL);
|
||||
wp = enc_to_utf16((char_u *)lpfr->lpstrFindWhat, NULL);
|
||||
wcsncpy(lpfrw->lpstrFindWhat, wp, lpfrw->wFindWhatLen - 1);
|
||||
vim_free(wp);
|
||||
|
||||
@@ -938,12 +939,12 @@ findrep_wtoa(LPFINDREPLACE lpfr, LPFINDREPLACEW lpfrw)
|
||||
|
||||
lpfr->Flags = lpfrw->Flags;
|
||||
|
||||
p = utf16_to_enc(lpfrw->lpstrFindWhat, NULL);
|
||||
vim_strncpy(lpfr->lpstrFindWhat, p, lpfr->wFindWhatLen - 1);
|
||||
p = utf16_to_enc((short_u*)lpfrw->lpstrFindWhat, NULL);
|
||||
vim_strncpy((char_u *)lpfr->lpstrFindWhat, p, lpfr->wFindWhatLen - 1);
|
||||
vim_free(p);
|
||||
|
||||
p = utf16_to_enc(lpfrw->lpstrReplaceWith, NULL);
|
||||
vim_strncpy(lpfr->lpstrReplaceWith, p, lpfr->wReplaceWithLen - 1);
|
||||
p = utf16_to_enc((short_u*)lpfrw->lpstrReplaceWith, NULL);
|
||||
vim_strncpy((char_u *)lpfr->lpstrReplaceWith, p, lpfr->wReplaceWithLen - 1);
|
||||
vim_free(p);
|
||||
}
|
||||
# endif
|
||||
@@ -1000,8 +1001,8 @@ _OnFindRepl(void)
|
||||
if (s_findrep_struct.Flags & FR_MATCHCASE)
|
||||
flags |= FRD_MATCH_CASE;
|
||||
down = (s_findrep_struct.Flags & FR_DOWN) != 0;
|
||||
gui_do_findrepl(flags, s_findrep_struct.lpstrFindWhat,
|
||||
s_findrep_struct.lpstrReplaceWith, down);
|
||||
gui_do_findrepl(flags, (char_u *)s_findrep_struct.lpstrFindWhat,
|
||||
(char_u *)s_findrep_struct.lpstrReplaceWith, down);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1530,7 +1531,7 @@ gui_mch_get_color(char_u *name)
|
||||
int r, g, b;
|
||||
int i;
|
||||
|
||||
if (name[0] == '#' && strlen(name) == 7)
|
||||
if (name[0] == '#' && STRLEN(name) == 7)
|
||||
{
|
||||
/* Name is in "#rrggbb" format */
|
||||
r = hex_digit(name[1]) * 16 + hex_digit(name[2]);
|
||||
@@ -1780,10 +1781,17 @@ process_message(void)
|
||||
#ifdef FEAT_CHANNEL
|
||||
if (msg.message == WM_NETBEANS)
|
||||
{
|
||||
int channel_idx = channel_socket2idx((sock_T)msg.wParam);
|
||||
int what;
|
||||
channel_T *channel = channel_fd2channel((sock_T)msg.wParam, &what);
|
||||
|
||||
if (channel_idx >= 0)
|
||||
channel_read(channel_idx);
|
||||
if (channel != NULL)
|
||||
{
|
||||
/* Disable error messages, they can mess up the display and throw
|
||||
* an exception. */
|
||||
++emsg_off;
|
||||
channel_read(channel, what, "process_message");
|
||||
--emsg_off;
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -2091,6 +2099,10 @@ gui_mch_wait_for_chars(int wtime)
|
||||
parse_queued_messages();
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_CHANNEL
|
||||
channel_handle_events();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Don't use gui_mch_update() because then we will spin-lock until a
|
||||
* char arrives, instead we use GetMessage() to hang until an
|
||||
@@ -2261,7 +2273,7 @@ GetTextWidth(HDC hdc, char_u *str, int len)
|
||||
{
|
||||
SIZE size;
|
||||
|
||||
GetTextExtentPoint(hdc, str, len, &size);
|
||||
GetTextExtentPoint(hdc, (LPCSTR)str, len, &size);
|
||||
return size.cx;
|
||||
}
|
||||
|
||||
@@ -2434,7 +2446,7 @@ add_tabline_popup_menu_entry(HMENU pmenu, UINT item_id, char_u *item_text)
|
||||
info.fMask = MIIM_TYPE | MIIM_ID;
|
||||
info.wID = item_id;
|
||||
info.fType = MFT_STRING;
|
||||
info.dwTypeData = item_text;
|
||||
info.dwTypeData = (LPTSTR)item_text;
|
||||
info.cch = (UINT)STRLEN(item_text);
|
||||
InsertMenuItem(pmenu, item_id, FALSE, &info);
|
||||
}
|
||||
@@ -2461,10 +2473,11 @@ show_tabline_popup_menu(void)
|
||||
|
||||
if (first_tabpage->tp_next != NULL)
|
||||
add_tabline_popup_menu_entry(tab_pmenu,
|
||||
TABLINE_MENU_CLOSE, _("Close tab"));
|
||||
add_tabline_popup_menu_entry(tab_pmenu, TABLINE_MENU_NEW, _("New tab"));
|
||||
add_tabline_popup_menu_entry(tab_pmenu, TABLINE_MENU_OPEN,
|
||||
_("Open tab..."));
|
||||
TABLINE_MENU_CLOSE, (char_u *)_("Close tab"));
|
||||
add_tabline_popup_menu_entry(tab_pmenu,
|
||||
TABLINE_MENU_NEW, (char_u *)_("New tab"));
|
||||
add_tabline_popup_menu_entry(tab_pmenu,
|
||||
TABLINE_MENU_OPEN, (char_u *)_("Open tab..."));
|
||||
|
||||
GetCursorPos(&pt);
|
||||
rval = TrackPopupMenuEx(tab_pmenu, TPM_RETURNCMD, pt.x, pt.y, s_tabhwnd,
|
||||
@@ -2576,7 +2589,7 @@ gui_mch_update_tabline(void)
|
||||
}
|
||||
|
||||
get_tabline_label(tp, FALSE);
|
||||
tie.pszText = NameBuff;
|
||||
tie.pszText = (LPSTR)NameBuff;
|
||||
#ifdef FEAT_MBYTE
|
||||
wstr = NULL;
|
||||
if (use_unicode)
|
||||
@@ -2673,7 +2686,7 @@ initialise_findrep(char_u *initial_string)
|
||||
if (wword)
|
||||
s_findrep_struct.Flags |= FR_WHOLEWORD;
|
||||
if (entry_text != NULL && *entry_text != NUL)
|
||||
vim_strncpy(s_findrep_struct.lpstrFindWhat, entry_text,
|
||||
vim_strncpy((char_u *)s_findrep_struct.lpstrFindWhat, entry_text,
|
||||
s_findrep_struct.wFindWhatLen - 1);
|
||||
vim_free(entry_text);
|
||||
}
|
||||
@@ -3187,11 +3200,11 @@ logfont2name(LOGFONT lf)
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
int len;
|
||||
acp_to_enc(lf.lfFaceName, (int)strlen(lf.lfFaceName),
|
||||
acp_to_enc((char_u *)lf.lfFaceName, (int)strlen(lf.lfFaceName),
|
||||
(char_u **)&font_name, &len);
|
||||
}
|
||||
#endif
|
||||
res = alloc((unsigned)(strlen(font_name) + 20
|
||||
res = (char *)alloc((unsigned)(strlen(font_name) + 20
|
||||
+ (charset_name == NULL ? 0 : strlen(charset_name) + 2)));
|
||||
if (res != NULL)
|
||||
{
|
||||
@@ -3226,7 +3239,7 @@ logfont2name(LOGFONT lf)
|
||||
if (font_name != lf.lfFaceName)
|
||||
vim_free(font_name);
|
||||
#endif
|
||||
return res;
|
||||
return (char_u *)res;
|
||||
}
|
||||
|
||||
|
||||
@@ -3316,7 +3329,7 @@ gui_mch_init_font(char_u *font_name, int fontset)
|
||||
return FAIL;
|
||||
|
||||
if (font_name == NULL)
|
||||
font_name = lf.lfFaceName;
|
||||
font_name = (char_u *)lf.lfFaceName;
|
||||
#if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME)
|
||||
norm_logfont = lf;
|
||||
sub_logfont = lf;
|
||||
@@ -3746,12 +3759,12 @@ gui_mch_browse(
|
||||
fileStruct.lStructSize = sizeof(fileStruct);
|
||||
#endif
|
||||
|
||||
fileStruct.lpstrTitle = title;
|
||||
fileStruct.lpstrDefExt = ext;
|
||||
fileStruct.lpstrTitle = (LPSTR)title;
|
||||
fileStruct.lpstrDefExt = (LPSTR)ext;
|
||||
|
||||
fileStruct.lpstrFile = fileBuf;
|
||||
fileStruct.lpstrFile = (LPSTR)fileBuf;
|
||||
fileStruct.nMaxFile = MAXPATHL;
|
||||
fileStruct.lpstrFilter = filterp;
|
||||
fileStruct.lpstrFilter = (LPSTR)filterp;
|
||||
fileStruct.hwndOwner = s_hwnd; /* main Vim window is owner*/
|
||||
/* has an initial dir been specified? */
|
||||
if (initdir != NULL && *initdir != NUL)
|
||||
@@ -3762,7 +3775,7 @@ gui_mch_browse(
|
||||
for (p = initdirp; *p != NUL; ++p)
|
||||
if (*p == '/')
|
||||
*p = '\\';
|
||||
fileStruct.lpstrInitialDir = initdirp;
|
||||
fileStruct.lpstrInitialDir = (LPSTR)initdirp;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3844,7 +3857,7 @@ _OnDropFiles(
|
||||
#endif
|
||||
{
|
||||
DragQueryFile(hDrop, i, szFile, BUFPATHLEN);
|
||||
fnames[i] = vim_strsave(szFile);
|
||||
fnames[i] = vim_strsave((char_u *)szFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -839,7 +839,7 @@ cs_create_connection(int i)
|
||||
# ifdef __BORLANDC__
|
||||
# define OPEN_OH_ARGTYPE long
|
||||
# else
|
||||
# if (_MSC_VER >= 1300)
|
||||
# if (_MSC_VER >= 1300) || defined(__MINGW32__)
|
||||
# define OPEN_OH_ARGTYPE intptr_t
|
||||
# else
|
||||
# define OPEN_OH_ARGTYPE long
|
||||
@@ -1423,7 +1423,7 @@ cs_insert_filelist(
|
||||
/* On windows 9x GetFileInformationByHandle doesn't work, so skip it */
|
||||
if (!mch_windows95())
|
||||
{
|
||||
switch (win32_fileinfo(fname, &bhfi))
|
||||
switch (win32_fileinfo((char_u *)fname, &bhfi))
|
||||
{
|
||||
case FILEINFO_ENC_FAIL: /* enc_to_utf16() failed */
|
||||
case FILEINFO_READ_FAIL: /* CreateFile() failed */
|
||||
@@ -1459,7 +1459,8 @@ cs_insert_filelist(
|
||||
&& csinfo[j].st_dev == sb->st_dev && csinfo[j].st_ino == sb->st_ino
|
||||
#else
|
||||
/* compare pathnames first */
|
||||
&& ((fullpathcmp(csinfo[j].fname, fname, FALSE) & FPC_SAME)
|
||||
&& ((fullpathcmp((char_u *)csinfo[j].fname,
|
||||
(char_u *)fname, FALSE) & FPC_SAME)
|
||||
/* if not Windows 9x, test index file attributes too */
|
||||
|| (!mch_windows95()
|
||||
&& csinfo[j].nVolume == bhfi.dwVolumeSerialNumber
|
||||
|
||||
+2
-2
@@ -1101,10 +1101,10 @@ startup_mzscheme(void)
|
||||
MZ_GC_VAR_IN_REG(0, coll_path);
|
||||
MZ_GC_REG();
|
||||
/* workaround for dynamic loading on windows */
|
||||
s = vim_getenv("PLTCOLLECTS", &mustfree);
|
||||
s = vim_getenv((char_u *)"PLTCOLLECTS", &mustfree);
|
||||
if (s != NULL)
|
||||
{
|
||||
coll_path = scheme_make_path(s);
|
||||
coll_path = scheme_make_path((char *)s);
|
||||
MZ_GC_CHECK();
|
||||
if (mustfree)
|
||||
vim_free(s);
|
||||
|
||||
@@ -49,6 +49,12 @@
|
||||
# define __inline__ __inline
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
#endif
|
||||
|
||||
#include <EXTERN.h>
|
||||
#include <perl.h>
|
||||
#include <XSUB.h>
|
||||
@@ -1730,3 +1736,6 @@ Append(vimbuf, ...)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
+4
-5
@@ -5831,11 +5831,10 @@ convert_dl(PyObject *obj, typval_T *tv,
|
||||
}
|
||||
/* As we are not using copy_tv which increments reference count we must
|
||||
* do it ourself. */
|
||||
switch(tv->v_type)
|
||||
{
|
||||
case VAR_DICT: ++tv->vval.v_dict->dv_refcount; break;
|
||||
case VAR_LIST: ++tv->vval.v_list->lv_refcount; break;
|
||||
}
|
||||
if (tv->v_type == VAR_DICT)
|
||||
++tv->vval.v_dict->dv_refcount;
|
||||
else if (tv->v_type == VAR_LIST)
|
||||
++tv->vval.v_list->lv_refcount;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -43,6 +43,15 @@
|
||||
# undef _DEBUG
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRFTIME
|
||||
# undef HAVE_STRFTIME
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# undef HAVE_STRING_H
|
||||
#endif
|
||||
#ifdef HAVE_PUTENV
|
||||
# undef HAVE_PUTENV
|
||||
#endif
|
||||
#ifdef HAVE_STDARG_H
|
||||
# undef HAVE_STDARG_H /* Python's config.h defines it as well. */
|
||||
#endif
|
||||
@@ -1560,6 +1569,13 @@ do_pyeval (char_u *str, typval_T *rettv)
|
||||
rettv->v_type = VAR_NUMBER;
|
||||
rettv->vval.v_number = 0;
|
||||
break;
|
||||
case VAR_NUMBER:
|
||||
case VAR_STRING:
|
||||
case VAR_FLOAT:
|
||||
case VAR_SPECIAL:
|
||||
case VAR_JOB:
|
||||
case VAR_CHANNEL:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,15 @@
|
||||
# undef F_BLANK
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRFTIME
|
||||
# undef HAVE_STRFTIME
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# undef HAVE_STRING_H
|
||||
#endif
|
||||
#ifdef HAVE_PUTENV
|
||||
# undef HAVE_PUTENV
|
||||
#endif
|
||||
#ifdef HAVE_STDARG_H
|
||||
# undef HAVE_STDARG_H /* Python's config.h defines it as well. */
|
||||
#endif
|
||||
@@ -1649,6 +1658,13 @@ do_py3eval (char_u *str, typval_T *rettv)
|
||||
rettv->v_type = VAR_NUMBER;
|
||||
rettv->vval.v_number = 0;
|
||||
break;
|
||||
case VAR_NUMBER:
|
||||
case VAR_STRING:
|
||||
case VAR_FLOAT:
|
||||
case VAR_SPECIAL:
|
||||
case VAR_JOB:
|
||||
case VAR_CHANNEL:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -166,6 +166,10 @@
|
||||
# define RSTRING_PTR(s) RSTRING(s)->ptr
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DUP
|
||||
# undef HAVE_DUP
|
||||
#endif
|
||||
|
||||
#include "vim.h"
|
||||
#include "version.h"
|
||||
|
||||
@@ -261,6 +265,7 @@ static void ruby_vim_init(void);
|
||||
# define rb_raise dll_rb_raise
|
||||
# define rb_str_cat dll_rb_str_cat
|
||||
# define rb_str_concat dll_rb_str_concat
|
||||
# undef rb_str_new
|
||||
# define rb_str_new dll_rb_str_new
|
||||
# ifdef rb_str_new2
|
||||
/* Ruby may #define rb_str_new2 to use rb_str_new_cstr. */
|
||||
@@ -308,7 +313,8 @@ static void ruby_vim_init(void);
|
||||
# define ruby_script dll_ruby_script
|
||||
# define rb_enc_find_index dll_rb_enc_find_index
|
||||
# define rb_enc_find dll_rb_enc_find
|
||||
# define rb_enc_str_new dll_rb_enc_str_new
|
||||
# undef rb_enc_str_new
|
||||
# define rb_enc_str_new dll_rb_enc_str_new
|
||||
# define rb_sprintf dll_rb_sprintf
|
||||
# define rb_require dll_rb_require
|
||||
# define ruby_options dll_ruby_options
|
||||
|
||||
+108
-42
@@ -16,29 +16,37 @@
|
||||
#include "vim.h"
|
||||
|
||||
#if defined(FEAT_EVAL) || defined(PROTO)
|
||||
static int json_encode_item(garray_T *gap, typval_T *val, int copyID);
|
||||
static int json_decode_item(js_read_T *reader, typval_T *res);
|
||||
static int json_encode_item(garray_T *gap, typval_T *val, int copyID, int options);
|
||||
static int json_decode_item(js_read_T *reader, typval_T *res, int options);
|
||||
|
||||
/*
|
||||
* Encode "val" into a JSON format string.
|
||||
* The result is in allocated memory.
|
||||
* The result is empty when encoding fails.
|
||||
* "options" can be JSON_JS or zero;
|
||||
*/
|
||||
char_u *
|
||||
json_encode(typval_T *val)
|
||||
json_encode(typval_T *val, int options)
|
||||
{
|
||||
garray_T ga;
|
||||
|
||||
/* Store bytes in the growarray. */
|
||||
ga_init2(&ga, 1, 4000);
|
||||
json_encode_item(&ga, val, get_copyID());
|
||||
if (json_encode_item(&ga, val, get_copyID(), options) == FAIL)
|
||||
{
|
||||
vim_free(ga.ga_data);
|
||||
return vim_strsave((char_u *)"");
|
||||
}
|
||||
return ga.ga_data;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode ["nr", "val"] into a JSON format string.
|
||||
* Encode ["nr", "val"] into a JSON format string in allocated memory.
|
||||
* "options" can be JSON_JS or zero;
|
||||
* Returns NULL when out of memory.
|
||||
*/
|
||||
char_u *
|
||||
json_encode_nr_expr(int nr, typval_T *val)
|
||||
json_encode_nr_expr(int nr, typval_T *val, int options)
|
||||
{
|
||||
typval_T listtv;
|
||||
typval_T nrtv;
|
||||
@@ -55,7 +63,7 @@ json_encode_nr_expr(int nr, typval_T *val)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
text = json_encode(&listtv);
|
||||
text = json_encode(&listtv, options);
|
||||
list_unref(listtv.vval.v_list);
|
||||
return text;
|
||||
}
|
||||
@@ -116,12 +124,30 @@ write_string(garray_T *gap, char_u *str)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE if "key" can be used without quotes.
|
||||
* That is when it starts with a letter and only contains letters, digits and
|
||||
* underscore.
|
||||
*/
|
||||
static int
|
||||
is_simple_key(char_u *key)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
if (!ASCII_ISALPHA(*key))
|
||||
return FALSE;
|
||||
for (p = key + 1; *p != NUL; ++p)
|
||||
if (!ASCII_ISALPHA(*p) && *p != '_' && !vim_isdigit(*p))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode "val" into "gap".
|
||||
* Return FAIL or OK.
|
||||
*/
|
||||
static int
|
||||
json_encode_item(garray_T *gap, typval_T *val, int copyID)
|
||||
json_encode_item(garray_T *gap, typval_T *val, int copyID, int options)
|
||||
{
|
||||
char_u numbuf[NUMBUFLEN];
|
||||
char_u *res;
|
||||
@@ -135,7 +161,11 @@ json_encode_item(garray_T *gap, typval_T *val, int copyID)
|
||||
{
|
||||
case VVAL_FALSE: ga_concat(gap, (char_u *)"false"); break;
|
||||
case VVAL_TRUE: ga_concat(gap, (char_u *)"true"); break;
|
||||
case VVAL_NONE: break;
|
||||
case VVAL_NONE: if ((options & JSON_JS) != 0
|
||||
&& (options & JSON_NO_NONE) == 0)
|
||||
/* empty item */
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
case VVAL_NULL: ga_concat(gap, (char_u *)"null"); break;
|
||||
}
|
||||
break;
|
||||
@@ -152,7 +182,9 @@ json_encode_item(garray_T *gap, typval_T *val, int copyID)
|
||||
break;
|
||||
|
||||
case VAR_FUNC:
|
||||
/* no JSON equivalent */
|
||||
case VAR_JOB:
|
||||
case VAR_CHANNEL:
|
||||
/* no JSON equivalent TODO: better error */
|
||||
EMSG(_(e_invarg));
|
||||
return FAIL;
|
||||
|
||||
@@ -172,8 +204,15 @@ json_encode_item(garray_T *gap, typval_T *val, int copyID)
|
||||
ga_append(gap, '[');
|
||||
for (li = l->lv_first; li != NULL && !got_int; )
|
||||
{
|
||||
if (json_encode_item(gap, &li->li_tv, copyID) == FAIL)
|
||||
if (json_encode_item(gap, &li->li_tv, copyID,
|
||||
options & JSON_JS) == FAIL)
|
||||
return FAIL;
|
||||
if ((options & JSON_JS)
|
||||
&& li->li_next == NULL
|
||||
&& li->li_tv.v_type == VAR_SPECIAL
|
||||
&& li->li_tv.vval.v_number == VVAL_NONE)
|
||||
/* add an extra comma if the last item is v:none */
|
||||
ga_append(gap, ',');
|
||||
li = li->li_next;
|
||||
if (li != NULL)
|
||||
ga_append(gap, ',');
|
||||
@@ -210,10 +249,14 @@ json_encode_item(garray_T *gap, typval_T *val, int copyID)
|
||||
first = FALSE;
|
||||
else
|
||||
ga_append(gap, ',');
|
||||
write_string(gap, hi->hi_key);
|
||||
if ((options & JSON_JS)
|
||||
&& is_simple_key(hi->hi_key))
|
||||
ga_concat(gap, hi->hi_key);
|
||||
else
|
||||
write_string(gap, hi->hi_key);
|
||||
ga_append(gap, ':');
|
||||
if (json_encode_item(gap, &dict_lookup(hi)->di_tv,
|
||||
copyID) == FAIL)
|
||||
copyID, options | JSON_NO_NONE) == FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
ga_append(gap, '}');
|
||||
@@ -222,14 +265,15 @@ json_encode_item(garray_T *gap, typval_T *val, int copyID)
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef FEAT_FLOAT
|
||||
case VAR_FLOAT:
|
||||
#ifdef FEAT_FLOAT
|
||||
vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", val->vval.v_float);
|
||||
ga_concat(gap, numbuf);
|
||||
break;
|
||||
#endif
|
||||
default: EMSG2(_(e_intern2), "json_encode_item()"); break;
|
||||
return FAIL;
|
||||
case VAR_UNKNOWN:
|
||||
EMSG2(_(e_intern2), "json_encode_item()"); break;
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
@@ -250,7 +294,8 @@ fill_numbuflen(js_read_T *reader)
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip white space in "reader".
|
||||
* Skip white space in "reader". All characters <= space are considered white
|
||||
* space.
|
||||
* Also tops up readahead when needed.
|
||||
*/
|
||||
static void
|
||||
@@ -267,7 +312,7 @@ json_skip_white(js_read_T *reader)
|
||||
reader->js_end = reader->js_buf + STRLEN(reader->js_buf);
|
||||
continue;
|
||||
}
|
||||
if (c != ' ' && c != TAB && c != NL && c != CAR)
|
||||
if (c == NUL || c > ' ')
|
||||
break;
|
||||
++reader->js_used;
|
||||
}
|
||||
@@ -275,7 +320,7 @@ json_skip_white(js_read_T *reader)
|
||||
}
|
||||
|
||||
static int
|
||||
json_decode_array(js_read_T *reader, typval_T *res)
|
||||
json_decode_array(js_read_T *reader, typval_T *res, int options)
|
||||
{
|
||||
char_u *p;
|
||||
typval_T item;
|
||||
@@ -302,7 +347,7 @@ json_decode_array(js_read_T *reader, typval_T *res)
|
||||
break;
|
||||
}
|
||||
|
||||
ret = json_decode_item(reader, res == NULL ? NULL : &item);
|
||||
ret = json_decode_item(reader, res == NULL ? NULL : &item, options);
|
||||
if (ret != OK)
|
||||
return ret;
|
||||
if (res != NULL)
|
||||
@@ -332,7 +377,7 @@ json_decode_array(js_read_T *reader, typval_T *res)
|
||||
}
|
||||
|
||||
static int
|
||||
json_decode_object(js_read_T *reader, typval_T *res)
|
||||
json_decode_object(js_read_T *reader, typval_T *res, int options)
|
||||
{
|
||||
char_u *p;
|
||||
typval_T tvkey;
|
||||
@@ -362,16 +407,31 @@ json_decode_object(js_read_T *reader, typval_T *res)
|
||||
break;
|
||||
}
|
||||
|
||||
ret = json_decode_item(reader, res == NULL ? NULL : &tvkey);
|
||||
if (ret != OK)
|
||||
return ret;
|
||||
if (res != NULL)
|
||||
if ((options & JSON_JS) && reader->js_buf[reader->js_used] != '"')
|
||||
{
|
||||
key = get_tv_string_buf_chk(&tvkey, buf);
|
||||
if (key == NULL || *key == NUL)
|
||||
/* accept a key that is not in quotes */
|
||||
key = p = reader->js_buf + reader->js_used;
|
||||
while (*p != NUL && *p != ':' && *p > ' ')
|
||||
++p;
|
||||
tvkey.v_type = VAR_STRING;
|
||||
tvkey.vval.v_string = vim_strnsave(key, (int)(p - key));
|
||||
reader->js_used += (int)(p - key);
|
||||
key = tvkey.vval.v_string;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = json_decode_item(reader, res == NULL ? NULL : &tvkey,
|
||||
options);
|
||||
if (ret != OK)
|
||||
return ret;
|
||||
if (res != NULL)
|
||||
{
|
||||
clear_tv(&tvkey);
|
||||
return FAIL;
|
||||
key = get_tv_string_buf_chk(&tvkey, buf);
|
||||
if (key == NULL || *key == NUL)
|
||||
{
|
||||
clear_tv(&tvkey);
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,7 +448,7 @@ json_decode_object(js_read_T *reader, typval_T *res)
|
||||
++reader->js_used;
|
||||
json_skip_white(reader);
|
||||
|
||||
ret = json_decode_item(reader, res == NULL ? NULL : &item);
|
||||
ret = json_decode_item(reader, res == NULL ? NULL : &item, options);
|
||||
if (ret != OK)
|
||||
{
|
||||
if (res != NULL)
|
||||
@@ -554,7 +614,7 @@ json_decode_string(js_read_T *reader, typval_T *res)
|
||||
* Return MAYBE for an incomplete message.
|
||||
*/
|
||||
static int
|
||||
json_decode_item(js_read_T *reader, typval_T *res)
|
||||
json_decode_item(js_read_T *reader, typval_T *res, int options)
|
||||
{
|
||||
char_u *p;
|
||||
int len;
|
||||
@@ -564,15 +624,18 @@ json_decode_item(js_read_T *reader, typval_T *res)
|
||||
switch (*p)
|
||||
{
|
||||
case '[': /* array */
|
||||
return json_decode_array(reader, res);
|
||||
return json_decode_array(reader, res, options);
|
||||
|
||||
case '{': /* object */
|
||||
return json_decode_object(reader, res);
|
||||
return json_decode_object(reader, res, options);
|
||||
|
||||
case '"': /* string */
|
||||
return json_decode_string(reader, res);
|
||||
|
||||
case ',': /* comma: empty item */
|
||||
if ((options & JSON_JS) == 0)
|
||||
return FAIL;
|
||||
/* FALLTHROUGH */
|
||||
case NUL: /* empty */
|
||||
if (res != NULL)
|
||||
{
|
||||
@@ -676,17 +739,18 @@ json_decode_item(js_read_T *reader, typval_T *res)
|
||||
|
||||
/*
|
||||
* Decode the JSON from "reader" and store the result in "res".
|
||||
* "options" can be JSON_JS or zero;
|
||||
* Return FAIL if not the whole message was consumed.
|
||||
*/
|
||||
int
|
||||
json_decode_all(js_read_T *reader, typval_T *res)
|
||||
json_decode_all(js_read_T *reader, typval_T *res, int options)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* We get the end once, to avoid calling strlen() many times. */
|
||||
/* We find the end once, to avoid calling strlen() many times. */
|
||||
reader->js_end = reader->js_buf + STRLEN(reader->js_buf);
|
||||
json_skip_white(reader);
|
||||
ret = json_decode_item(reader, res);
|
||||
ret = json_decode_item(reader, res, options);
|
||||
if (ret != OK)
|
||||
return FAIL;
|
||||
json_skip_white(reader);
|
||||
@@ -697,18 +761,19 @@ json_decode_all(js_read_T *reader, typval_T *res)
|
||||
|
||||
/*
|
||||
* Decode the JSON from "reader" and store the result in "res".
|
||||
* "options" can be JSON_JS or zero;
|
||||
* Return FAIL if the message has a decoding error or the message is
|
||||
* truncated. Consumes the message anyway.
|
||||
*/
|
||||
int
|
||||
json_decode(js_read_T *reader, typval_T *res)
|
||||
json_decode(js_read_T *reader, typval_T *res, int options)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* We get the end once, to avoid calling strlen() many times. */
|
||||
/* We find the end once, to avoid calling strlen() many times. */
|
||||
reader->js_end = reader->js_buf + STRLEN(reader->js_buf);
|
||||
json_skip_white(reader);
|
||||
ret = json_decode_item(reader, res);
|
||||
ret = json_decode_item(reader, res, options);
|
||||
json_skip_white(reader);
|
||||
|
||||
return ret == OK ? OK : FAIL;
|
||||
@@ -716,6 +781,7 @@ json_decode(js_read_T *reader, typval_T *res)
|
||||
|
||||
/*
|
||||
* Decode the JSON from "reader" to find the end of the message.
|
||||
* "options" can be JSON_JS or zero;
|
||||
* Return FAIL if the message has a decoding error.
|
||||
* Return MAYBE if the message is truncated, need to read more.
|
||||
* This only works reliable if the message contains an object, array or
|
||||
@@ -723,15 +789,15 @@ json_decode(js_read_T *reader, typval_T *res)
|
||||
* Does not advance the reader.
|
||||
*/
|
||||
int
|
||||
json_find_end(js_read_T *reader)
|
||||
json_find_end(js_read_T *reader, int options)
|
||||
{
|
||||
int used_save = reader->js_used;
|
||||
int ret;
|
||||
|
||||
/* We get the end once, to avoid calling strlen() many times. */
|
||||
/* We find the end once, to avoid calling strlen() many times. */
|
||||
reader->js_end = reader->js_buf + STRLEN(reader->js_buf);
|
||||
json_skip_white(reader);
|
||||
ret = json_decode_item(reader, NULL);
|
||||
ret = json_decode_item(reader, NULL, options);
|
||||
reader->js_used = used_save;
|
||||
return ret;
|
||||
}
|
||||
|
||||
+49
-49
@@ -35,107 +35,107 @@ test_decode_find_end(void)
|
||||
|
||||
/* string and incomplete string */
|
||||
reader.js_buf = (char_u *)"\"hello\"";
|
||||
assert(json_find_end(&reader) == OK);
|
||||
assert(json_find_end(&reader, 0) == OK);
|
||||
reader.js_buf = (char_u *)" \"hello\" ";
|
||||
assert(json_find_end(&reader) == OK);
|
||||
assert(json_find_end(&reader, 0) == OK);
|
||||
reader.js_buf = (char_u *)"\"hello";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
|
||||
/* number and dash (incomplete number) */
|
||||
reader.js_buf = (char_u *)"123";
|
||||
assert(json_find_end(&reader) == OK);
|
||||
assert(json_find_end(&reader, 0) == OK);
|
||||
reader.js_buf = (char_u *)"-";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
|
||||
/* false, true and null, also incomplete */
|
||||
reader.js_buf = (char_u *)"false";
|
||||
assert(json_find_end(&reader) == OK);
|
||||
assert(json_find_end(&reader, 0) == OK);
|
||||
reader.js_buf = (char_u *)"f";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"fa";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"fal";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"fals";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
|
||||
reader.js_buf = (char_u *)"true";
|
||||
assert(json_find_end(&reader) == OK);
|
||||
assert(json_find_end(&reader, 0) == OK);
|
||||
reader.js_buf = (char_u *)"t";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"tr";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"tru";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
|
||||
reader.js_buf = (char_u *)"null";
|
||||
assert(json_find_end(&reader) == OK);
|
||||
assert(json_find_end(&reader, 0) == OK);
|
||||
reader.js_buf = (char_u *)"n";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"nu";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"nul";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
|
||||
/* object without white space */
|
||||
reader.js_buf = (char_u *)"{\"a\":123}";
|
||||
assert(json_find_end(&reader) == OK);
|
||||
assert(json_find_end(&reader, 0) == OK);
|
||||
reader.js_buf = (char_u *)"{\"a\":123";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"{\"a\":";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"{\"a\"";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"{\"a";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"{\"";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"{";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
|
||||
/* object with white space */
|
||||
reader.js_buf = (char_u *)" { \"a\" : 123 } ";
|
||||
assert(json_find_end(&reader) == OK);
|
||||
assert(json_find_end(&reader, 0) == OK);
|
||||
reader.js_buf = (char_u *)" { \"a\" : 123 ";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)" { \"a\" : ";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)" { \"a\" ";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)" { \"a ";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)" { ";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
|
||||
/* array without white space */
|
||||
reader.js_buf = (char_u *)"[\"a\",123]";
|
||||
assert(json_find_end(&reader) == OK);
|
||||
assert(json_find_end(&reader, 0) == OK);
|
||||
reader.js_buf = (char_u *)"[\"a\",123";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"[\"a\",";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"[\"a\"";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"[\"a";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"[\"";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)"[";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
|
||||
/* array with white space */
|
||||
reader.js_buf = (char_u *)" [ \"a\" , 123 ] ";
|
||||
assert(json_find_end(&reader) == OK);
|
||||
assert(json_find_end(&reader, 0) == OK);
|
||||
reader.js_buf = (char_u *)" [ \"a\" , 123 ";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)" [ \"a\" , ";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)" [ \"a\" ";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)" [ \"a ";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
reader.js_buf = (char_u *)" [ ";
|
||||
assert(json_find_end(&reader) == MAYBE);
|
||||
assert(json_find_end(&reader, 0) == MAYBE);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -157,15 +157,15 @@ test_fill_called_on_find_end(void)
|
||||
reader.js_used = 0;
|
||||
reader.js_buf = (char_u *)" [ \"a\" , 123 ";
|
||||
reader.js_cookie = " [ \"a\" , 123 ] ";
|
||||
assert(json_find_end(&reader) == OK);
|
||||
assert(json_find_end(&reader, 0) == OK);
|
||||
reader.js_buf = (char_u *)" [ \"a\" , ";
|
||||
assert(json_find_end(&reader) == OK);
|
||||
assert(json_find_end(&reader, 0) == OK);
|
||||
reader.js_buf = (char_u *)" [ \"a\" ";
|
||||
assert(json_find_end(&reader) == OK);
|
||||
assert(json_find_end(&reader, 0) == OK);
|
||||
reader.js_buf = (char_u *)" [ \"a";
|
||||
assert(json_find_end(&reader) == OK);
|
||||
assert(json_find_end(&reader, 0) == OK);
|
||||
reader.js_buf = (char_u *)" [ ";
|
||||
assert(json_find_end(&reader) == OK);
|
||||
assert(json_find_end(&reader, 0) == OK);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -4027,7 +4027,7 @@ build_drop_cmd(
|
||||
}
|
||||
cdp = vim_strsave_escaped_ext(cwd,
|
||||
#ifdef BACKSLASH_IN_FILENAME
|
||||
"", /* rem_backslash() will tell what chars to escape */
|
||||
(char_u *)"", /* rem_backslash() will tell what chars to escape */
|
||||
#else
|
||||
PATH_ESC_CHARS,
|
||||
#endif
|
||||
|
||||
+10
-8
@@ -473,7 +473,7 @@ enc_canon_props(char_u *name)
|
||||
CPINFO cpinfo;
|
||||
|
||||
/* Get info on this codepage to find out what it is. */
|
||||
if (GetCPInfo(atoi(name + 2), &cpinfo) != 0)
|
||||
if (GetCPInfo(atoi((char *)name + 2), &cpinfo) != 0)
|
||||
{
|
||||
if (cpinfo.MaxCharSize == 1) /* some single-byte encoding */
|
||||
return ENC_8BIT;
|
||||
@@ -535,7 +535,7 @@ mb_init(void)
|
||||
CPINFO cpinfo;
|
||||
|
||||
/* Get info on this codepage to find out what it is. */
|
||||
if (GetCPInfo(atoi(p_enc + 2), &cpinfo) != 0)
|
||||
if (GetCPInfo(atoi((char *)p_enc + 2), &cpinfo) != 0)
|
||||
{
|
||||
if (cpinfo.MaxCharSize == 1)
|
||||
{
|
||||
@@ -547,7 +547,7 @@ mb_init(void)
|
||||
&& (cpinfo.LeadByte[0] != 0 || cpinfo.LeadByte[1] != 0))
|
||||
{
|
||||
/* must be a DBCS encoding, check below */
|
||||
enc_dbcs_new = atoi(p_enc + 2);
|
||||
enc_dbcs_new = atoi((char *)p_enc + 2);
|
||||
}
|
||||
else
|
||||
goto codepage_invalid;
|
||||
@@ -571,7 +571,7 @@ codepage_invalid:
|
||||
#ifdef WIN3264
|
||||
/* Windows: accept only valid codepage numbers, check below. */
|
||||
if (p_enc[6] != 'c' || p_enc[7] != 'p'
|
||||
|| (enc_dbcs_new = atoi(p_enc + 8)) == 0)
|
||||
|| (enc_dbcs_new = atoi((char *)p_enc + 8)) == 0)
|
||||
return e_invarg;
|
||||
#else
|
||||
/* Unix: accept any "2byte-" name, assume current locale. */
|
||||
@@ -4420,7 +4420,7 @@ get_iconv_import_func(HINSTANCE hInst, const char *funcname)
|
||||
continue;
|
||||
pImpName = (PIMAGE_IMPORT_BY_NAME)(pImage
|
||||
+ (UINT_PTR)(pINT->u1.AddressOfData));
|
||||
if (strcmp(pImpName->Name, funcname) == 0)
|
||||
if (strcmp((char *)pImpName->Name, funcname) == 0)
|
||||
return (void *)pIAT->u1.Function;
|
||||
}
|
||||
}
|
||||
@@ -6422,7 +6422,7 @@ string_convert_ext(
|
||||
{
|
||||
tmp_len = MultiByteToWideChar(vcp->vc_cpfrom,
|
||||
unconvlenp ? MB_ERR_INVALID_CHARS : 0,
|
||||
ptr, len, 0, 0);
|
||||
(char *)ptr, len, 0, 0);
|
||||
if (tmp_len == 0
|
||||
&& GetLastError() == ERROR_NO_UNICODE_TRANSLATION)
|
||||
{
|
||||
@@ -6442,7 +6442,8 @@ string_convert_ext(
|
||||
if (vcp->vc_cpfrom == 0)
|
||||
utf8_to_utf16(ptr, len, tmp, unconvlenp);
|
||||
else
|
||||
MultiByteToWideChar(vcp->vc_cpfrom, 0, ptr, len, tmp, tmp_len);
|
||||
MultiByteToWideChar(vcp->vc_cpfrom, 0,
|
||||
(char *)ptr, len, tmp, tmp_len);
|
||||
|
||||
/* 2. ucs-2 -> codepage/UTF-8. */
|
||||
if (vcp->vc_cpto == 0)
|
||||
@@ -6457,7 +6458,8 @@ string_convert_ext(
|
||||
utf16_to_utf8(tmp, tmp_len, retval);
|
||||
else
|
||||
WideCharToMultiByte(vcp->vc_cpto, 0,
|
||||
tmp, tmp_len, retval, retlen, 0, 0);
|
||||
tmp, tmp_len,
|
||||
(char *)retval, retlen, 0, 0);
|
||||
retval[retlen] = NUL;
|
||||
if (lenp != NULL)
|
||||
*lenp = retlen;
|
||||
|
||||
+1
-1
@@ -1312,7 +1312,7 @@ mf_do_open(
|
||||
#ifdef HAVE_FD_CLOEXEC
|
||||
int fdflags = fcntl(mfp->mf_fd, F_GETFD);
|
||||
if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0)
|
||||
fcntl(mfp->mf_fd, F_SETFD, fdflags | FD_CLOEXEC);
|
||||
(void)fcntl(mfp->mf_fd, F_SETFD, fdflags | FD_CLOEXEC);
|
||||
#endif
|
||||
#if defined(HAVE_SELINUX) || defined(HAVE_SMACK)
|
||||
mch_copy_sec(fname, mfp->mf_fname);
|
||||
|
||||
+1
-1
@@ -728,7 +728,7 @@ ml_setname(buf_T *buf)
|
||||
{
|
||||
int fdflags = fcntl(mfp->mf_fd, F_GETFD);
|
||||
if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0)
|
||||
fcntl(mfp->mf_fd, F_SETFD, fdflags | FD_CLOEXEC);
|
||||
(void)fcntl(mfp->mf_fd, F_SETFD, fdflags | FD_CLOEXEC);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+2
-1
@@ -531,7 +531,8 @@ emsg(char_u *s)
|
||||
return TRUE;
|
||||
|
||||
called_emsg = TRUE;
|
||||
ex_exitval = 1;
|
||||
if (emsg_silent == 0)
|
||||
ex_exitval = 1;
|
||||
|
||||
/*
|
||||
* If "emsg_severe" is TRUE: When an error exception is to be thrown,
|
||||
|
||||
+4
-4
@@ -3785,7 +3785,7 @@ init_homedir(void)
|
||||
homedrive = mch_getenv((char_u *)"HOMEDRIVE");
|
||||
homepath = mch_getenv((char_u *)"HOMEPATH");
|
||||
if (homepath == NULL || *homepath == NUL)
|
||||
homepath = "\\";
|
||||
homepath = (char_u *)"\\";
|
||||
if (homedrive != NULL
|
||||
&& STRLEN(homedrive) + STRLEN(homepath) < MAXPATHL)
|
||||
{
|
||||
@@ -3823,7 +3823,7 @@ init_homedir(void)
|
||||
* Best assumption we can make in such a situation.
|
||||
*/
|
||||
if (var == NULL)
|
||||
var = "C:/";
|
||||
var = (char_u *)"C:/";
|
||||
#endif
|
||||
if (var != NULL)
|
||||
{
|
||||
@@ -9950,7 +9950,7 @@ dos_expandpath(
|
||||
|
||||
if (wn == NULL)
|
||||
# endif
|
||||
hFind = FindFirstFile(buf, &fb);
|
||||
hFind = FindFirstFile((LPCSTR)buf, &fb);
|
||||
ok = (hFind != INVALID_HANDLE_VALUE);
|
||||
#else
|
||||
/* If we are expanding wildcards we try both files and directories */
|
||||
@@ -10048,7 +10048,7 @@ dos_expandpath(
|
||||
}
|
||||
if (wn == NULL)
|
||||
# endif
|
||||
hFind = FindFirstFile(buf, &fb);
|
||||
hFind = FindFirstFile((LPCSTR)buf, &fb);
|
||||
ok = (hFind != INVALID_HANDLE_VALUE);
|
||||
#else
|
||||
ok = (findfirst((char *)buf, &fb,
|
||||
|
||||
@@ -1138,6 +1138,9 @@ free_all_mem(void)
|
||||
# endif
|
||||
# ifdef FEAT_DIFF
|
||||
diff_clear(curtab);
|
||||
# endif
|
||||
# ifdef FEAT_CHANNEL
|
||||
channel_free_all();
|
||||
# endif
|
||||
clear_sb_text(); /* free any scrollback text */
|
||||
|
||||
|
||||
+17
-17
@@ -63,8 +63,8 @@ static int nb_do_cmd(int, char_u *, int, int, char_u *);
|
||||
static void nb_send(char *buf, char *fun);
|
||||
static void nb_free(void);
|
||||
|
||||
#define NETBEANS_OPEN (nb_channel_idx >= 0 && channel_is_open(nb_channel_idx))
|
||||
static int nb_channel_idx = -1;
|
||||
#define NETBEANS_OPEN (channel_can_write_to(nb_channel))
|
||||
static channel_T *nb_channel = NULL;
|
||||
|
||||
static int r_cmdno; /* current command number for reply */
|
||||
static int dosetvisible = FALSE;
|
||||
@@ -85,7 +85,7 @@ static int inAtomic = 0;
|
||||
static void
|
||||
nb_channel_closed(void)
|
||||
{
|
||||
nb_channel_idx = -1;
|
||||
nb_channel = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -98,10 +98,10 @@ netbeans_close(void)
|
||||
if (NETBEANS_OPEN)
|
||||
{
|
||||
netbeans_send_disconnect();
|
||||
if (nb_channel_idx >= 0)
|
||||
if (nb_channel != NULL)
|
||||
/* Close the socket and remove the input handlers. */
|
||||
channel_close(nb_channel_idx);
|
||||
nb_channel_idx = -1;
|
||||
channel_close(nb_channel);
|
||||
nb_channel = NULL;
|
||||
}
|
||||
|
||||
#ifdef FEAT_BEVAL
|
||||
@@ -213,8 +213,8 @@ netbeans_connect(char *params, int doabort)
|
||||
if (hostname != NULL && address != NULL && password != NULL)
|
||||
{
|
||||
port = atoi(address);
|
||||
nb_channel_idx = channel_open(hostname, port, 0, nb_channel_closed);
|
||||
if (nb_channel_idx >= 0)
|
||||
nb_channel = channel_open(hostname, port, 3000, nb_channel_closed);
|
||||
if (nb_channel != NULL)
|
||||
{
|
||||
/* success */
|
||||
# ifdef FEAT_BEVAL
|
||||
@@ -230,7 +230,7 @@ netbeans_connect(char *params, int doabort)
|
||||
}
|
||||
}
|
||||
|
||||
if (nb_channel_idx < 0 && doabort)
|
||||
if (nb_channel == NULL && doabort)
|
||||
getout(1);
|
||||
|
||||
vim_free(hostname);
|
||||
@@ -383,9 +383,9 @@ netbeans_parse_messages(void)
|
||||
char_u *p;
|
||||
int own_node;
|
||||
|
||||
while (nb_channel_idx >= 0)
|
||||
while (nb_channel != NULL)
|
||||
{
|
||||
buffer = channel_peek(nb_channel_idx);
|
||||
buffer = channel_peek(nb_channel);
|
||||
if (buffer == NULL)
|
||||
break; /* nothing to read */
|
||||
|
||||
@@ -396,7 +396,7 @@ netbeans_parse_messages(void)
|
||||
/* Command isn't complete. If there is no following buffer,
|
||||
* return (wait for more). If there is another buffer following,
|
||||
* prepend the text to that buffer and delete this one. */
|
||||
if (channel_collapse(nb_channel_idx) == FAIL)
|
||||
if (channel_collapse(nb_channel) == FAIL)
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -409,7 +409,7 @@ netbeans_parse_messages(void)
|
||||
if (*p == NUL)
|
||||
{
|
||||
own_node = TRUE;
|
||||
channel_get(nb_channel_idx);
|
||||
channel_get(nb_channel);
|
||||
}
|
||||
else
|
||||
own_node = FALSE;
|
||||
@@ -600,8 +600,8 @@ nb_free(void)
|
||||
}
|
||||
|
||||
/* free the queued netbeans commands */
|
||||
if (nb_channel_idx >= 0)
|
||||
channel_clear(nb_channel_idx);
|
||||
if (nb_channel != NULL)
|
||||
channel_clear(nb_channel);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -756,8 +756,8 @@ netbeans_end(void)
|
||||
static void
|
||||
nb_send(char *buf, char *fun)
|
||||
{
|
||||
if (nb_channel_idx >= 0)
|
||||
channel_send(nb_channel_idx, (char_u *)buf, fun);
|
||||
if (nb_channel != NULL)
|
||||
channel_send(nb_channel, (char_u *)buf, fun);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+2
-2
@@ -3257,7 +3257,7 @@ set_init_1(void)
|
||||
# endif
|
||||
|| ((p = mch_getenv((char_u *)"COMSPEC")) != NULL && *p != NUL)
|
||||
# ifdef WIN3264
|
||||
|| ((p = default_shell()) != NULL && *p != NUL)
|
||||
|| ((p = (char_u *)default_shell()) != NULL && *p != NUL)
|
||||
# endif
|
||||
#endif
|
||||
)
|
||||
@@ -3540,7 +3540,7 @@ set_init_1(void)
|
||||
STRCPY(buf, "ja");
|
||||
else
|
||||
buf[2] = NUL; /* truncate to two-letter code */
|
||||
vim_setenv("LANG", buf);
|
||||
vim_setenv((char_u *)"LANG", (char_u *)buf);
|
||||
}
|
||||
}
|
||||
# else
|
||||
|
||||
+51
-47
@@ -273,11 +273,11 @@ mch_early_init(void)
|
||||
for (i = 0; i < 256; ++i)
|
||||
toupper_tab[i] = tolower_tab[i] = i;
|
||||
#ifdef WIN3264
|
||||
CharUpperBuff(toupper_tab, 256);
|
||||
CharLowerBuff(tolower_tab, 256);
|
||||
CharUpperBuff((LPSTR)toupper_tab, 256);
|
||||
CharLowerBuff((LPSTR)tolower_tab, 256);
|
||||
#else
|
||||
AnsiUpperBuff(toupper_tab, 256);
|
||||
AnsiLowerBuff(tolower_tab, 256);
|
||||
AnsiUpperBuff((LPSTR)toupper_tab, 256);
|
||||
AnsiLowerBuff((LPSTR)tolower_tab, 256);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ mch_settitle(
|
||||
}
|
||||
}
|
||||
# endif
|
||||
SetConsoleTitle(title);
|
||||
SetConsoleTitle((LPCSTR)title);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
@@ -428,7 +428,7 @@ mch_FullName(
|
||||
if (nResult == FAIL) /* fall back to non-wide function */
|
||||
#endif
|
||||
{
|
||||
if (_fullpath(buf, fname, len - 1) == NULL)
|
||||
if (_fullpath((char *)buf, (const char *)fname, len - 1) == NULL)
|
||||
{
|
||||
/* failed, use relative path name */
|
||||
vim_strncpy(buf, fname, len - 1);
|
||||
@@ -469,10 +469,10 @@ mch_isFullName(char_u *fname)
|
||||
return TRUE;
|
||||
|
||||
/* A name that can't be made absolute probably isn't absolute. */
|
||||
if (mch_FullName(fname, szName, sizeof(szName) - 1, FALSE) == FAIL)
|
||||
if (mch_FullName(fname, (char_u *)szName, sizeof(szName) - 1, FALSE) == FAIL)
|
||||
return FALSE;
|
||||
|
||||
return pathcmp(fname, szName, -1) == 0;
|
||||
return pathcmp((const char *)fname, (const char *)szName, -1) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -619,14 +619,14 @@ vim_stat(const char *name, struct stat *stp)
|
||||
/* WinNT and later can use _MAX_PATH wide characters for a pathname, which
|
||||
* means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is
|
||||
* UTF-8. */
|
||||
char buf[_MAX_PATH * 3 + 1];
|
||||
char_u buf[_MAX_PATH * 3 + 1];
|
||||
#else
|
||||
char buf[_MAX_PATH + 1];
|
||||
char_u buf[_MAX_PATH + 1];
|
||||
#endif
|
||||
char *p;
|
||||
char_u *p;
|
||||
|
||||
vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1);
|
||||
p = buf + strlen(buf);
|
||||
p = buf + STRLEN(buf);
|
||||
if (p > buf)
|
||||
mb_ptr_back(buf, p);
|
||||
|
||||
@@ -637,10 +637,10 @@ vim_stat(const char *name, struct stat *stp)
|
||||
if ((buf[0] == '\\' && buf[1] == '\\') || (buf[0] == '/' && buf[1] == '/'))
|
||||
{
|
||||
/* UNC root path must be followed by '\\'. */
|
||||
p = vim_strpbrk(buf + 2, "\\/");
|
||||
p = vim_strpbrk(buf + 2, (char_u *)"\\/");
|
||||
if (p != NULL)
|
||||
{
|
||||
p = vim_strpbrk(p + 1, "\\/");
|
||||
p = vim_strpbrk(p + 1, (char_u *)"\\/");
|
||||
if (p == NULL)
|
||||
STRCAT(buf, "\\");
|
||||
}
|
||||
@@ -668,7 +668,7 @@ vim_stat(const char *name, struct stat *stp)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return stat_symlink_aware(buf, stp);
|
||||
return stat_symlink_aware((char *)buf, stp);
|
||||
}
|
||||
|
||||
#if defined(FEAT_GUI_MSWIN) || defined(PROTO)
|
||||
@@ -741,7 +741,8 @@ display_errors(void)
|
||||
gui.starting ? (char_u *)_("Message") :
|
||||
#endif
|
||||
(char_u *)_("Error"),
|
||||
p, (char_u *)_("&Ok"), 1, NULL, FALSE);
|
||||
(char_u *)p, (char_u *)_("&Ok"),
|
||||
1, NULL, FALSE);
|
||||
break;
|
||||
}
|
||||
ga_clear(&error_ga);
|
||||
@@ -820,7 +821,7 @@ mch_chdir(char *path)
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
WCHAR *p = enc_to_utf16(path, NULL);
|
||||
WCHAR *p = enc_to_utf16((char_u *)path, NULL);
|
||||
int n;
|
||||
|
||||
if (p != NULL)
|
||||
@@ -853,7 +854,8 @@ can_end_termcap_mode(
|
||||
if (g_PlatformId == VER_PLATFORM_WIN32_NT || Columns == 80)
|
||||
return TRUE;
|
||||
if (give_msg)
|
||||
msg(_("'columns' is not 80, cannot execute external commands"));
|
||||
msg((char_u *)
|
||||
_("'columns' is not 80, cannot execute external commands"));
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
@@ -915,7 +917,7 @@ check_str_len(char_u *str)
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
size_t length = 0;
|
||||
size_t i;
|
||||
const char *p;
|
||||
const char_u *p;
|
||||
|
||||
/* get page size */
|
||||
GetSystemInfo(&si);
|
||||
@@ -953,7 +955,7 @@ mch_icon_load_cb(char_u *fname, void *cookie)
|
||||
HANDLE *h = (HANDLE *)cookie;
|
||||
|
||||
*h = LoadImage(NULL,
|
||||
fname,
|
||||
(LPSTR)fname,
|
||||
IMAGE_ICON,
|
||||
64,
|
||||
64,
|
||||
@@ -992,7 +994,7 @@ mch_libcall(
|
||||
# ifdef WIN16
|
||||
hinstLib = LoadLibrary(libname);
|
||||
# else
|
||||
hinstLib = vimLoadLib(libname);
|
||||
hinstLib = vimLoadLib((char *)libname);
|
||||
# endif
|
||||
|
||||
// If the handle is valid, try to get the function address.
|
||||
@@ -1005,25 +1007,25 @@ mch_libcall(
|
||||
if (argstring != NULL)
|
||||
{
|
||||
/* Call with string argument */
|
||||
ProcAdd = (MYSTRPROCSTR) GetProcAddress(hinstLib, funcname);
|
||||
ProcAdd = (MYSTRPROCSTR)GetProcAddress(hinstLib, (LPCSTR)funcname);
|
||||
if ((fRunTimeLinkSuccess = (ProcAdd != NULL)) != 0)
|
||||
{
|
||||
if (string_result == NULL)
|
||||
retval_int = ((MYSTRPROCINT)ProcAdd)(argstring);
|
||||
retval_int = ((MYSTRPROCINT)ProcAdd)((LPSTR)argstring);
|
||||
else
|
||||
retval_str = (ProcAdd)(argstring);
|
||||
retval_str = (char_u *)(ProcAdd)((LPSTR)argstring);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Call with number argument */
|
||||
ProcAddI = (MYINTPROCSTR) GetProcAddress(hinstLib, funcname);
|
||||
ProcAddI = (MYINTPROCSTR) GetProcAddress(hinstLib, (LPCSTR)funcname);
|
||||
if ((fRunTimeLinkSuccess = (ProcAddI != NULL)) != 0)
|
||||
{
|
||||
if (string_result == NULL)
|
||||
retval_int = ((MYINTPROCINT)ProcAddI)(argint);
|
||||
else
|
||||
retval_str = (ProcAddI)(argint);
|
||||
retval_str = (char_u *)(ProcAddI)(argint);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1228,7 +1230,7 @@ vimSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s)
|
||||
vim_free(wp);
|
||||
return ret;
|
||||
}
|
||||
return SetDlgItemText(hDlg, nIDDlgItem, s);
|
||||
return SetDlgItemText(hDlg, nIDDlgItem, (LPCSTR)s);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1283,18 +1285,18 @@ PrintDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
SendDlgItemMessage(hDlg, i, WM_SETFONT, (WPARAM)hfont, 1);
|
||||
if (GetDlgItemText(hDlg,i, buff, sizeof(buff)))
|
||||
vimSetDlgItemText(hDlg,i, _(buff));
|
||||
vimSetDlgItemText(hDlg,i, (char_u *)_(buff));
|
||||
}
|
||||
SendDlgItemMessage(hDlg, IDCANCEL,
|
||||
WM_SETFONT, (WPARAM)hfont, 1);
|
||||
if (GetDlgItemText(hDlg,IDCANCEL, buff, sizeof(buff)))
|
||||
vimSetDlgItemText(hDlg,IDCANCEL, _(buff));
|
||||
vimSetDlgItemText(hDlg,IDCANCEL, (char_u *)_(buff));
|
||||
}
|
||||
#endif
|
||||
SetWindowText(hDlg, szAppName);
|
||||
SetWindowText(hDlg, (LPCSTR)szAppName);
|
||||
if (prt_name != NULL)
|
||||
{
|
||||
vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (LPSTR)prt_name);
|
||||
vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (char_u *)prt_name);
|
||||
vim_free(prt_name);
|
||||
prt_name = NULL;
|
||||
}
|
||||
@@ -1585,7 +1587,7 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
|
||||
* NT, but NULL appears to work just as well.
|
||||
*/
|
||||
if (*p_pdev != NUL)
|
||||
prt_dlg.hDC = CreateDC(NULL, p_pdev, NULL, NULL);
|
||||
prt_dlg.hDC = CreateDC(NULL, (LPCSTR)p_pdev, NULL, NULL);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -1649,7 +1651,7 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
|
||||
{
|
||||
char_u *printer_name = (char_u *)devname + devname->wDeviceOffset;
|
||||
char_u *port_name = (char_u *)devname +devname->wOutputOffset;
|
||||
char_u *text = _("to %s on %s");
|
||||
char_u *text = (char_u *)_("to %s on %s");
|
||||
#ifdef FEAT_MBYTE
|
||||
char_u *printer_name_orig = printer_name;
|
||||
char_u *port_name_orig = port_name;
|
||||
@@ -1671,7 +1673,8 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
|
||||
prt_name = alloc((unsigned)(STRLEN(printer_name) + STRLEN(port_name)
|
||||
+ STRLEN(text)));
|
||||
if (prt_name != NULL)
|
||||
wsprintf(prt_name, text, printer_name, port_name);
|
||||
wsprintf((char *)prt_name, (const char *)text,
|
||||
printer_name, port_name);
|
||||
#ifdef FEAT_MBYTE
|
||||
if (printer_name != printer_name_orig)
|
||||
vim_free(printer_name);
|
||||
@@ -1781,11 +1784,11 @@ mch_print_begin(prt_settings_T *psettings)
|
||||
SetAbortProc(prt_dlg.hDC, AbortProc);
|
||||
#endif
|
||||
wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname));
|
||||
vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (LPSTR)szBuffer);
|
||||
vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (char_u *)szBuffer);
|
||||
|
||||
vim_memset(&di, 0, sizeof(DOCINFO));
|
||||
di.cbSize = sizeof(DOCINFO);
|
||||
di.lpszDocName = psettings->jobname;
|
||||
di.lpszDocName = (LPCSTR)psettings->jobname;
|
||||
ret = StartDoc(prt_dlg.hDC, &di);
|
||||
|
||||
#ifdef FEAT_GUI
|
||||
@@ -1815,7 +1818,7 @@ mch_print_end_page(void)
|
||||
mch_print_begin_page(char_u *msg)
|
||||
{
|
||||
if (msg != NULL)
|
||||
vimSetDlgItemText(hDlgPrint, IDC_PROGRESS, (LPSTR)msg);
|
||||
vimSetDlgItemText(hDlgPrint, IDC_PROGRESS, msg);
|
||||
return (StartPage(prt_dlg.hDC) > 0);
|
||||
}
|
||||
|
||||
@@ -1878,16 +1881,17 @@ mch_print_text_out(char_u *p, int len)
|
||||
}
|
||||
#endif
|
||||
TextOut(prt_dlg.hDC, prt_pos_x + prt_left_margin,
|
||||
prt_pos_y + prt_top_margin, p, len);
|
||||
prt_pos_y + prt_top_margin,
|
||||
(LPCSTR)p, len);
|
||||
#ifndef FEAT_PROPORTIONAL_FONTS
|
||||
prt_pos_x += len * prt_tm.tmAveCharWidth;
|
||||
return (prt_pos_x + prt_left_margin + prt_tm.tmAveCharWidth
|
||||
+ prt_tm.tmOverhang > prt_right_margin);
|
||||
#else
|
||||
# ifdef WIN16
|
||||
GetTextExtentPoint(prt_dlg.hDC, p, len, &sz);
|
||||
GetTextExtentPoint(prt_dlg.hDC, (LPCSTR)p, len, &sz);
|
||||
# else
|
||||
GetTextExtentPoint32(prt_dlg.hDC, p, len, &sz);
|
||||
GetTextExtentPoint32(prt_dlg.hDC, (LPCSTR)p, len, &sz);
|
||||
# endif
|
||||
prt_pos_x += (sz.cx - prt_tm.tmOverhang);
|
||||
/* This is wrong when printing spaces for a TAB. */
|
||||
@@ -2027,7 +2031,7 @@ shortcut_errorw:
|
||||
goto shortcut_end;
|
||||
|
||||
// full path string must be in Unicode.
|
||||
MultiByteToWideChar(CP_ACP, 0, fname, -1, wsz, MAX_PATH);
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR)fname, -1, wsz, MAX_PATH);
|
||||
|
||||
// "load" the name and resolve the link
|
||||
hr = ppf->lpVtbl->Load(ppf, wsz, STGM_READ);
|
||||
@@ -2043,7 +2047,7 @@ shortcut_errorw:
|
||||
ZeroMemory(buf, MAX_PATH);
|
||||
hr = psl->lpVtbl->GetPath(psl, buf, MAX_PATH, &ffd, 0);
|
||||
if (hr == S_OK && buf[0] != NUL)
|
||||
rfname = vim_strsave(buf);
|
||||
rfname = vim_strsave((char_u *)buf);
|
||||
|
||||
shortcut_end:
|
||||
// Release all interface pointers (both belong to the same object)
|
||||
@@ -2234,7 +2238,7 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
if (res == NULL)
|
||||
{
|
||||
res = vim_strsave(_(e_invexprmsg));
|
||||
res = vim_strsave((char_u *)_(e_invexprmsg));
|
||||
reply.dwData = COPYDATA_ERROR_RESULT;
|
||||
}
|
||||
else
|
||||
@@ -2399,8 +2403,8 @@ enumWindowsGetNames(HWND hwnd, LPARAM lparam)
|
||||
return TRUE;
|
||||
|
||||
/* Add the name to the list */
|
||||
ga_concat(ga, server);
|
||||
ga_concat(ga, "\n");
|
||||
ga_concat(ga, (char_u *)server);
|
||||
ga_concat(ga, (char_u *)"\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2459,7 +2463,7 @@ serverSetName(char_u *name)
|
||||
#endif
|
||||
|
||||
/* Update the message window title */
|
||||
SetWindowText(message_window, ok_name);
|
||||
SetWindowText(message_window, (LPCSTR)ok_name);
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
/* Set the servername variable */
|
||||
@@ -2948,7 +2952,7 @@ get_logfont(
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
int len;
|
||||
enc_to_acp(name, (int)strlen(name), &acpname, &len);
|
||||
enc_to_acp(name, (int)STRLEN(name), &acpname, &len);
|
||||
name = acpname;
|
||||
}
|
||||
#endif
|
||||
|
||||
+320
-78
@@ -3925,6 +3925,107 @@ wait4pid(pid_t child, waitstatus *status)
|
||||
return wait_pid;
|
||||
}
|
||||
|
||||
#if defined(FEAT_JOB) || !defined(USE_SYSTEM) || defined(PROTO)
|
||||
/*
|
||||
* Parse "cmd" and put the white-separated parts in "argv".
|
||||
* "argv" is an allocated array with "argc" entries.
|
||||
* Returns FAIL when out of memory.
|
||||
*/
|
||||
int
|
||||
mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc)
|
||||
{
|
||||
int i;
|
||||
char_u *p;
|
||||
int inquote;
|
||||
|
||||
/*
|
||||
* Do this loop twice:
|
||||
* 1: find number of arguments
|
||||
* 2: separate them and build argv[]
|
||||
*/
|
||||
for (i = 0; i < 2; ++i)
|
||||
{
|
||||
p = cmd;
|
||||
inquote = FALSE;
|
||||
*argc = 0;
|
||||
for (;;)
|
||||
{
|
||||
if (i == 1)
|
||||
(*argv)[*argc] = (char *)p;
|
||||
++*argc;
|
||||
while (*p != NUL && (inquote || (*p != ' ' && *p != TAB)))
|
||||
{
|
||||
if (*p == '"')
|
||||
inquote = !inquote;
|
||||
++p;
|
||||
}
|
||||
if (*p == NUL)
|
||||
break;
|
||||
if (i == 1)
|
||||
*p++ = NUL;
|
||||
p = skipwhite(p);
|
||||
}
|
||||
if (*argv == NULL)
|
||||
{
|
||||
if (use_shcf)
|
||||
{
|
||||
/* Account for possible multiple args in p_shcf. */
|
||||
p = p_shcf;
|
||||
for (;;)
|
||||
{
|
||||
p = skiptowhite(p);
|
||||
if (*p == NUL)
|
||||
break;
|
||||
++*argc;
|
||||
p = skipwhite(p);
|
||||
}
|
||||
}
|
||||
|
||||
*argv = (char **)alloc((unsigned)((*argc + 4) * sizeof(char *)));
|
||||
if (*argv == NULL) /* out of memory */
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(USE_SYSTEM) || defined(FEAT_JOB)
|
||||
static void
|
||||
set_child_environment(void)
|
||||
{
|
||||
# ifdef HAVE_SETENV
|
||||
char envbuf[50];
|
||||
# else
|
||||
static char envbuf_Rows[20];
|
||||
static char envbuf_Columns[20];
|
||||
# endif
|
||||
|
||||
/* Simulate to have a dumb terminal (for now) */
|
||||
# ifdef HAVE_SETENV
|
||||
setenv("TERM", "dumb", 1);
|
||||
sprintf((char *)envbuf, "%ld", Rows);
|
||||
setenv("ROWS", (char *)envbuf, 1);
|
||||
sprintf((char *)envbuf, "%ld", Rows);
|
||||
setenv("LINES", (char *)envbuf, 1);
|
||||
sprintf((char *)envbuf, "%ld", Columns);
|
||||
setenv("COLUMNS", (char *)envbuf, 1);
|
||||
# else
|
||||
/*
|
||||
* Putenv does not copy the string, it has to remain valid.
|
||||
* Use a static array to avoid losing allocated memory.
|
||||
*/
|
||||
putenv("TERM=dumb");
|
||||
sprintf(envbuf_Rows, "ROWS=%ld", Rows);
|
||||
putenv(envbuf_Rows);
|
||||
sprintf(envbuf_Rows, "LINES=%ld", Rows);
|
||||
putenv(envbuf_Rows);
|
||||
sprintf(envbuf_Columns, "COLUMNS=%ld", Columns);
|
||||
putenv(envbuf_Columns);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
mch_call_shell(
|
||||
char_u *cmd,
|
||||
@@ -4058,7 +4159,7 @@ mch_call_shell(
|
||||
# define EXEC_FAILED 122 /* Exit code when shell didn't execute. Don't use
|
||||
127, some shells use that already */
|
||||
|
||||
char_u *newcmd = NULL;
|
||||
char_u *newcmd;
|
||||
pid_t pid;
|
||||
pid_t wpid = 0;
|
||||
pid_t wait_pid = 0;
|
||||
@@ -4073,7 +4174,6 @@ mch_call_shell(
|
||||
char_u *p_shcf_copy = NULL;
|
||||
int i;
|
||||
char_u *p;
|
||||
int inquote;
|
||||
int pty_master_fd = -1; /* for pty's */
|
||||
# ifdef FEAT_GUI
|
||||
int pty_slave_fd = -1;
|
||||
@@ -4082,12 +4182,6 @@ mch_call_shell(
|
||||
int fd_toshell[2]; /* for pipes */
|
||||
int fd_fromshell[2];
|
||||
int pipe_error = FALSE;
|
||||
# ifdef HAVE_SETENV
|
||||
char envbuf[50];
|
||||
# else
|
||||
static char envbuf_Rows[20];
|
||||
static char envbuf_Columns[20];
|
||||
# endif
|
||||
int did_settmode = FALSE; /* settmode(TMODE_RAW) called */
|
||||
|
||||
newcmd = vim_strsave(p_sh);
|
||||
@@ -4104,53 +4198,9 @@ mch_call_shell(
|
||||
if (options & SHELL_COOKED)
|
||||
settmode(TMODE_COOK); /* set to normal mode */
|
||||
|
||||
/*
|
||||
* Do this loop twice:
|
||||
* 1: find number of arguments
|
||||
* 2: separate them and build argv[]
|
||||
*/
|
||||
for (i = 0; i < 2; ++i)
|
||||
{
|
||||
p = newcmd;
|
||||
inquote = FALSE;
|
||||
argc = 0;
|
||||
for (;;)
|
||||
{
|
||||
if (i == 1)
|
||||
argv[argc] = (char *)p;
|
||||
++argc;
|
||||
while (*p && (inquote || (*p != ' ' && *p != TAB)))
|
||||
{
|
||||
if (*p == '"')
|
||||
inquote = !inquote;
|
||||
++p;
|
||||
}
|
||||
if (*p == NUL)
|
||||
break;
|
||||
if (i == 1)
|
||||
*p++ = NUL;
|
||||
p = skipwhite(p);
|
||||
}
|
||||
if (argv == NULL)
|
||||
{
|
||||
/*
|
||||
* Account for possible multiple args in p_shcf.
|
||||
*/
|
||||
p = p_shcf;
|
||||
for (;;)
|
||||
{
|
||||
p = skiptowhite(p);
|
||||
if (*p == NUL)
|
||||
break;
|
||||
++argc;
|
||||
p = skipwhite(p);
|
||||
}
|
||||
if (mch_parse_cmd(newcmd, TRUE, &argv, &argc) == FAIL)
|
||||
goto error;
|
||||
|
||||
argv = (char **)alloc((unsigned)((argc + 4) * sizeof(char *)));
|
||||
if (argv == NULL) /* out of memory */
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
if (cmd != NULL)
|
||||
{
|
||||
char_u *s;
|
||||
@@ -4347,28 +4397,7 @@ mch_call_shell(
|
||||
# endif
|
||||
}
|
||||
# endif
|
||||
/* Simulate to have a dumb terminal (for now) */
|
||||
# ifdef HAVE_SETENV
|
||||
setenv("TERM", "dumb", 1);
|
||||
sprintf((char *)envbuf, "%ld", Rows);
|
||||
setenv("ROWS", (char *)envbuf, 1);
|
||||
sprintf((char *)envbuf, "%ld", Rows);
|
||||
setenv("LINES", (char *)envbuf, 1);
|
||||
sprintf((char *)envbuf, "%ld", Columns);
|
||||
setenv("COLUMNS", (char *)envbuf, 1);
|
||||
# else
|
||||
/*
|
||||
* Putenv does not copy the string, it has to remain valid.
|
||||
* Use a static array to avoid losing allocated memory.
|
||||
*/
|
||||
putenv("TERM=dumb");
|
||||
sprintf(envbuf_Rows, "ROWS=%ld", Rows);
|
||||
putenv(envbuf_Rows);
|
||||
sprintf(envbuf_Rows, "LINES=%ld", Rows);
|
||||
putenv(envbuf_Rows);
|
||||
sprintf(envbuf_Columns, "COLUMNS=%ld", Columns);
|
||||
putenv(envbuf_Columns);
|
||||
# endif
|
||||
set_child_environment();
|
||||
|
||||
/*
|
||||
* stderr is only redirected when using the GUI, so that a
|
||||
@@ -5028,6 +5057,211 @@ error:
|
||||
#endif /* USE_SYSTEM */
|
||||
}
|
||||
|
||||
#if defined(FEAT_JOB) || defined(PROTO)
|
||||
void
|
||||
mch_start_job(char **argv, job_T *job, jobopt_T *options)
|
||||
{
|
||||
pid_t pid;
|
||||
int fd_in[2]; /* for stdin */
|
||||
int fd_out[2]; /* for stdout */
|
||||
int fd_err[2]; /* for stderr */
|
||||
# ifdef FEAT_CHANNEL
|
||||
channel_T *channel = NULL;
|
||||
#endif
|
||||
|
||||
/* default is to fail */
|
||||
job->jv_status = JOB_FAILED;
|
||||
fd_in[0] = -1;
|
||||
fd_out[0] = -1;
|
||||
fd_err[0] = -1;
|
||||
|
||||
/* TODO: without the channel feature connect the child to /dev/null? */
|
||||
# ifdef FEAT_CHANNEL
|
||||
/* Open pipes for stdin, stdout, stderr. */
|
||||
if ((pipe(fd_in) < 0) || (pipe(fd_out) < 0) ||(pipe(fd_err) < 0))
|
||||
goto failed;
|
||||
|
||||
channel = add_channel();
|
||||
if (channel == NULL)
|
||||
goto failed;
|
||||
# endif
|
||||
|
||||
pid = fork(); /* maybe we should use vfork() */
|
||||
if (pid == -1)
|
||||
{
|
||||
/* failed to fork */
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (pid == 0)
|
||||
{
|
||||
/* child */
|
||||
reset_signals(); /* handle signals normally */
|
||||
|
||||
# ifdef HAVE_SETSID
|
||||
/* Create our own process group, so that the child and all its
|
||||
* children can be kill()ed. Don't do this when using pipes,
|
||||
* because stdin is not a tty, we would lose /dev/tty. */
|
||||
(void)setsid();
|
||||
# endif
|
||||
|
||||
set_child_environment();
|
||||
|
||||
/* TODO: re-enable this when pipes connect without a channel */
|
||||
# ifdef FEAT_CHANNEL
|
||||
/* set up stdin for the child */
|
||||
close(fd_in[1]);
|
||||
close(0);
|
||||
ignored = dup(fd_in[0]);
|
||||
close(fd_in[0]);
|
||||
|
||||
/* set up stdout for the child */
|
||||
close(fd_out[0]);
|
||||
close(1);
|
||||
ignored = dup(fd_out[1]);
|
||||
close(fd_out[1]);
|
||||
|
||||
/* set up stderr for the child */
|
||||
close(fd_err[0]);
|
||||
close(2);
|
||||
ignored = dup(fd_err[1]);
|
||||
close(fd_err[1]);
|
||||
# endif
|
||||
|
||||
/* See above for type of argv. */
|
||||
execvp(argv[0], argv);
|
||||
|
||||
perror("executing job failed");
|
||||
_exit(EXEC_FAILED); /* exec failed, return failure code */
|
||||
}
|
||||
|
||||
/* parent */
|
||||
job->jv_pid = pid;
|
||||
job->jv_status = JOB_STARTED;
|
||||
# ifdef FEAT_CHANNEL
|
||||
job->jv_channel = channel;
|
||||
# endif
|
||||
|
||||
/* child stdin, stdout and stderr */
|
||||
close(fd_in[0]);
|
||||
close(fd_out[1]);
|
||||
close(fd_err[1]);
|
||||
# ifdef FEAT_CHANNEL
|
||||
channel_set_pipes(channel, fd_in[1], fd_out[0], fd_err[0]);
|
||||
channel_set_job(channel, job);
|
||||
channel_set_options(channel, options);
|
||||
# ifdef FEAT_GUI
|
||||
channel_gui_register(channel);
|
||||
# endif
|
||||
# endif
|
||||
|
||||
return;
|
||||
|
||||
failed:
|
||||
# ifdef FEAT_CHANNEL
|
||||
if (channel != NULL)
|
||||
channel_free(channel);
|
||||
# endif
|
||||
if (fd_in[0] >= 0)
|
||||
{
|
||||
close(fd_in[0]);
|
||||
close(fd_in[1]);
|
||||
}
|
||||
if (fd_out[0] >= 0)
|
||||
{
|
||||
close(fd_out[0]);
|
||||
close(fd_out[1]);
|
||||
}
|
||||
if (fd_err[0] >= 0)
|
||||
{
|
||||
close(fd_err[0]);
|
||||
close(fd_err[1]);
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
mch_job_status(job_T *job)
|
||||
{
|
||||
# ifdef HAVE_UNION_WAIT
|
||||
union wait status;
|
||||
# else
|
||||
int status = -1;
|
||||
# endif
|
||||
pid_t wait_pid = 0;
|
||||
|
||||
# ifdef __NeXT__
|
||||
wait_pid = wait4(job->jv_pid, &status, WNOHANG, (struct rusage *)0);
|
||||
# else
|
||||
wait_pid = waitpid(job->jv_pid, &status, WNOHANG);
|
||||
# endif
|
||||
if (wait_pid == -1)
|
||||
{
|
||||
/* process must have exited */
|
||||
job->jv_status = JOB_ENDED;
|
||||
return "dead";
|
||||
}
|
||||
if (wait_pid == 0)
|
||||
return "run";
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
/* LINTED avoid "bitwise operation on signed value" */
|
||||
job->jv_exitval = WEXITSTATUS(status);
|
||||
job->jv_status = JOB_ENDED;
|
||||
return "dead";
|
||||
}
|
||||
if (WIFSIGNALED(status))
|
||||
{
|
||||
job->jv_exitval = -1;
|
||||
job->jv_status = JOB_ENDED;
|
||||
return "dead";
|
||||
}
|
||||
return "run";
|
||||
}
|
||||
|
||||
int
|
||||
mch_stop_job(job_T *job, char_u *how)
|
||||
{
|
||||
int sig = -1;
|
||||
pid_t job_pid;
|
||||
|
||||
if (STRCMP(how, "hup") == 0)
|
||||
sig = SIGHUP;
|
||||
else if (*how == NUL || STRCMP(how, "term") == 0)
|
||||
sig = SIGTERM;
|
||||
else if (STRCMP(how, "quit") == 0)
|
||||
sig = SIGQUIT;
|
||||
else if (STRCMP(how, "kill") == 0)
|
||||
sig = SIGKILL;
|
||||
else if (isdigit(*how))
|
||||
sig = atoi((char *)how);
|
||||
else
|
||||
return FAIL;
|
||||
|
||||
/* TODO: have an option to only kill the process, not the group? */
|
||||
job_pid = job->jv_pid;
|
||||
if (job_pid == getpgid(job_pid))
|
||||
job_pid = -job_pid;
|
||||
|
||||
kill(job_pid, sig);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear the data related to "job".
|
||||
*/
|
||||
void
|
||||
mch_clear_job(job_T *job)
|
||||
{
|
||||
/* call waitpid because child process may become zombie */
|
||||
# ifdef __NeXT__
|
||||
wait4(job->jv_pid, NULL, WNOHANG, (struct rusage *)0);
|
||||
# else
|
||||
waitpid(job->jv_pid, NULL, WNOHANG);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Check for CTRL-C typed by reading all available characters.
|
||||
* In cooked mode we should get SIGINT, no need to check.
|
||||
@@ -5133,11 +5367,12 @@ WaitForChar(long msec)
|
||||
#if defined(__BEOS__)
|
||||
int
|
||||
#else
|
||||
static int
|
||||
static int
|
||||
#endif
|
||||
RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED)
|
||||
{
|
||||
int ret;
|
||||
int result;
|
||||
#if defined(FEAT_XCLIPBOARD) || defined(USE_XSMP) || defined(FEAT_MZSCHEME)
|
||||
static int busy = FALSE;
|
||||
|
||||
@@ -5254,6 +5489,9 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED)
|
||||
#endif
|
||||
|
||||
ret = poll(fds, nfd, towait);
|
||||
|
||||
result = ret > 0 && (fds[0].revents & POLLIN);
|
||||
|
||||
# ifdef FEAT_MZSCHEME
|
||||
if (ret == 0 && mzquantum_used)
|
||||
/* MzThreads scheduling is required and timeout occurred */
|
||||
@@ -5401,6 +5639,10 @@ select_eintr:
|
||||
# endif
|
||||
|
||||
ret = select(maxfd + 1, &rfds, NULL, &efds, tvp);
|
||||
result = ret > 0 && FD_ISSET(fd, &rfds);
|
||||
if (result)
|
||||
--ret;
|
||||
|
||||
# ifdef EINTR
|
||||
if (ret == -1 && errno == EINTR)
|
||||
{
|
||||
@@ -5521,7 +5763,7 @@ select_eintr:
|
||||
#endif
|
||||
}
|
||||
|
||||
return (ret > 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifndef NO_EXPANDPATH
|
||||
|
||||
+229
-86
@@ -91,7 +91,6 @@ FILE* fdDump = NULL;
|
||||
*/
|
||||
#ifdef PROTO
|
||||
#define WINAPI
|
||||
#define WINBASEAPI
|
||||
typedef char * LPCSTR;
|
||||
typedef char * LPWSTR;
|
||||
typedef int ACCESS_MASK;
|
||||
@@ -148,14 +147,14 @@ typedef int PROCESS_INFORMATION;
|
||||
* and Michael Dietrich for helping me figure out this workaround.
|
||||
*/
|
||||
|
||||
/* WINBASEAPI BOOL WINAPI GetConsoleKeyboardLayoutNameA(LPSTR); */
|
||||
#ifndef WINBASEAPI
|
||||
# define WINBASEAPI __stdcall
|
||||
/* WINAPI BOOL WINAPI GetConsoleKeyboardLayoutNameA(LPSTR); */
|
||||
#ifndef WINAPI
|
||||
# define WINAPI __stdcall
|
||||
#endif
|
||||
#if defined(__BORLANDC__)
|
||||
typedef BOOL (__stdcall *PFNGCKLN)(LPSTR);
|
||||
#else
|
||||
typedef WINBASEAPI BOOL (WINAPI *PFNGCKLN)(LPSTR);
|
||||
typedef BOOL (WINAPI *PFNGCKLN)(LPSTR);
|
||||
#endif
|
||||
static PFNGCKLN s_pfnGetConsoleKeyboardLayoutName = NULL;
|
||||
#endif
|
||||
@@ -237,6 +236,7 @@ static char_u *exe_path = NULL;
|
||||
|
||||
static BOOL win8_or_later = FALSE;
|
||||
|
||||
#ifndef FEAT_GUI_W32
|
||||
/*
|
||||
* Version of ReadConsoleInput() that works with IME.
|
||||
* Works around problems on Windows 8.
|
||||
@@ -326,6 +326,7 @@ peek_console_input(
|
||||
return read_console_input(hInput, lpBuffer, -1, lpEvents);
|
||||
}
|
||||
|
||||
# ifdef FEAT_CLIENTSERVER
|
||||
static DWORD
|
||||
msg_wait_for_multiple_objects(
|
||||
DWORD nCount,
|
||||
@@ -339,7 +340,9 @@ msg_wait_for_multiple_objects(
|
||||
return MsgWaitForMultipleObjects(nCount, pHandles, fWaitAll,
|
||||
dwMilliseconds, dwWakeMask);
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifndef FEAT_CLIENTSERVER
|
||||
static DWORD
|
||||
wait_for_single_object(
|
||||
HANDLE hHandle,
|
||||
@@ -349,6 +352,8 @@ wait_for_single_object(
|
||||
return WAIT_OBJECT_0;
|
||||
return WaitForSingleObject(hHandle, dwMilliseconds);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static void
|
||||
get_exe_name(void)
|
||||
@@ -388,7 +393,7 @@ get_exe_name(void)
|
||||
STRCAT(temp, ";");
|
||||
}
|
||||
STRCAT(temp, exe_path);
|
||||
vim_setenv((char_u *)"PATH", temp);
|
||||
vim_setenv((char_u *)"PATH", (char_u *)temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -440,7 +445,7 @@ vimLoadLib(char *name)
|
||||
/* Change directory to where the executable is, both to make
|
||||
* sure we find a .dll there and to avoid looking for a .dll
|
||||
* in the current directory. */
|
||||
SetCurrentDirectory(exe_path);
|
||||
SetCurrentDirectory((LPCSTR)exe_path);
|
||||
dll = LoadLibrary(name);
|
||||
SetCurrentDirectoryW(old_dirw);
|
||||
return dll;
|
||||
@@ -453,7 +458,7 @@ vimLoadLib(char *name)
|
||||
/* Change directory to where the executable is, both to make
|
||||
* sure we find a .dll there and to avoid looking for a .dll
|
||||
* in the current directory. */
|
||||
SetCurrentDirectory(exe_path);
|
||||
SetCurrentDirectory((LPCSTR)exe_path);
|
||||
dll = LoadLibrary(name);
|
||||
SetCurrentDirectory(old_dir);
|
||||
}
|
||||
@@ -1123,30 +1128,6 @@ mch_setmouse(int on)
|
||||
SetConsoleMode(g_hConIn, cmodein);
|
||||
}
|
||||
|
||||
#ifdef FEAT_CHANNEL
|
||||
static int
|
||||
handle_channel_event(void)
|
||||
{
|
||||
int ret;
|
||||
fd_set rfds;
|
||||
int maxfd;
|
||||
|
||||
FD_ZERO(&rfds);
|
||||
maxfd = channel_select_setup(-1, &rfds);
|
||||
if (maxfd >= 0)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
ret = select(maxfd + 1, &rfds, NULL, NULL, &tv);
|
||||
if (ret > 0 && channel_select_check(ret, &rfds) > 0)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Decode a MOUSE_EVENT. If it's a valid event, return MOUSE_LEFT,
|
||||
* MOUSE_MIDDLE, or MOUSE_RIGHT for a click; MOUSE_DRAG for a mouse
|
||||
@@ -1490,8 +1471,7 @@ WaitForChar(long msec)
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_CHANNEL
|
||||
if (handle_channel_event())
|
||||
return TRUE;
|
||||
channel_handle_events();
|
||||
#endif
|
||||
|
||||
if (0
|
||||
@@ -1961,7 +1941,7 @@ executable_exists(char *name, char_u **path)
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
WCHAR *p = enc_to_utf16(name, NULL);
|
||||
WCHAR *p = enc_to_utf16((char_u *)name, NULL);
|
||||
WCHAR fnamew[_MAX_PATH];
|
||||
WCHAR *dumw;
|
||||
WCHAR *wcurpath, *wnewpath;
|
||||
@@ -2003,10 +1983,10 @@ executable_exists(char *name, char_u **path)
|
||||
vim_free(newpath);
|
||||
if (n == 0)
|
||||
return FALSE;
|
||||
if (mch_isdir(fname))
|
||||
if (mch_isdir((char_u *)fname))
|
||||
return FALSE;
|
||||
if (path != NULL)
|
||||
*path = vim_strsave(fname);
|
||||
*path = vim_strsave((char_u *)fname);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2383,7 +2363,7 @@ static ConsoleBuffer g_cbTermcap = { 0 };
|
||||
#ifdef __BORLANDC__
|
||||
typedef HWND (__stdcall *GETCONSOLEWINDOWPROC)(VOID);
|
||||
#else
|
||||
typedef WINBASEAPI HWND (WINAPI *GETCONSOLEWINDOWPROC)(VOID);
|
||||
typedef HWND (WINAPI *GETCONSOLEWINDOWPROC)(VOID);
|
||||
#endif
|
||||
char g_szOrigTitle[256] = { 0 };
|
||||
HWND g_hWnd = NULL; /* also used in os_mswin.c */
|
||||
@@ -2439,18 +2419,15 @@ SetConsoleIcon(
|
||||
HICON hIconSmall,
|
||||
HICON hIcon)
|
||||
{
|
||||
HICON hPrevIconSmall;
|
||||
HICON hPrevIcon;
|
||||
|
||||
if (hWnd == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (hIconSmall != NULL)
|
||||
hPrevIconSmall = (HICON)SendMessage(hWnd, WM_SETICON,
|
||||
(WPARAM)ICON_SMALL, (LPARAM)hIconSmall);
|
||||
SendMessage(hWnd, WM_SETICON,
|
||||
(WPARAM)ICON_SMALL, (LPARAM)hIconSmall);
|
||||
if (hIcon != NULL)
|
||||
hPrevIcon = (HICON)SendMessage(hWnd, WM_SETICON,
|
||||
(WPARAM)ICON_BIG,(LPARAM) hIcon);
|
||||
SendMessage(hWnd, WM_SETICON,
|
||||
(WPARAM)ICON_BIG, (LPARAM) hIcon);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2496,7 +2473,7 @@ SaveConsoleTitleAndIcon(void)
|
||||
|
||||
/* Extract the first icon contained in the Vim executable. */
|
||||
if (mch_icon_load((HANDLE *)&g_hVimIcon) == FAIL || g_hVimIcon == NULL)
|
||||
g_hVimIcon = ExtractIcon(NULL, exe_name, 0);
|
||||
g_hVimIcon = ExtractIcon(NULL, (LPCSTR)exe_name, 0);
|
||||
if (g_hVimIcon != NULL)
|
||||
g_fCanChangeIcon = TRUE;
|
||||
}
|
||||
@@ -2851,7 +2828,7 @@ fname_case(
|
||||
return;
|
||||
|
||||
/* Build the new name in szTrueName[] one component at a time. */
|
||||
porig = name;
|
||||
porig = (char *)name;
|
||||
ptrue = szTrueName;
|
||||
|
||||
if (isalpha(porig[0]) && porig[1] == ':')
|
||||
@@ -2877,7 +2854,7 @@ fname_case(
|
||||
|
||||
if (enc_dbcs)
|
||||
{
|
||||
l = (*mb_ptr2len)(porig);
|
||||
l = (*mb_ptr2len)((char_u *)porig);
|
||||
while (--l >= 0)
|
||||
*ptrue++ = *porig++;
|
||||
}
|
||||
@@ -2978,7 +2955,7 @@ mch_get_user_name(
|
||||
#endif
|
||||
if (GetUserName(szUserName, &cch))
|
||||
{
|
||||
vim_strncpy(s, szUserName, len - 1);
|
||||
vim_strncpy(s, (char_u *)szUserName, len - 1);
|
||||
return OK;
|
||||
}
|
||||
s[0] = NUL;
|
||||
@@ -3018,8 +2995,8 @@ mch_get_host_name(
|
||||
/* Retry with non-wide function (for Windows 98). */
|
||||
}
|
||||
#endif
|
||||
if (!GetComputerName(s, &cch))
|
||||
vim_strncpy(s, "PC (Win32 Vim)", len - 1);
|
||||
if (!GetComputerName((LPSTR)s, &cch))
|
||||
vim_strncpy(s, (char_u *)"PC (Win32 Vim)", len - 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -3069,7 +3046,7 @@ mch_dirname(
|
||||
/* Retry with non-wide function (for Windows 98). */
|
||||
}
|
||||
#endif
|
||||
return (GetCurrentDirectory(len, buf) != 0 ? OK : FAIL);
|
||||
return (GetCurrentDirectory(len, (LPSTR)buf) != 0 ? OK : FAIL);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3082,7 +3059,7 @@ mch_getperm(char_u *name)
|
||||
struct stat st;
|
||||
int n;
|
||||
|
||||
n = mch_stat(name, &st);
|
||||
n = mch_stat((char *)name, &st);
|
||||
return n == 0 ? (long)(unsigned short)st.st_mode : -1L;
|
||||
}
|
||||
|
||||
@@ -3113,7 +3090,7 @@ mch_setperm(char_u *name, long perm)
|
||||
}
|
||||
if (n == -1)
|
||||
#endif
|
||||
n = _chmod(name, perm);
|
||||
n = _chmod((const char *)name, perm);
|
||||
if (n == -1)
|
||||
return FAIL;
|
||||
|
||||
@@ -3197,7 +3174,7 @@ mch_mkdir(char_u *name)
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
return _mkdir(name);
|
||||
return _mkdir((const char *)name);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3221,7 +3198,7 @@ mch_rmdir(char_u *name)
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
return _rmdir(name);
|
||||
return _rmdir((const char *)name);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3260,7 +3237,7 @@ mch_is_symbolic_link(char_u *name)
|
||||
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
||||
{
|
||||
/* Retry with non-wide function (for Windows 98). */
|
||||
hFind = FindFirstFile(name, &findDataA);
|
||||
hFind = FindFirstFile((LPCSTR)name, &findDataA);
|
||||
if (hFind != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
fileFlags = findDataA.dwFileAttributes;
|
||||
@@ -3276,7 +3253,7 @@ mch_is_symbolic_link(char_u *name)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
hFind = FindFirstFile(name, &findDataA);
|
||||
hFind = FindFirstFile((LPCSTR)name, &findDataA);
|
||||
if (hFind != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
fileFlags = findDataA.dwFileAttributes;
|
||||
@@ -3347,8 +3324,8 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info)
|
||||
}
|
||||
if (wn == NULL)
|
||||
#endif
|
||||
hFile = CreateFile(fname, /* file name */
|
||||
GENERIC_READ, /* access mode */
|
||||
hFile = CreateFile((LPCSTR)fname, /* file name */
|
||||
GENERIC_READ, /* access mode */
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE, /* share mode */
|
||||
NULL, /* security descriptor */
|
||||
OPEN_EXISTING, /* creation disposition */
|
||||
@@ -3566,13 +3543,13 @@ mch_nodetype(char_u *name)
|
||||
}
|
||||
if (wn == NULL)
|
||||
#endif
|
||||
hFile = CreateFile(name, /* file name */
|
||||
GENERIC_WRITE, /* access mode */
|
||||
0, /* share mode */
|
||||
NULL, /* security descriptor */
|
||||
OPEN_EXISTING, /* creation disposition */
|
||||
0, /* file attributes */
|
||||
NULL); /* handle to template file */
|
||||
hFile = CreateFile((LPCSTR)name, /* file name */
|
||||
GENERIC_WRITE, /* access mode */
|
||||
0, /* share mode */
|
||||
NULL, /* security descriptor */
|
||||
OPEN_EXISTING, /* creation disposition */
|
||||
0, /* file attributes */
|
||||
NULL); /* handle to template file */
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
vim_free(wn);
|
||||
@@ -4084,7 +4061,7 @@ vim_create_process(
|
||||
# ifdef FEAT_MBYTE
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
WCHAR *wcmd = enc_to_utf16(cmd, NULL);
|
||||
WCHAR *wcmd = enc_to_utf16((char_u *)cmd, NULL);
|
||||
|
||||
if (wcmd != NULL)
|
||||
{
|
||||
@@ -4155,7 +4132,7 @@ mch_system_classic(char *cmd, int options)
|
||||
si.cbReserved2 = 0;
|
||||
si.lpReserved2 = NULL;
|
||||
|
||||
/* There is a strange error on Windows 95 when using "c:\\command.com".
|
||||
/* There is a strange error on Windows 95 when using "c:\command.com".
|
||||
* When the "c:\\" is left out it works OK...? */
|
||||
if (mch_windows95()
|
||||
&& (STRNICMP(cmd, "c:/command.com", 14) == 0
|
||||
@@ -4725,7 +4702,7 @@ mch_system(char *cmd, int options)
|
||||
{
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
WCHAR *wcmd = enc_to_utf16(cmd, NULL);
|
||||
WCHAR *wcmd = enc_to_utf16((char_u *)cmd, NULL);
|
||||
if (wcmd != NULL)
|
||||
{
|
||||
int ret = _wsystem(wcmd);
|
||||
@@ -4768,7 +4745,7 @@ mch_call_shell(
|
||||
wcscat(szShellTitle, L" :sh");
|
||||
else
|
||||
{
|
||||
WCHAR *wn = enc_to_utf16(cmd, NULL);
|
||||
WCHAR *wn = enc_to_utf16((char_u *)cmd, NULL);
|
||||
|
||||
if (wn != NULL)
|
||||
{
|
||||
@@ -4793,8 +4770,9 @@ mch_call_shell(
|
||||
else
|
||||
{
|
||||
strcat(szShellTitle, " - !");
|
||||
if ((strlen(szShellTitle) + strlen(cmd) < sizeof(szShellTitle)))
|
||||
strcat(szShellTitle, cmd);
|
||||
if ((strlen(szShellTitle) + strlen((char *)cmd)
|
||||
< sizeof(szShellTitle)))
|
||||
strcat(szShellTitle, (char *)cmd);
|
||||
}
|
||||
SetConsoleTitle(szShellTitle);
|
||||
}
|
||||
@@ -4831,7 +4809,7 @@ mch_call_shell(
|
||||
|
||||
if (cmd == NULL)
|
||||
{
|
||||
x = mch_system(p_sh, options);
|
||||
x = mch_system((char *)p_sh, options);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4915,9 +4893,10 @@ mch_call_shell(
|
||||
char_u *cmd_shell = mch_getenv("COMSPEC");
|
||||
|
||||
if (cmd_shell == NULL || *cmd_shell == NUL)
|
||||
cmd_shell = default_shell();
|
||||
cmd_shell = (char_u *)default_shell();
|
||||
|
||||
subcmd = vim_strsave_escaped_ext(cmdbase, "|", '^', FALSE);
|
||||
subcmd = vim_strsave_escaped_ext(cmdbase,
|
||||
(char_u *)"|", '^', FALSE);
|
||||
if (subcmd != NULL)
|
||||
{
|
||||
/* make "cmd.exe /c arguments" */
|
||||
@@ -4937,7 +4916,7 @@ mch_call_shell(
|
||||
* inherit our handles which causes unpleasant dangling swap
|
||||
* files if we exit before the spawned process
|
||||
*/
|
||||
if (vim_create_process(newcmd, FALSE, flags, &si, &pi))
|
||||
if (vim_create_process((char *)newcmd, FALSE, flags, &si, &pi))
|
||||
x = 0;
|
||||
else
|
||||
{
|
||||
@@ -5010,7 +4989,7 @@ mch_call_shell(
|
||||
#endif
|
||||
)
|
||||
{
|
||||
smsg(_("shell returned %d"), x);
|
||||
smsg((char_u *)_("shell returned %d"), x);
|
||||
msg_putchar('\n');
|
||||
}
|
||||
#ifdef FEAT_TITLE
|
||||
@@ -5032,6 +5011,170 @@ mch_call_shell(
|
||||
return x;
|
||||
}
|
||||
|
||||
#if defined(FEAT_JOB) || defined(PROTO)
|
||||
void
|
||||
mch_start_job(char *cmd, job_T *job, jobopt_T *options)
|
||||
{
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
HANDLE jo;
|
||||
# ifdef FEAT_CHANNEL
|
||||
channel_T *channel;
|
||||
HANDLE ifd[2];
|
||||
HANDLE ofd[2];
|
||||
HANDLE efd[2];
|
||||
SECURITY_ATTRIBUTES saAttr;
|
||||
|
||||
ifd[0] = INVALID_HANDLE_VALUE;
|
||||
ifd[1] = INVALID_HANDLE_VALUE;
|
||||
ofd[0] = INVALID_HANDLE_VALUE;
|
||||
ofd[1] = INVALID_HANDLE_VALUE;
|
||||
efd[0] = INVALID_HANDLE_VALUE;
|
||||
efd[1] = INVALID_HANDLE_VALUE;
|
||||
|
||||
channel = add_channel();
|
||||
if (channel == NULL)
|
||||
return;
|
||||
# endif
|
||||
|
||||
jo = CreateJobObject(NULL, NULL);
|
||||
if (jo == NULL)
|
||||
{
|
||||
job->jv_status = JOB_FAILED;
|
||||
goto failed;
|
||||
}
|
||||
|
||||
ZeroMemory(&pi, sizeof(pi));
|
||||
ZeroMemory(&si, sizeof(si));
|
||||
si.cb = sizeof(si);
|
||||
si.dwFlags |= STARTF_USESHOWWINDOW;
|
||||
si.wShowWindow = SW_HIDE;
|
||||
|
||||
# ifdef FEAT_CHANNEL
|
||||
saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
saAttr.bInheritHandle = TRUE;
|
||||
saAttr.lpSecurityDescriptor = NULL;
|
||||
if (!CreatePipe(&ifd[0], &ifd[1], &saAttr, 0)
|
||||
|| !pSetHandleInformation(ifd[1], HANDLE_FLAG_INHERIT, 0)
|
||||
|| !CreatePipe(&ofd[0], &ofd[1], &saAttr, 0)
|
||||
|| !pSetHandleInformation(ofd[0], HANDLE_FLAG_INHERIT, 0)
|
||||
|| !CreatePipe(&efd[0], &efd[1], &saAttr, 0)
|
||||
|| !pSetHandleInformation(efd[0], HANDLE_FLAG_INHERIT, 0))
|
||||
goto failed;
|
||||
si.dwFlags |= STARTF_USESTDHANDLES;
|
||||
si.hStdInput = ifd[0];
|
||||
si.hStdOutput = ofd[1];
|
||||
si.hStdError = efd[1];
|
||||
# endif
|
||||
|
||||
if (!vim_create_process(cmd, TRUE,
|
||||
CREATE_SUSPENDED |
|
||||
CREATE_DEFAULT_ERROR_MODE |
|
||||
CREATE_NEW_PROCESS_GROUP |
|
||||
CREATE_NEW_CONSOLE,
|
||||
&si, &pi))
|
||||
{
|
||||
CloseHandle(jo);
|
||||
job->jv_status = JOB_FAILED;
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (!AssignProcessToJobObject(jo, pi.hProcess))
|
||||
{
|
||||
/* if failing, switch the way to terminate
|
||||
* process with TerminateProcess. */
|
||||
CloseHandle(jo);
|
||||
jo = NULL;
|
||||
}
|
||||
ResumeThread(pi.hThread);
|
||||
CloseHandle(job->jv_proc_info.hThread);
|
||||
job->jv_proc_info = pi;
|
||||
job->jv_job_object = jo;
|
||||
job->jv_status = JOB_STARTED;
|
||||
|
||||
# ifdef FEAT_CHANNEL
|
||||
CloseHandle(ifd[0]);
|
||||
CloseHandle(ofd[1]);
|
||||
CloseHandle(efd[1]);
|
||||
|
||||
job->jv_channel = channel;
|
||||
channel_set_pipes(channel, (sock_T)ifd[1], (sock_T)ofd[0], (sock_T)efd[0]);
|
||||
channel_set_job(channel, job);
|
||||
channel_set_options(channel, options);
|
||||
|
||||
# ifdef FEAT_GUI
|
||||
channel_gui_register(channel);
|
||||
# endif
|
||||
# endif
|
||||
return;
|
||||
|
||||
failed:
|
||||
# ifdef FEAT_CHANNEL
|
||||
CloseHandle(ifd[0]);
|
||||
CloseHandle(ofd[0]);
|
||||
CloseHandle(efd[0]);
|
||||
CloseHandle(ifd[1]);
|
||||
CloseHandle(ofd[1]);
|
||||
CloseHandle(efd[1]);
|
||||
channel_free(channel);
|
||||
# else
|
||||
; /* make compiler happy */
|
||||
# endif
|
||||
}
|
||||
|
||||
char *
|
||||
mch_job_status(job_T *job)
|
||||
{
|
||||
DWORD dwExitCode = 0;
|
||||
|
||||
if (!GetExitCodeProcess(job->jv_proc_info.hProcess, &dwExitCode)
|
||||
|| dwExitCode != STILL_ACTIVE)
|
||||
{
|
||||
job->jv_status = JOB_ENDED;
|
||||
return "dead";
|
||||
}
|
||||
return "run";
|
||||
}
|
||||
|
||||
int
|
||||
mch_stop_job(job_T *job, char_u *how)
|
||||
{
|
||||
int ret = 0;
|
||||
int ctrl_c = STRCMP(how, "int") == 0;
|
||||
|
||||
if (STRCMP(how, "kill") == 0)
|
||||
{
|
||||
if (job->jv_job_object != NULL)
|
||||
return TerminateJobObject(job->jv_job_object, 0) ? OK : FAIL;
|
||||
else
|
||||
return TerminateProcess(job->jv_proc_info.hProcess, 0) ? OK : FAIL;
|
||||
}
|
||||
|
||||
if (!AttachConsole(job->jv_proc_info.dwProcessId))
|
||||
return FAIL;
|
||||
ret = GenerateConsoleCtrlEvent(
|
||||
ctrl_c ? CTRL_C_EVENT : CTRL_BREAK_EVENT,
|
||||
job->jv_proc_info.dwProcessId)
|
||||
? OK : FAIL;
|
||||
FreeConsole();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear the data related to "job".
|
||||
*/
|
||||
void
|
||||
mch_clear_job(job_T *job)
|
||||
{
|
||||
if (job->jv_status != JOB_FAILED)
|
||||
{
|
||||
if (job->jv_job_object != NULL)
|
||||
CloseHandle(job->jv_job_object);
|
||||
CloseHandle(job->jv_proc_info.hProcess);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FEAT_GUI_W32
|
||||
|
||||
@@ -5584,7 +5727,7 @@ mch_write(
|
||||
{
|
||||
/* optimization: use one single write_chars for runs of text,
|
||||
* rather than once per character It ain't curses, but it helps. */
|
||||
DWORD prefix = (DWORD)strcspn(s, "\n\r\b\a\033");
|
||||
DWORD prefix = (DWORD)strcspn((char *)s, "\n\r\b\a\033");
|
||||
|
||||
if (p_wd)
|
||||
{
|
||||
@@ -5922,7 +6065,7 @@ mch_remove(char_u *name)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return DeleteFile(name) ? 0 : -1;
|
||||
return DeleteFile((LPCSTR)name) ? 0 : -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -6207,10 +6350,10 @@ mch_access(char *n, int p)
|
||||
WCHAR *wn = NULL;
|
||||
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
wn = enc_to_utf16(n, NULL);
|
||||
wn = enc_to_utf16((char_u *)n, NULL);
|
||||
#endif
|
||||
|
||||
if (mch_isdir(n))
|
||||
if (mch_isdir((char_u *)n))
|
||||
{
|
||||
char TempName[_MAX_PATH + 16] = "";
|
||||
#ifdef FEAT_MBYTE
|
||||
@@ -6253,7 +6396,7 @@ mch_access(char *n, int p)
|
||||
char *pch;
|
||||
WIN32_FIND_DATA d;
|
||||
|
||||
vim_strncpy(TempName, n, _MAX_PATH);
|
||||
vim_strncpy((char_u *)TempName, (char_u *)n, _MAX_PATH);
|
||||
pch = TempName + STRLEN(TempName) - 1;
|
||||
if (*pch != '\\' && *pch != '/')
|
||||
*++pch = '\\';
|
||||
@@ -6345,7 +6488,7 @@ mch_open(char *name, int flags, int mode)
|
||||
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
wn = enc_to_utf16(name, NULL);
|
||||
wn = enc_to_utf16((char_u *)name, NULL);
|
||||
if (wn != NULL)
|
||||
{
|
||||
f = _wopen(wn, flags, mode);
|
||||
@@ -6397,8 +6540,8 @@ mch_fopen(char *name, char *mode)
|
||||
else if (newMode == 'b')
|
||||
_set_fmode(_O_BINARY);
|
||||
# endif
|
||||
wn = enc_to_utf16(name, NULL);
|
||||
wm = enc_to_utf16(mode, NULL);
|
||||
wn = enc_to_utf16((char_u *)name, NULL);
|
||||
wm = enc_to_utf16((char_u *)mode, NULL);
|
||||
if (wn != NULL && wm != NULL)
|
||||
f = _wfopen(wn, wm);
|
||||
vim_free(wn);
|
||||
|
||||
+99
-33
@@ -23,8 +23,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Vim(Esperanto)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-07-30 17:54+0200\n"
|
||||
"PO-Revision-Date: 2015-07-30 18:00+0200\n"
|
||||
"POT-Creation-Date: 2016-02-13 23:42+0100\n"
|
||||
"PO-Revision-Date: 2016-02-13 23:45+0100\n"
|
||||
"Last-Translator: Dominique PELLÉ <dominique.pelle@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: eo\n"
|
||||
@@ -215,6 +215,18 @@ msgstr "Emfazaj simbolaĵoj de %s:"
|
||||
msgid " line=%ld id=%d name=%s"
|
||||
msgstr " linio=%ld id=%d nomo=%s"
|
||||
|
||||
msgid "E897: All channels are in use"
|
||||
msgstr "E897: Ĉiuj kanaloj estas uzataj"
|
||||
|
||||
msgid "E902: Cannot connect to port"
|
||||
msgstr "E902: Ne eblas konekti al pordo"
|
||||
|
||||
msgid "E899: Cannot connect to port after retry2"
|
||||
msgstr "E899: Ne eblas konekti al pordo post 2 reprovoj"
|
||||
|
||||
msgid "E896: read from channel"
|
||||
msgstr "E896: lego el kanalo"
|
||||
|
||||
msgid "E821: File is encrypted with unknown method"
|
||||
msgstr "E821: Dosiero estas ĉifrata per nekonata metodo"
|
||||
|
||||
@@ -412,9 +424,6 @@ msgstr "E686: Argumento de %s devas esti Listo"
|
||||
msgid "E712: Argument of %s must be a List or Dictionary"
|
||||
msgstr "E712: Argumento de %s devas esti Listo aŭ Vortaro"
|
||||
|
||||
msgid "E713: Cannot use empty key for Dictionary"
|
||||
msgstr "E713: Ne eblas uzi malplenan ŝlosilon de Vortaro"
|
||||
|
||||
msgid "E714: List required"
|
||||
msgstr "E714: Listo bezonata"
|
||||
|
||||
@@ -529,6 +538,9 @@ msgstr "E110: Mankas ')'"
|
||||
msgid "E695: Cannot index a Funcref"
|
||||
msgstr "E695: Ne eblas indeksi Funcref"
|
||||
|
||||
msgid "E909: Cannot index a special variable"
|
||||
msgstr "E909: Ne eblas indeksi specialan variablon"
|
||||
|
||||
#, c-format
|
||||
msgid "E112: Option name missing: %s"
|
||||
msgstr "E112: Mankas nomo de opcio: %s"
|
||||
@@ -554,7 +566,7 @@ msgid "E697: Missing end of List ']': %s"
|
||||
msgstr "E697: Mankas fino de Listo ']': %s"
|
||||
|
||||
msgid "Not enough memory to set references, garbage collection aborted!"
|
||||
msgstr "Ne sufiĉa memory por valorigi referencojn, senrubigado ĉesigita!"
|
||||
msgstr "Ne sufiĉa memoro por valorigi referencojn, senrubigado ĉesigita!"
|
||||
|
||||
#, c-format
|
||||
msgid "E720: Missing colon in Dictionary: %s"
|
||||
@@ -608,6 +620,15 @@ msgstr "argumento de add()"
|
||||
msgid "E699: Too many arguments"
|
||||
msgstr "E699: Tro da argumentoj"
|
||||
|
||||
msgid "E906: not an open channel"
|
||||
msgstr "E906: ne estas malfermita kanalo"
|
||||
|
||||
msgid "E999: Invalid callback argument"
|
||||
msgstr "E999: Nevalida argumento de reagfunctio"
|
||||
|
||||
msgid "E912: cannot use ch_sendexpr() with a raw channel"
|
||||
msgstr "E912: ne eblas uzi ch_sendexpr() kun kruda kanalo"
|
||||
|
||||
msgid "E785: complete() can only be used in Insert mode"
|
||||
msgstr "E785: complete() uzeblas nur en Enmeta reĝimo"
|
||||
|
||||
@@ -720,6 +741,33 @@ msgstr "E745: Uzo de Listo kiel Nombro"
|
||||
msgid "E728: Using a Dictionary as a Number"
|
||||
msgstr "E728: Uzo de Vortaro kiel Nombro"
|
||||
|
||||
msgid "E910: Using a Job as a Number"
|
||||
msgstr "E910: Uzo de Tasko kiel Nombro"
|
||||
|
||||
msgid "E913: Using a Channel as a Number"
|
||||
msgstr "E913: Uzo de Kanalo kiel Nombro"
|
||||
|
||||
msgid "E891: Using a Funcref as a Float"
|
||||
msgstr "E891: Uzo de Funcref kiel Glitpunktnombro"
|
||||
|
||||
msgid "E892: Using a String as a Float"
|
||||
msgstr "E892: Uzo de Ĉeno kiel Glitpunktnombro"
|
||||
|
||||
msgid "E893: Using a List as a Float"
|
||||
msgstr "E893: Uzo de Listo kiel Glitpunktnombro"
|
||||
|
||||
msgid "E894: Using a Dictionary as a Float"
|
||||
msgstr "E894: Uzo de Vortaro kiel Glitpunktnombro"
|
||||
|
||||
msgid "E907: Using a special value as a Float"
|
||||
msgstr "E907: Uzo de speciala valoro kiel Glitpunktnombro"
|
||||
|
||||
msgid "E911: Using a Job as a Float"
|
||||
msgstr "E911: Uzo de Tasko kiel Glitpunktnombro"
|
||||
|
||||
msgid "E914: Using a Channel as a Float"
|
||||
msgstr "E914: Uzo de Kanalo kiel Glitpunktnombro"
|
||||
|
||||
msgid "E729: using Funcref as a String"
|
||||
msgstr "E729: uzo de Funcref kiel Ĉeno"
|
||||
|
||||
@@ -729,6 +777,9 @@ msgstr "E730: uzo de Listo kiel Ĉeno"
|
||||
msgid "E731: using Dictionary as a String"
|
||||
msgstr "E731: uzo de Vortaro kiel Ĉeno"
|
||||
|
||||
msgid "E908: using an invalid value as a String"
|
||||
msgstr "E908: uzo de nevalida valoro kiel Ĉeno"
|
||||
|
||||
#, c-format
|
||||
msgid "E706: Variable type mismatch for: %s"
|
||||
msgstr "E706: Nekongrua datumtipo de variablo: %s"
|
||||
@@ -941,6 +992,13 @@ msgstr "# Valoro de 'encoding' kiam tiu dosiero estis kreita\n"
|
||||
msgid "Illegal starting char"
|
||||
msgstr "Nevalida eka signo"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
"# Bar lines, copied verbatim:\n"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"# Linioj komencantaj per |, kopiitaj sen ŝanĝo:\n"
|
||||
|
||||
msgid "Save As"
|
||||
msgstr "Konservi kiel"
|
||||
|
||||
@@ -1148,6 +1206,13 @@ msgstr "linio %ld: %s"
|
||||
msgid "cmd: %s"
|
||||
msgstr "kmd: %s"
|
||||
|
||||
msgid "frame is zero"
|
||||
msgstr "kadro estas nul"
|
||||
|
||||
#, c-format
|
||||
msgid "frame at highest level: %d"
|
||||
msgstr "kadro je la plej alta nivelo: %d"
|
||||
|
||||
#, c-format
|
||||
msgid "Breakpoint in \"%s%s\" line %ld"
|
||||
msgstr "Kontrolpunkto en \"%s%s\" linio %ld"
|
||||
@@ -2624,6 +2689,13 @@ msgstr ""
|
||||
"E815: Bedaŭrinde, tiu komando estas malŝaltita, ne eblis ŝargi la "
|
||||
"bibliotekojn."
|
||||
|
||||
msgid ""
|
||||
"E895: Sorry, this command is disabled, the MzScheme's racket/base module "
|
||||
"could not be loaded."
|
||||
msgstr ""
|
||||
"E895: Bedaŭrinde, tiu komando estas malŝaltita, ne eblis ŝargi la modulon de "
|
||||
"MzScheme racket/base."
|
||||
|
||||
msgid "invalid expression"
|
||||
msgstr "nevalida esprimo"
|
||||
|
||||
@@ -3801,15 +3873,12 @@ msgid ""
|
||||
"\n"
|
||||
"(1) Another program may be editing the same file. If this is the case,\n"
|
||||
" be careful not to end up with two different instances of the same\n"
|
||||
" file when making changes."
|
||||
" file when making changes. Quit, or continue with caution.\n"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"(1) Alia programo eble redaktas la saman dosieron.\n"
|
||||
" Se jes, estu singarda por ne havi du malsamajn\n"
|
||||
" aperojn de la sama dosiero, kiam vi faros ŝanĝojn."
|
||||
|
||||
msgid " Quit, or continue with caution.\n"
|
||||
msgstr " Eliru, aŭ daŭrigu singarde.\n"
|
||||
"(1) Alia programo eble redaktas la saman dosieron. Se jes, estu singarda\n"
|
||||
" por ne havi du malsamajn aperojn de la sama dosiero, kiam vi faros\n"
|
||||
" ŝanĝojn. Eliru aŭ daŭrigu singarde.\n"
|
||||
|
||||
msgid "(2) An edit session for this file crashed.\n"
|
||||
msgstr "(2) Redakta seanco de tiu dosiero kolapsis.\n"
|
||||
@@ -4116,20 +4185,11 @@ msgstr "E346: Ne plu trovis dosierujon \"%s\" en cdpath"
|
||||
msgid "E347: No more file \"%s\" found in path"
|
||||
msgstr "E347: Ne plu trovis dosieron \"%s\" en serĉvojo"
|
||||
|
||||
msgid "Cannot connect to Netbeans #2"
|
||||
msgstr "Ne eblas konekti al Netbeans n-ro 2"
|
||||
|
||||
msgid "Cannot connect to Netbeans"
|
||||
msgstr "Ne eblas konekti al Netbeans"
|
||||
|
||||
#, c-format
|
||||
msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\""
|
||||
msgstr ""
|
||||
"E668: Nevalida permeso de dosiero de informo de konekto NetBeans: \"%s\""
|
||||
|
||||
msgid "read from Netbeans socket"
|
||||
msgstr "lego el kontaktoskatolo de Netbeans"
|
||||
|
||||
#, c-format
|
||||
msgid "E658: NetBeans connection lost for buffer %ld"
|
||||
msgstr "E658: Konekto de NetBeans perdita por bufro %ld"
|
||||
@@ -4584,18 +4644,14 @@ msgstr ""
|
||||
"\n"
|
||||
"Ne povis ŝalti kuntekston de sekureco por "
|
||||
|
||||
msgid "Could not set security context "
|
||||
msgstr "Ne povis akiri kuntekston de sekureco "
|
||||
#, c-format
|
||||
msgid "Could not set security context %s for %s"
|
||||
msgstr "Ne povis ŝalti kuntekston de sekureco %s por %s"
|
||||
|
||||
msgid " for "
|
||||
msgstr " por "
|
||||
|
||||
#. no enough size OR unexpected error
|
||||
msgid "Could not get security context "
|
||||
msgstr "Ne povis akiri kuntekston de sekureco "
|
||||
|
||||
msgid ". Removing it!\n"
|
||||
msgstr ". Ĝi estas foriganta!\n"
|
||||
#, c-format
|
||||
msgid "Could not get security context %s for %s. Removing it!"
|
||||
msgstr ""
|
||||
"Ne povis akiri kuntekston de sekureco %s por %s. Gi nun estas forigata!"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
@@ -5458,6 +5514,9 @@ msgstr "Neniu sintaksa elemento difinita por tiu bufro"
|
||||
msgid "E390: Illegal argument: %s"
|
||||
msgstr "E390: Nevalida argumento: %s"
|
||||
|
||||
msgid "syntax iskeyword "
|
||||
msgstr "sintakso iskeyword "
|
||||
|
||||
#, c-format
|
||||
msgid "E391: No such syntax cluster: %s"
|
||||
msgstr "E391: Nenia sintaksa fasko: %s"
|
||||
@@ -5534,6 +5593,10 @@ msgstr "E847: Tro da sintaksaj inkluzivoj"
|
||||
msgid "E789: Missing ']': %s"
|
||||
msgstr "E789: Mankas ']': %s"
|
||||
|
||||
#, c-format
|
||||
msgid "E890: trailing char after ']': %s]%s"
|
||||
msgstr "E890: vosta signo post ']': %s]%s"
|
||||
|
||||
#, c-format
|
||||
msgid "E398: Missing '=': %s"
|
||||
msgstr "E398: Mankas '=': %s"
|
||||
@@ -6575,6 +6638,9 @@ msgstr "E46: Ne eblas ŝanĝi nurlegeblan variablon \"%s\""
|
||||
msgid "E794: Cannot set variable in the sandbox: \"%s\""
|
||||
msgstr "E794: Ne eblas agordi variablon en la sabloludejo: \"%s\""
|
||||
|
||||
msgid "E713: Cannot use empty key for Dictionary"
|
||||
msgstr "E713: Ne eblas uzi malplenan ŝlosilon de Vortaro"
|
||||
|
||||
msgid "E47: Error while reading errorfile"
|
||||
msgstr "E47: Eraro dum legado de erardosiero"
|
||||
|
||||
|
||||
+127
-60
@@ -13,13 +13,13 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vim 7.4\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-08-11 20:58+0200\n"
|
||||
"PO-Revision-Date: 2015-08-11 22:02+0200\n"
|
||||
"Last-Translator: Vlad Sandrini <vlad.gently@gmail.com>\n"
|
||||
"Language-Team: Italian Antonio Colombo <azc100@gmail."
|
||||
"com> Vlad Sandrini <vlad.gently@gmail."
|
||||
"com> Luciano Montanaro <mikelima@cirulla.net>\n"
|
||||
"Language: \n"
|
||||
"POT-Creation-Date: 2016-02-11 12:10+0100\n"
|
||||
"PO-Revision-Date: 2016-02-11 14:42+0200\n"
|
||||
"Last-Translator: Antonio Colombo <azc100@gmail.com>\n"
|
||||
"Language-Team: Antonio Colombo <azc100@gmail.com>"
|
||||
" Vlad Sandrini <vlad.gently@gmail.com"
|
||||
" Luciano Montanaro <mikelima@cirulla.net>\n"
|
||||
"Language: Italian\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO_8859-1\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
@@ -204,6 +204,18 @@ msgstr "Segni per %s:"
|
||||
msgid " line=%ld id=%d name=%s"
|
||||
msgstr " riga=%ld id=%d, nome=%s"
|
||||
|
||||
msgid "E897: All channels are in use"
|
||||
msgstr "E897: Tutti i canali sono in uso"
|
||||
|
||||
msgid "E902: Cannot connect to port"
|
||||
msgstr "E902: Non posso commettermi alla porta"
|
||||
|
||||
msgid "E899: Cannot connect to port after retry2"
|
||||
msgstr "E899: Non posso commettermi alla porta dopo retry2"
|
||||
|
||||
msgid "E896: read from channel"
|
||||
msgstr "E896: lettura dal canale"
|
||||
|
||||
msgid "E821: File is encrypted with unknown method"
|
||||
msgstr "E821: File cifrato con metodo sconosciuto"
|
||||
|
||||
@@ -400,9 +412,6 @@ msgstr "E686: L'argomento di %s deve essere una Lista"
|
||||
msgid "E712: Argument of %s must be a List or Dictionary"
|
||||
msgstr "E712: L'argomento di %s deve essere una Lista o un Dizionario"
|
||||
|
||||
msgid "E713: Cannot use empty key for Dictionary"
|
||||
msgstr "E713: Non posso usare una chiave nulla per il Dizionario"
|
||||
|
||||
msgid "E714: List required"
|
||||
msgstr "E714: È necessaria una Lista"
|
||||
|
||||
@@ -444,7 +453,7 @@ msgstr "E461: Nome di variabile non ammesso: %s"
|
||||
|
||||
# nuovo
|
||||
msgid "E806: using Float as a String"
|
||||
msgstr "E806: uso di un numero con virgola come stringa"
|
||||
msgstr "E806: uso di un Numero-a-virgola-mobile come Stringa"
|
||||
|
||||
msgid "E687: Less targets than List items"
|
||||
msgstr "E687: Destinazioni più numerose degli elementi di Lista"
|
||||
@@ -510,7 +519,7 @@ msgid "E694: Invalid operation for Funcrefs"
|
||||
msgstr "E694: Operazione non valida per Funcref"
|
||||
|
||||
msgid "E804: Cannot use '%' with Float"
|
||||
msgstr "E804: Non si può usare '%' con un numero con virgola"
|
||||
msgstr "E804: Non si può usare '%' con un Numero-a-virgola-mobile"
|
||||
|
||||
msgid "E110: Missing ')'"
|
||||
msgstr "E110: Manca ')'"
|
||||
@@ -518,6 +527,9 @@ msgstr "E110: Manca ')'"
|
||||
msgid "E695: Cannot index a Funcref"
|
||||
msgstr "E695: Non posso indicizzare un Funcref"
|
||||
|
||||
msgid "E909: Cannot index a special variable"
|
||||
msgstr "E909: Non posso indicizzare una variabile speciale"
|
||||
|
||||
#, c-format
|
||||
msgid "E112: Option name missing: %s"
|
||||
msgstr "E112: Nome Opzione mancante: %s"
|
||||
@@ -589,7 +601,7 @@ msgid "E725: Calling dict function without Dictionary: %s"
|
||||
msgstr "E725: Chiamata di funzione dict in assenza di Dizionario: %s"
|
||||
|
||||
msgid "E808: Number or Float required"
|
||||
msgstr "E808: Ci vuole un numero intero o con virgola"
|
||||
msgstr "E808: Ci vuole un Numero o un Numero-a-virgola-mobile"
|
||||
|
||||
msgid "add() argument"
|
||||
msgstr "argomento di add()"
|
||||
@@ -597,6 +609,15 @@ msgstr "argomento di add()"
|
||||
msgid "E699: Too many arguments"
|
||||
msgstr "E699: Troppi argomenti"
|
||||
|
||||
msgid "E906: not an open channel"
|
||||
msgstr "E906: canale non aperto"
|
||||
|
||||
msgid "E999: Invalid callback argument"
|
||||
msgstr "E999: Argomento callback non valido"
|
||||
|
||||
msgid "E912: cannot use ch_sendexpr() with a raw channel"
|
||||
msgstr "E912: non posso usare ch_sendexpr() con un canale grezzo"
|
||||
|
||||
msgid "E785: complete() can only be used in Insert mode"
|
||||
msgstr "E785: complete() può essere usata solo in modalità inserimento"
|
||||
|
||||
@@ -698,7 +719,7 @@ msgid "E677: Error writing temp file"
|
||||
msgstr "E677: Errore in scrittura su file temporaneo"
|
||||
|
||||
msgid "E805: Using a Float as a Number"
|
||||
msgstr "E805: Uso di un numero con virgola come intero"
|
||||
msgstr "E805: Uso di un Numero-a-virgola-mobile come Numero"
|
||||
|
||||
msgid "E703: Using a Funcref as a Number"
|
||||
msgstr "E703: Uso di Funcref come Numero"
|
||||
@@ -709,6 +730,27 @@ msgstr "E745: Uso di Lista come Numero"
|
||||
msgid "E728: Using a Dictionary as a Number"
|
||||
msgstr "E728: Uso di Dizionario come Numero"
|
||||
|
||||
msgid "E910: Using a Job as a Number"
|
||||
msgstr "E910: Uso di Job come Numero"
|
||||
|
||||
msgid "E891: Using a Funcref as a Float"
|
||||
msgstr "E891: Uso di Funcref come Numero-a-virgola-mobile"
|
||||
|
||||
msgid "E892: Using a String as a Float"
|
||||
msgstr "E892: Uso di Stringa come Numero-a-virgola-mobile"
|
||||
|
||||
msgid "E893: Using a List as a Float"
|
||||
msgstr "E893: Uso di Lista come Numero-a-virgola-mobile"
|
||||
|
||||
msgid "E894: Using a Dictionary as a Float"
|
||||
msgstr "E894: Uso di Dizionario come Numero-a-virgola-mobile"
|
||||
|
||||
msgid "E907: Using a special value as a Float"
|
||||
msgstr "E907: Uso di valore speciale come Numero-a-virgola-mobile"
|
||||
|
||||
msgid "E911: Using a Job as a Float"
|
||||
msgstr "E911: Uso di Job come Numero-a-virgola-mobile"
|
||||
|
||||
msgid "E729: using Funcref as a String"
|
||||
msgstr "E729: uso di Funcref come Stringa"
|
||||
|
||||
@@ -718,6 +760,10 @@ msgstr "E730: uso di Lista come Stringa"
|
||||
msgid "E731: using Dictionary as a String"
|
||||
msgstr "E731: uso di Dizionario come Stringa"
|
||||
|
||||
# nuovo
|
||||
msgid "E908: using an invalid value as a String"
|
||||
msgstr "E908: uso di un valore non valido come Stringa"
|
||||
|
||||
#, c-format
|
||||
msgid "E706: Variable type mismatch for: %s"
|
||||
msgstr "E706: Tipo di variabile non corrispondente per: %s"
|
||||
@@ -786,9 +832,11 @@ msgstr "E746: Il nome funzione non corrisponde al nome file dello script: %s"
|
||||
msgid "E129: Function name required"
|
||||
msgstr "E129: Nome funzione necessario"
|
||||
|
||||
#, c-format
|
||||
msgid "E128: Function name must start with a capital or \"s:\": %s"
|
||||
msgstr "E128: Il nome funzione deve iniziare con maiuscola o \"s:\": %s"
|
||||
msgstr "E128: Il nome funzione deve iniziare con maiuscola o \"s:\": %s"
|
||||
|
||||
#, c-format
|
||||
msgid "E884: Function name cannot contain a colon: %s"
|
||||
msgstr "E884: Il nome della funzione non può contenere un due punti: %s"
|
||||
|
||||
@@ -908,6 +956,7 @@ msgstr "E138: Non riesco a scrivere il file viminfo %s!"
|
||||
msgid "Writing viminfo file \"%s\""
|
||||
msgstr "Scrivo file viminfo \"%s\""
|
||||
|
||||
#, c-format
|
||||
msgid "E886: Can't rename viminfo file to %s!"
|
||||
msgstr "E886: Non riesco a rinominare il file viminfo a %s!"
|
||||
|
||||
@@ -929,6 +978,13 @@ msgstr "# Valore di 'encoding' al momento della scrittura di questo file\n"
|
||||
msgid "Illegal starting char"
|
||||
msgstr "Carattere iniziale non ammesso"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
"# Bar lines, copied verbatim:\n"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"# Righe che iniziano con '|', semplicemente copiate:\n"
|
||||
|
||||
msgid "Save As"
|
||||
msgstr "Salva con Nome"
|
||||
|
||||
@@ -1135,6 +1191,13 @@ msgstr "riga %ld: %s"
|
||||
msgid "cmd: %s"
|
||||
msgstr "com: %s"
|
||||
|
||||
msgid "frame is zero"
|
||||
msgstr "al livello zero"
|
||||
|
||||
#, c-format
|
||||
msgid "frame at highest level: %d"
|
||||
msgstr "al livello più alto: %d"
|
||||
|
||||
#, c-format
|
||||
msgid "Breakpoint in \"%s%s\" line %ld"
|
||||
msgstr "Pausa in \"%s%s\" riga %ld"
|
||||
@@ -1166,8 +1229,7 @@ msgstr "E162: Buffer \"%s\" non salvato dopo modifica"
|
||||
|
||||
msgid "Warning: Entered other buffer unexpectedly (check autocommands)"
|
||||
msgstr ""
|
||||
"Avviso: Entrato in altro buffer inaspettatamente (controllare "
|
||||
"autocomandi)"
|
||||
"Avviso: Entrato in altro buffer inaspettatamente (controllare autocomandi)"
|
||||
|
||||
msgid "E163: There is only one file to edit"
|
||||
msgstr "E163: C'è un solo file da elaborare"
|
||||
@@ -1356,6 +1418,7 @@ msgstr "E841: Nome riservato, non usabile in un comando definito dall'utente"
|
||||
msgid "E184: No such user-defined command: %s"
|
||||
msgstr "E184: Comando definito dall'utente %s inesistente"
|
||||
|
||||
#, c-format
|
||||
msgid "E180: Invalid address type value: %s"
|
||||
msgstr "E180: Tipo di indirizzo non valido: %s"
|
||||
|
||||
@@ -1811,8 +1874,8 @@ msgid ""
|
||||
"E513: write error, conversion failed in line %ld (make 'fenc' empty to "
|
||||
"override)"
|
||||
msgstr ""
|
||||
"E513: errore in scrittura, conversione fallita alla riga %ld (rendere "
|
||||
"'fenc' nullo per eseguire comunque)"
|
||||
"E513: errore in scrittura, conversione fallita alla riga %ld (rendere 'fenc' "
|
||||
"nullo per eseguire comunque)"
|
||||
|
||||
msgid "E514: write error (file system full?)"
|
||||
msgstr "E514: errore in scrittura ('File System' pieno?)"
|
||||
@@ -1868,16 +1931,16 @@ msgid "[dos format]"
|
||||
msgstr "[in formato DOS]"
|
||||
|
||||
msgid "[mac]"
|
||||
msgstr "[MAC]"
|
||||
msgstr "[Mac]"
|
||||
|
||||
msgid "[mac format]"
|
||||
msgstr "[in formato MAC]"
|
||||
msgstr "[in formato Mac]"
|
||||
|
||||
msgid "[unix]"
|
||||
msgstr "[UNIX]"
|
||||
msgstr "[Unix]"
|
||||
|
||||
msgid "[unix format]"
|
||||
msgstr "[in formato UNIX]"
|
||||
msgstr "[in formato Unix]"
|
||||
|
||||
msgid "1 line, "
|
||||
msgstr "1 riga, "
|
||||
@@ -2621,6 +2684,13 @@ msgstr ""
|
||||
"E815: Spiacente, comando non disponibile, non riesco a caricare librerie "
|
||||
"programmi MzScheme."
|
||||
|
||||
msgid ""
|
||||
"E895: Sorry, this command is disabled, the MzScheme's racket/base module "
|
||||
"could not be loaded."
|
||||
msgstr ""
|
||||
"E815: Spiacente, comando non disponibile, non riesco a caricare modulo "
|
||||
"racket/base di MzScheme."
|
||||
|
||||
msgid "invalid expression"
|
||||
msgstr "espressione non valida"
|
||||
|
||||
@@ -3788,15 +3858,12 @@ msgid ""
|
||||
"\n"
|
||||
"(1) Another program may be editing the same file. If this is the case,\n"
|
||||
" be careful not to end up with two different instances of the same\n"
|
||||
" file when making changes."
|
||||
" file when making changes. Quit, or continue with caution.\n"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"(1) Un altro programma può essere in edit sullo stesso file.\n"
|
||||
" Se è così, attenzione a non trovarti con due versioni\n"
|
||||
" differenti dello stesso file a cui vengono apportate modifiche."
|
||||
|
||||
msgid " Quit, or continue with caution.\n"
|
||||
msgstr " Esci, o continua con prudenza.\n"
|
||||
"(1) Un altro programma può essere in edit sullo stesso file. Se è così,\n"
|
||||
" attenzione a non finire con due sessioni differenti che modificano lo\n"
|
||||
" stesso file. Uscire da Vim, o continuare con cautela.\n"
|
||||
|
||||
msgid "(2) An edit session for this file crashed.\n"
|
||||
msgstr "(2) Una sessione di edit per questo file è finita male.\n"
|
||||
@@ -3989,7 +4056,7 @@ msgid "E766: Insufficient arguments for printf()"
|
||||
msgstr "E766: Argomenti non sufficienti per printf()"
|
||||
|
||||
msgid "E807: Expected Float argument for printf()"
|
||||
msgstr "E807: Numero con virgola atteso come argomento per printf()"
|
||||
msgstr "E807: Numero-a-virgola-mobile atteso come argomento per printf()"
|
||||
|
||||
msgid "E767: Too many arguments to printf()"
|
||||
msgstr "E767: Troppi argomenti per printf()"
|
||||
@@ -4100,20 +4167,11 @@ msgstr "E346: Nessun altra directory \"%s\" trovata nel 'cdpath'"
|
||||
msgid "E347: No more file \"%s\" found in path"
|
||||
msgstr "E347: Nessun altro file \"%s\" trovato nel percorso"
|
||||
|
||||
msgid "Cannot connect to Netbeans #2"
|
||||
msgstr "Non posso connettermi a Netbeans #2"
|
||||
|
||||
msgid "Cannot connect to Netbeans"
|
||||
msgstr "Non posso connettermi a Netbeans"
|
||||
|
||||
#, c-format
|
||||
msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\""
|
||||
msgstr ""
|
||||
"E668: Modalità errata di accesso a file info connessione NetBeans: \"%s\""
|
||||
|
||||
msgid "read from Netbeans socket"
|
||||
msgstr "lettura da socket Netbeans"
|
||||
|
||||
#, c-format
|
||||
msgid "E658: NetBeans connection lost for buffer %ld"
|
||||
msgstr "E658: Connessione NetBeans persa per il buffer %ld"
|
||||
@@ -4246,7 +4304,8 @@ msgstr "E574: Tipo di registro sconosciuto: %d"
|
||||
msgid ""
|
||||
"E883: search pattern and expression register may not contain two or more "
|
||||
"lines"
|
||||
msgstr "E883: espressione di ricerca e registro dell'espressione non possono "
|
||||
msgstr ""
|
||||
"E883: espressione di ricerca e registro dell'espressione non possono "
|
||||
"contenere due o più righe"
|
||||
|
||||
#, c-format
|
||||
@@ -4567,18 +4626,11 @@ msgstr ""
|
||||
"\n"
|
||||
"Non posso impostare il contesto di sicurezza per "
|
||||
|
||||
msgid "Could not set security context "
|
||||
msgstr "Non riesco a impostare il contesto di sicurezza "
|
||||
msgid "Could not set security context %s for %s"
|
||||
msgstr "Non posso impostare il contesto di sicurezza %s per %s"
|
||||
|
||||
msgid " for "
|
||||
msgstr " per "
|
||||
|
||||
#. no enough size OR unexpected error
|
||||
msgid "Could not get security context "
|
||||
msgstr "Non riesco a ottenere il contesto di sicurezza "
|
||||
|
||||
msgid ". Removing it!\n"
|
||||
msgstr ". Lo rimuovo!\n"
|
||||
msgid "Could not get security context %s for %s. Removing it!"
|
||||
msgstr "Non posso ottenere il contesto di sicurezza %s per %s. Lo rimuovo!"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
@@ -4757,6 +4809,7 @@ msgstr "E681: Buffer non caricato"
|
||||
msgid "E777: String or List expected"
|
||||
msgstr "E777: aspettavo Stringa o Lista"
|
||||
|
||||
#, c-format
|
||||
msgid "E369: invalid item in %s%%[]"
|
||||
msgstr "E369: elemento non valido in %s%%[]"
|
||||
|
||||
@@ -4847,6 +4900,7 @@ msgstr "E554: Errore sintattico in %s{...}"
|
||||
msgid "External submatches:\n"
|
||||
msgstr "Sotto-corrispondenze esterne:\n"
|
||||
|
||||
#, c-format
|
||||
msgid "E888: (NFA regexp) cannot repeat %s"
|
||||
msgstr "E888: (NFA regexp) non riesco a ripetere %s"
|
||||
|
||||
@@ -4867,6 +4921,7 @@ msgstr "E865: (NFA) Fine prematura dell'espressione regolare"
|
||||
msgid "E866: (NFA regexp) Misplaced %c"
|
||||
msgstr "E866: (NFA regexp) %c fuori posto"
|
||||
|
||||
#, c-format
|
||||
msgid "E877: (NFA regexp) Invalid character class: %ld"
|
||||
msgstr "E877: (NFA regexp) Classe di caratteri non valida: %ld"
|
||||
|
||||
@@ -5171,8 +5226,7 @@ msgstr "Valore errato per CHECKCOMPOUNDPATTERN in %s riga %d: %s"
|
||||
|
||||
#, c-format
|
||||
msgid "Different combining flag in continued affix block in %s line %d: %s"
|
||||
msgstr ""
|
||||
"Flag combinazione diverso in blocco affissi continuo in %s riga %d: %s"
|
||||
msgstr "Flag combinazione diverso in blocco affissi continuo in %s riga %d: %s"
|
||||
|
||||
#, c-format
|
||||
msgid "Duplicate affix in %s line %d: %s"
|
||||
@@ -5367,9 +5421,11 @@ msgstr "Fatto!"
|
||||
msgid "E765: 'spellfile' does not have %ld entries"
|
||||
msgstr "E765: 'spellfile' non ha %ld elementi"
|
||||
|
||||
#, c-format
|
||||
msgid "Word '%.*s' removed from %s"
|
||||
msgstr "Parola '%.*s' rimossa da %s"
|
||||
|
||||
#, c-format
|
||||
msgid "Word '%.*s' added to %s"
|
||||
msgstr "Parola '%.*s' aggiunta a %s"
|
||||
|
||||
@@ -5432,6 +5488,9 @@ msgstr "Nessun elemento sintattico definito per questo buffer"
|
||||
msgid "E390: Illegal argument: %s"
|
||||
msgstr "E390: Argomento non ammesso: %s"
|
||||
|
||||
msgid "syntax iskeyword "
|
||||
msgstr "syntax iskeyword "
|
||||
|
||||
#, c-format
|
||||
msgid "E391: No such syntax cluster: %s"
|
||||
msgstr "E391: 'cluster' sintattico inesistente: %s"
|
||||
@@ -5508,6 +5567,9 @@ msgstr "E847: Troppe inclusioni di sintassi"
|
||||
msgid "E789: Missing ']': %s"
|
||||
msgstr "E789: Manca ']': %s"
|
||||
|
||||
msgid "E890: trailing char after ']': %s]%s"
|
||||
msgstr "E890: Caratteri in più dopo ']': %s]%s"
|
||||
|
||||
#, c-format
|
||||
msgid "E398: Missing '=': %s"
|
||||
msgstr "E398: Manca '=': %s"
|
||||
@@ -5965,7 +6027,7 @@ msgid ""
|
||||
"MacOS X (unix) version"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Versione MacOS X (unix)"
|
||||
"Versione MacOS X (Unix)"
|
||||
|
||||
msgid ""
|
||||
"\n"
|
||||
@@ -6537,6 +6599,9 @@ msgid "E794: Cannot set variable in the sandbox: \"%s\""
|
||||
msgstr ""
|
||||
"E794: Non posso impostare la variabile read-only in ambiente protetto: \"%s\""
|
||||
|
||||
msgid "E713: Cannot use empty key for Dictionary"
|
||||
msgstr "E713: Non posso usare una chiave nulla per il Dizionario"
|
||||
|
||||
msgid "E47: Error while reading errorfile"
|
||||
msgstr "E47: Errore leggendo il file errori"
|
||||
|
||||
@@ -6655,6 +6720,7 @@ msgstr "il dizionario
|
||||
msgid "list is locked"
|
||||
msgstr "la lista è bloccata"
|
||||
|
||||
#, c-format
|
||||
msgid "failed to add key '%s' to dictionary"
|
||||
msgstr "non non riusciato ad aggiungere la chiave '%s' al dizionario"
|
||||
|
||||
@@ -6754,8 +6820,8 @@ msgstr "il passo scorrendo un intervallo non pu
|
||||
|
||||
#, c-format
|
||||
msgid "attempt to assign sequence of size greater than %d to extended slice"
|
||||
msgstr "tentativo di assegnare una sequenza maggiore di %d a un intervallo "
|
||||
"esteso"
|
||||
msgstr ""
|
||||
"tentativo di assegnare una sequenza maggiore di %d a un intervallo esteso"
|
||||
|
||||
#, c-format
|
||||
msgid "internal error: no vim list item %d"
|
||||
@@ -6767,9 +6833,11 @@ msgstr "errore interno: non ci sono abbastanza elementi per la lista"
|
||||
msgid "internal error: failed to add item to list"
|
||||
msgstr "errore interno: non ho potuto aggiungere un elemento alla lista"
|
||||
|
||||
#, c-format
|
||||
msgid "attempt to assign sequence of size %d to extended slice of size %d"
|
||||
msgstr "tentativo di assegnare sequenza di dimensione %d a un intervallo "
|
||||
" esteso di dimensione %d"
|
||||
msgstr ""
|
||||
"tentativo di assegnare sequenza di dimensione %d a un intervallo esteso di "
|
||||
"dimensione %d"
|
||||
|
||||
msgid "failed to add item to list"
|
||||
msgstr "non ho potuto aggiungere un elemento alla lista"
|
||||
@@ -6907,4 +6975,3 @@ msgid ""
|
||||
msgstr ""
|
||||
"Impostazione di percorso non riuscita: sys.path non è una lista\n"
|
||||
"Dovresti aggiungere vim.VIM_SPECIAL_PATH a sys.path"
|
||||
|
||||
|
||||
+29
-17
@@ -1,27 +1,39 @@
|
||||
/* channel.c */
|
||||
void ch_logfile(FILE *file);
|
||||
int ch_log_active(void);
|
||||
void ch_log(channel_T *ch, char *msg);
|
||||
void ch_logs(channel_T *ch, char *msg, char *name);
|
||||
channel_T *add_channel(void);
|
||||
void channel_free(channel_T *channel);
|
||||
void channel_gui_register(channel_T *channel);
|
||||
void channel_gui_register_all(void);
|
||||
int channel_open(char *hostname, int port_in, int waittime, void (*close_cb)(void));
|
||||
void channel_set_json_mode(int idx, int json_mode);
|
||||
void channel_set_timeout(int idx, int timeout);
|
||||
void channel_set_callback(int idx, char_u *callback);
|
||||
void channel_set_req_callback(int idx, char_u *callback, int id);
|
||||
char_u *channel_get(int idx);
|
||||
int channel_collapse(int idx);
|
||||
int channel_is_open(int idx);
|
||||
void channel_close(int idx);
|
||||
int channel_save(int idx, char_u *buf, int len);
|
||||
char_u *channel_peek(int idx);
|
||||
void channel_clear(int idx);
|
||||
channel_T *channel_open(char *hostname, int port_in, int waittime, void (*close_cb)(void));
|
||||
void channel_set_pipes(channel_T *channel, sock_T in, sock_T out, sock_T err);
|
||||
void channel_set_job(channel_T *channel, job_T *job);
|
||||
void channel_set_options(channel_T *channel, jobopt_T *options);
|
||||
void channel_set_req_callback(channel_T *channel, char_u *callback, int id);
|
||||
char_u *channel_get(channel_T *channel);
|
||||
int channel_collapse(channel_T *channel);
|
||||
int channel_can_write_to(channel_T *channel);
|
||||
int channel_is_open(channel_T *channel);
|
||||
char *channel_status(channel_T *channel);
|
||||
void channel_close(channel_T *channel);
|
||||
int channel_save(channel_T *channel, char_u *buf, int len);
|
||||
char_u *channel_peek(channel_T *channel);
|
||||
void channel_clear(channel_T *channel);
|
||||
void channel_free_all(void);
|
||||
int channel_get_id(void);
|
||||
void channel_read(int idx);
|
||||
char_u *channel_read_block(int idx);
|
||||
int channel_read_json_block(int ch_idx, int id, typval_T **rettv);
|
||||
int channel_socket2idx(sock_T fd);
|
||||
int channel_send(int idx, char_u *buf, char *fun);
|
||||
void channel_read(channel_T *channel, int which, char *func);
|
||||
char_u *channel_read_block(channel_T *channel);
|
||||
int channel_read_json_block(channel_T *channel, int id, typval_T **rettv);
|
||||
channel_T *channel_fd2channel(sock_T fd, int *whichp);
|
||||
void channel_handle_events(void);
|
||||
int channel_send(channel_T *channel, char_u *buf, char *fun);
|
||||
int channel_poll_setup(int nfd_in, void *fds_in);
|
||||
int channel_poll_check(int ret_in, void *fds_in);
|
||||
int channel_select_setup(int maxfd_in, void *rfds_in);
|
||||
int channel_select_check(int ret_in, void *rfds_in);
|
||||
int channel_parse_messages(void);
|
||||
int set_ref_in_channel(int copyID);
|
||||
ch_mode_T channel_get_mode(channel_T *channel);
|
||||
/* vim: set ft=c : */
|
||||
|
||||
@@ -79,6 +79,7 @@ int dict_add_list(dict_T *d, char *key, list_T *list);
|
||||
dictitem_T *dict_find(dict_T *d, char_u *key, int len);
|
||||
char_u *get_dict_string(dict_T *d, char_u *key, int save);
|
||||
long get_dict_number(dict_T *d, char_u *key);
|
||||
int channel_unref(channel_T *channel);
|
||||
int string2float(char_u *text, float_T *value);
|
||||
char_u *get_function_name(expand_T *xp, int idx);
|
||||
char_u *get_expr_name(expand_T *xp, int idx);
|
||||
|
||||
@@ -14,6 +14,7 @@ void profile_start(proftime_T *tm);
|
||||
void profile_end(proftime_T *tm);
|
||||
void profile_sub(proftime_T *tm, proftime_T *tm2);
|
||||
char *profile_msg(proftime_T *tm);
|
||||
float_T profile_float(proftime_T *tm);
|
||||
void profile_setlimit(long msec, proftime_T *tm);
|
||||
int profile_passed_limit(proftime_T *tm);
|
||||
void profile_zero(proftime_T *tm);
|
||||
|
||||
@@ -227,10 +227,10 @@ gui_mch_replace_dialog(exarg_T *eap);
|
||||
void
|
||||
im_set_control(int enable);
|
||||
|
||||
void *
|
||||
gui_macvim_add_channel(channel_T *channel, int which);
|
||||
void
|
||||
gui_macvim_add_channel(int idx, int fd);
|
||||
void
|
||||
gui_macvim_remove_channel(int idx);
|
||||
gui_macvim_remove_channel(void *cookie);
|
||||
|
||||
void
|
||||
gui_mch_drawsign(int row, int col, int typenr);
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
/* json.c */
|
||||
char_u *json_encode(typval_T *val);
|
||||
char_u *json_encode_nr_expr(int nr, typval_T *val);
|
||||
int json_decode_all(js_read_T *reader, typval_T *res);
|
||||
int json_decode(js_read_T *reader, typval_T *res);
|
||||
int json_find_end(js_read_T *reader);
|
||||
char_u *json_encode(typval_T *val, int options);
|
||||
char_u *json_encode_nr_expr(int nr, typval_T *val, int options);
|
||||
int json_decode_all(js_read_T *reader, typval_T *res, int options);
|
||||
int json_decode(js_read_T *reader, typval_T *res, int options);
|
||||
int json_find_end(js_read_T *reader, int options);
|
||||
/* vim: set ft=c : */
|
||||
|
||||
@@ -55,7 +55,12 @@ int mch_screenmode(char_u *arg);
|
||||
int mch_get_shellsize(void);
|
||||
void mch_set_shellsize(void);
|
||||
void mch_new_shellsize(void);
|
||||
int mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc);
|
||||
int mch_call_shell(char_u *cmd, int options);
|
||||
void mch_start_job(char **argv, job_T *job, jobopt_T *options);
|
||||
char *mch_job_status(job_T *job);
|
||||
int mch_stop_job(job_T *job, char_u *how);
|
||||
void mch_clear_job(job_T *job);
|
||||
void mch_breakcheck(void);
|
||||
int mch_expandpath(garray_T *gap, char_u *path, int flags);
|
||||
int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, int flags);
|
||||
|
||||
@@ -40,6 +40,10 @@ void mch_set_shellsize(void);
|
||||
void mch_new_shellsize(void);
|
||||
void mch_set_winsize_now(void);
|
||||
int mch_call_shell(char_u *cmd, int options);
|
||||
void mch_start_job(char *cmd, job_T *job, jobopt_T *options);
|
||||
char *mch_job_status(job_T *job);
|
||||
int mch_stop_job(job_T *job, char_u *how);
|
||||
void mch_clear_job(job_T *job);
|
||||
void mch_set_normal_colors(void);
|
||||
void mch_write(char_u *s, int len);
|
||||
void mch_delay(long msec, int ignoreinput);
|
||||
|
||||
+9
-4
@@ -1500,6 +1500,10 @@ vim_regcomp_had_eol(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* variables for parsing reginput */
|
||||
static int at_start; /* True when on the first character */
|
||||
static int prev_at_start; /* True when on the second character */
|
||||
|
||||
/*
|
||||
* Parse regular expression, i.e. main body or parenthesized thing.
|
||||
*
|
||||
@@ -1918,6 +1922,7 @@ regatom(int *flagp)
|
||||
int c;
|
||||
char_u *p;
|
||||
int extra = 0;
|
||||
int save_prev_at_start = prev_at_start;
|
||||
|
||||
*flagp = WORST; /* Tentatively. */
|
||||
|
||||
@@ -2331,7 +2336,11 @@ regatom(int *flagp)
|
||||
else if (c == 'l' || c == 'c' || c == 'v')
|
||||
{
|
||||
if (c == 'l')
|
||||
{
|
||||
ret = regnode(RE_LNUM);
|
||||
if (save_prev_at_start)
|
||||
at_start = TRUE;
|
||||
}
|
||||
else if (c == 'c')
|
||||
ret = regnode(RE_COL);
|
||||
else
|
||||
@@ -2946,10 +2955,6 @@ regoptail(char_u *p, char_u *val)
|
||||
/*
|
||||
* Functions for getting characters from the regexp input.
|
||||
*/
|
||||
|
||||
static int at_start; /* True when on the first character */
|
||||
static int prev_at_start; /* True when on the second character */
|
||||
|
||||
/*
|
||||
* Start parsing at "str".
|
||||
*/
|
||||
|
||||
@@ -1128,6 +1128,7 @@ nfa_regatom(void)
|
||||
int startc = -1;
|
||||
int endc = -1;
|
||||
int oldstartc = -1;
|
||||
int save_prev_at_start = prev_at_start;
|
||||
|
||||
c = getchr();
|
||||
switch (c)
|
||||
@@ -1467,9 +1468,13 @@ nfa_regatom(void)
|
||||
if (c == 'l' || c == 'c' || c == 'v')
|
||||
{
|
||||
if (c == 'l')
|
||||
{
|
||||
/* \%{n}l \%{n}<l \%{n}>l */
|
||||
EMIT(cmp == '<' ? NFA_LNUM_LT :
|
||||
cmp == '>' ? NFA_LNUM_GT : NFA_LNUM);
|
||||
if (save_prev_at_start)
|
||||
at_start = TRUE;
|
||||
}
|
||||
else if (c == 'c')
|
||||
/* \%{n}c \%{n}<c \%{n}>c */
|
||||
EMIT(cmp == '<' ? NFA_COL_LT :
|
||||
|
||||
+181
-12
@@ -1111,12 +1111,32 @@ typedef double float_T;
|
||||
typedef struct listvar_S list_T;
|
||||
typedef struct dictvar_S dict_T;
|
||||
|
||||
typedef struct jobvar_S job_T;
|
||||
typedef struct readq_S readq_T;
|
||||
typedef struct jsonq_S jsonq_T;
|
||||
typedef struct cbq_S cbq_T;
|
||||
typedef struct channel_S channel_T;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
VAR_UNKNOWN = 0,
|
||||
VAR_NUMBER, /* "v_number" is used */
|
||||
VAR_STRING, /* "v_string" is used */
|
||||
VAR_FUNC, /* "v_string" is function name */
|
||||
VAR_LIST, /* "v_list" is used */
|
||||
VAR_DICT, /* "v_dict" is used */
|
||||
VAR_FLOAT, /* "v_float" is used */
|
||||
VAR_SPECIAL, /* "v_number" is used */
|
||||
VAR_JOB, /* "v_job" is used */
|
||||
VAR_CHANNEL /* "v_channel" is used */
|
||||
} vartype_T;
|
||||
|
||||
/*
|
||||
* Structure to hold an internal variable without a name.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
char v_type; /* see below: VAR_NUMBER, VAR_STRING, etc. */
|
||||
vartype_T v_type;
|
||||
char v_lock; /* see below: VAR_LOCKED, VAR_FIXED */
|
||||
union
|
||||
{
|
||||
@@ -1127,19 +1147,15 @@ typedef struct
|
||||
char_u *v_string; /* string value (can be NULL!) */
|
||||
list_T *v_list; /* list value (can be NULL!) */
|
||||
dict_T *v_dict; /* dict value (can be NULL!) */
|
||||
#ifdef FEAT_JOB
|
||||
job_T *v_job; /* job value (can be NULL!) */
|
||||
#endif
|
||||
#ifdef FEAT_CHANNEL
|
||||
channel_T *v_channel; /* channel value (can be NULL!) */
|
||||
#endif
|
||||
} vval;
|
||||
} typval_T;
|
||||
|
||||
/* Values for "v_type". */
|
||||
#define VAR_UNKNOWN 0
|
||||
#define VAR_NUMBER 1 /* "v_number" is used */
|
||||
#define VAR_STRING 2 /* "v_string" is used */
|
||||
#define VAR_FUNC 3 /* "v_string" is function name */
|
||||
#define VAR_LIST 4 /* "v_list" is used */
|
||||
#define VAR_DICT 5 /* "v_dict" is used */
|
||||
#define VAR_FLOAT 6 /* "v_float" is used */
|
||||
#define VAR_SPECIAL 7 /* "v_number" is used */
|
||||
|
||||
/* Values for "dv_scope". */
|
||||
#define VAR_SCOPE 1 /* a:, v:, s:, etc. scope dictionaries */
|
||||
#define VAR_DEF_SCOPE 2 /* l:, g: scope dictionaries: here funcrefs are not
|
||||
@@ -1202,7 +1218,6 @@ struct dictitem_S
|
||||
char_u di_flags; /* flags (only used for variable) */
|
||||
char_u di_key[1]; /* key (actually longer!) */
|
||||
};
|
||||
|
||||
typedef struct dictitem_S dictitem_T;
|
||||
|
||||
#define DI_FLAGS_RO 1 /* "di_flags" value: read-only variable */
|
||||
@@ -1226,6 +1241,160 @@ struct dictvar_S
|
||||
dict_T *dv_used_prev; /* previous dict in used dicts list */
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
JOB_FAILED,
|
||||
JOB_STARTED,
|
||||
JOB_ENDED
|
||||
} jobstatus_T;
|
||||
|
||||
/*
|
||||
* Structure to hold info about a Job.
|
||||
*/
|
||||
struct jobvar_S
|
||||
{
|
||||
#ifdef UNIX
|
||||
pid_t jv_pid;
|
||||
int jv_exitval;
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
PROCESS_INFORMATION jv_proc_info;
|
||||
HANDLE jv_job_object;
|
||||
#endif
|
||||
jobstatus_T jv_status;
|
||||
|
||||
int jv_refcount; /* reference count */
|
||||
channel_T *jv_channel; /* channel for I/O, reference counted */
|
||||
};
|
||||
|
||||
/*
|
||||
* Structures to hold info about a Channel.
|
||||
*/
|
||||
struct readq_S
|
||||
{
|
||||
char_u *rq_buffer;
|
||||
readq_T *rq_next;
|
||||
readq_T *rq_prev;
|
||||
};
|
||||
|
||||
struct jsonq_S
|
||||
{
|
||||
typval_T *jq_value;
|
||||
jsonq_T *jq_next;
|
||||
jsonq_T *jq_prev;
|
||||
};
|
||||
|
||||
struct cbq_S
|
||||
{
|
||||
char_u *cq_callback;
|
||||
int cq_seq_nr;
|
||||
cbq_T *cq_next;
|
||||
cbq_T *cq_prev;
|
||||
};
|
||||
|
||||
/* mode for a channel */
|
||||
typedef enum
|
||||
{
|
||||
MODE_NL = 0,
|
||||
MODE_RAW,
|
||||
MODE_JSON,
|
||||
MODE_JS
|
||||
} ch_mode_T;
|
||||
|
||||
/* Ordering matters, it is used in for loops: IN is last, only SOCK/OUT/ERR
|
||||
* are polled. */
|
||||
#define CHAN_SOCK 0
|
||||
#define CH_SOCK ch_pfd[CHAN_SOCK].ch_fd
|
||||
|
||||
#if defined(UNIX) || defined(WIN32)
|
||||
# define CHANNEL_PIPES
|
||||
# define CHAN_FD_INVALID (-1)
|
||||
|
||||
# define CHAN_OUT 1
|
||||
# define CHAN_ERR 2
|
||||
# define CHAN_IN 3
|
||||
# define CH_OUT ch_pfd[CHAN_OUT].ch_fd
|
||||
# define CH_ERR ch_pfd[CHAN_ERR].ch_fd
|
||||
# define CH_IN ch_pfd[CHAN_IN].ch_fd
|
||||
#endif
|
||||
|
||||
/* The per-fd info for a channel. */
|
||||
typedef struct {
|
||||
sock_T ch_fd; /* socket/stdin/stdout/stderr, -1 if not used */
|
||||
|
||||
# if defined(UNIX) && !defined(HAVE_SELECT)
|
||||
int ch_poll_idx; /* used by channel_poll_setup() */
|
||||
# endif
|
||||
|
||||
#ifdef FEAT_GUI_X11
|
||||
XtInputId ch_inputHandler; /* Cookie for input */
|
||||
#endif
|
||||
#ifdef FEAT_GUI_GTK
|
||||
gint ch_inputHandler; /* Cookie for input */
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
int ch_inputHandler; /* ret.value of WSAAsyncSelect() */
|
||||
#endif
|
||||
#ifdef FEAT_GUI_MACVIM
|
||||
void *ch_inputHandler; /* Cookie for input */
|
||||
#endif
|
||||
} chan_fd_T;
|
||||
|
||||
struct channel_S {
|
||||
channel_T *ch_next;
|
||||
channel_T *ch_prev;
|
||||
|
||||
int ch_id; /* ID of the channel */
|
||||
|
||||
chan_fd_T ch_pfd[4]; /* info for socket, out, err and in */
|
||||
|
||||
readq_T ch_head; /* dummy node, header for circular queue */
|
||||
|
||||
int ch_error; /* When TRUE an error was reported. Avoids
|
||||
* giving pages full of error messages when
|
||||
* the other side has exited, only mention the
|
||||
* first error until the connection works
|
||||
* again. */
|
||||
|
||||
void (*ch_close_cb)(void); /* callback for when channel is closed */
|
||||
|
||||
int ch_block_id; /* ID that channel_read_json_block() is
|
||||
waiting for */
|
||||
char_u *ch_callback; /* function to call when a msg is not handled */
|
||||
cbq_T ch_cb_head; /* dummy node for pre-request callbacks */
|
||||
|
||||
ch_mode_T ch_mode;
|
||||
jsonq_T ch_json_head; /* dummy node, header for circular queue */
|
||||
|
||||
int ch_timeout; /* request timeout in msec */
|
||||
|
||||
job_T *ch_job; /* Job that uses this channel; this does not
|
||||
* count as a reference to avoid a circular
|
||||
* reference. */
|
||||
|
||||
int ch_refcount; /* reference count */
|
||||
};
|
||||
|
||||
#define JO_MODE 1
|
||||
#define JO_CALLBACK 2
|
||||
#define JO_WAITTIME 4
|
||||
#define JO_TIMEOUT 8
|
||||
#define JO_ALL 0xffffff
|
||||
|
||||
/*
|
||||
* Options for job and channel commands.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int jo_set; /* JO_ bits for values that were set */
|
||||
|
||||
ch_mode_T jo_mode;
|
||||
char_u *jo_callback; /* not allocated! */
|
||||
int jo_waittime;
|
||||
int jo_timeout;
|
||||
} jobopt_T;
|
||||
|
||||
|
||||
/* structure used for explicit stack while garbage collecting hash tables */
|
||||
typedef struct ht_stack_S
|
||||
{
|
||||
|
||||
@@ -25,6 +25,9 @@ What you can use (see test_assert.vim for an example):
|
||||
to check memory allocation failures are handled gracefully. You need to
|
||||
change the source code to add an ID to the allocation. Update LAST_ID_USED
|
||||
above alloc_id() to the highest ID used.
|
||||
- Use disable_char_avail_for_testing(1) if char_avail() must return FALSE for
|
||||
a while. E.g. to trigger the CursorMovedI autocommand event.
|
||||
See test_cursor_func.vim for an example
|
||||
|
||||
|
||||
TO ADD AN OLD STYLE TEST:
|
||||
|
||||
+37
-32
@@ -19,6 +19,10 @@
|
||||
"
|
||||
" If cleanup after each Test_ function is needed, define a TearDown function.
|
||||
" It will be called after each Test_ function.
|
||||
"
|
||||
" When debugging a test it can be useful to add messages to v:errors:
|
||||
" call add(v:errors, "this happened")
|
||||
|
||||
|
||||
" Without the +eval feature we can't run these tests, bail out.
|
||||
so small.vim
|
||||
@@ -65,50 +69,50 @@ endfunc
|
||||
|
||||
|
||||
" Source the test script. First grab the file name, in case the script
|
||||
" navigates away.
|
||||
let testname = expand('%')
|
||||
let done = 0
|
||||
let fail = 0
|
||||
let errors = []
|
||||
let messages = []
|
||||
" navigates away. g:testname can be used by the tests.
|
||||
let g:testname = expand('%')
|
||||
let s:done = 0
|
||||
let s:fail = 0
|
||||
let s:errors = []
|
||||
let s:messages = []
|
||||
if expand('%') =~ 'test_viml.vim'
|
||||
" this test has intentional errors, don't use try/catch.
|
||||
" this test has intentional s:errors, don't use try/catch.
|
||||
source %
|
||||
else
|
||||
try
|
||||
source %
|
||||
catch
|
||||
let fail += 1
|
||||
call add(errors, 'Caught exception: ' . v:exception . ' @ ' . v:throwpoint)
|
||||
let s:fail += 1
|
||||
call add(s:errors, 'Caught exception: ' . v:exception . ' @ ' . v:throwpoint)
|
||||
endtry
|
||||
endif
|
||||
|
||||
" Locate Test_ functions and execute them.
|
||||
set nomore
|
||||
redir @q
|
||||
function /^Test_
|
||||
silent function /^Test_
|
||||
redir END
|
||||
let tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g'))
|
||||
let s:tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g'))
|
||||
|
||||
" Execute the tests in alphabetical order.
|
||||
for test in sort(tests)
|
||||
for s:test in sort(s:tests)
|
||||
echo 'Executing ' . s:test
|
||||
if exists("*SetUp")
|
||||
call SetUp()
|
||||
endif
|
||||
|
||||
call add(messages, 'Executing ' . test)
|
||||
let done += 1
|
||||
call add(s:messages, 'Executing ' . s:test)
|
||||
let s:done += 1
|
||||
try
|
||||
exe 'call ' . test
|
||||
exe 'call ' . s:test
|
||||
catch
|
||||
let fail += 1
|
||||
call add(v:errors, 'Caught exception in ' . test . ': ' . v:exception . ' @ ' . v:throwpoint)
|
||||
call add(v:errors, 'Caught exception in ' . s:test . ': ' . v:exception . ' @ ' . v:throwpoint)
|
||||
endtry
|
||||
|
||||
if len(v:errors) > 0
|
||||
let fail += 1
|
||||
call add(errors, 'Found errors in ' . test . ':')
|
||||
call extend(errors, v:errors)
|
||||
let s:fail += 1
|
||||
call add(s:errors, 'Found errors in ' . s:test . ':')
|
||||
call extend(s:errors, v:errors)
|
||||
let v:errors = []
|
||||
endif
|
||||
|
||||
@@ -117,35 +121,36 @@ let tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g'))
|
||||
endif
|
||||
endfor
|
||||
|
||||
if fail == 0
|
||||
if s:fail == 0
|
||||
" Success, create the .res file so that make knows it's done.
|
||||
exe 'split ' . fnamemodify(testname, ':r') . '.res'
|
||||
exe 'split ' . fnamemodify(g:testname, ':r') . '.res'
|
||||
write
|
||||
endif
|
||||
|
||||
if len(errors) > 0
|
||||
if len(s:errors) > 0
|
||||
" Append errors to test.log
|
||||
split test.log
|
||||
call append(line('$'), '')
|
||||
call append(line('$'), 'From ' . testname . ':')
|
||||
call append(line('$'), errors)
|
||||
call append(line('$'), 'From ' . g:testname . ':')
|
||||
call append(line('$'), s:errors)
|
||||
write
|
||||
endif
|
||||
|
||||
let message = 'Executed ' . done . (done > 1 ? ' tests': ' test')
|
||||
let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test')
|
||||
echo message
|
||||
call add(messages, message)
|
||||
if fail > 0
|
||||
let message = fail . ' FAILED'
|
||||
call add(s:messages, message)
|
||||
if s:fail > 0
|
||||
let message = s:fail . ' FAILED:'
|
||||
echo message
|
||||
call add(messages, message)
|
||||
call add(s:messages, message)
|
||||
call extend(s:messages, s:errors)
|
||||
endif
|
||||
|
||||
" Append messages to "messages"
|
||||
split messages
|
||||
call append(line('$'), '')
|
||||
call append(line('$'), 'From ' . testname . ':')
|
||||
call append(line('$'), messages)
|
||||
call append(line('$'), 'From ' . g:testname . ':')
|
||||
call append(line('$'), s:messages)
|
||||
write
|
||||
|
||||
qall!
|
||||
|
||||
@@ -98,6 +98,9 @@ p:s/\%#=2\U//g
|
||||
p:s/\%#=0[^A-Z]//g
|
||||
p:s/\%#=1[^A-Z]//g
|
||||
p:s/\%#=2[^A-Z]//g
|
||||
p:s/\%#=0\%204l^\t...//g
|
||||
p:s/\%#=1\%205l^\t...//g
|
||||
p:s/\%#=2\%206l^\t...//g
|
||||
:/^start-here/+1,$wq! test.out
|
||||
ENDTEST
|
||||
|
||||
|
||||
@@ -94,3 +94,6 @@ ABCDEFGHIXYZ
|
||||
ABCDEFGHIXYZ
|
||||
ABCDEFGHIXYZ
|
||||
ABCDEFGHIXYZ
|
||||
!"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~����Ρ芝嚔
|
||||
!"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~����Ρ芝嚔
|
||||
!"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~����Ρ芝嚔
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
" Vim script language tests
|
||||
" Author: Servatius Brandt <Servatius.Brandt@fujitsu-siemens.com>
|
||||
" Last Change: 2016 Jan 02
|
||||
" Last Change: 2016 Feb 07
|
||||
|
||||
"-------------------------------------------------------------------------------
|
||||
" Test environment {{{1
|
||||
@@ -5749,8 +5749,7 @@ function! F()
|
||||
if !caught && !$VIMNOERRTHROW
|
||||
Xpath 8192 " X: 0
|
||||
endif
|
||||
if caught ? !MSG('E55', 'Unmatched \\)')
|
||||
\ : !MSG('E475', "Invalid argument")
|
||||
if !MSG('E475', "Invalid argument")
|
||||
Xpath 16384 " X: 0
|
||||
endif
|
||||
if !caught
|
||||
|
||||
@@ -9,6 +9,7 @@ source test_glob2regpat.vim
|
||||
source test_json.vim
|
||||
source test_lispwords.vim
|
||||
source test_menu.vim
|
||||
source test_reltime.vim
|
||||
source test_searchpos.vim
|
||||
source test_set.vim
|
||||
source test_sort.vim
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
func Test_assert_false()
|
||||
call assert_false(0)
|
||||
call assert_false(v:false)
|
||||
endfunc
|
||||
|
||||
func Test_assert_true()
|
||||
call assert_true(1)
|
||||
call assert_true(123)
|
||||
call assert_true(v:true)
|
||||
endfunc
|
||||
|
||||
func Test_assert_equal()
|
||||
|
||||
+43
-15
@@ -1,13 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# Server that will accept connections from a Vim channel.
|
||||
# Run this server and then in Vim you can open the channel:
|
||||
# :let handle = ch_open('localhost:8765', 'json')
|
||||
#
|
||||
# Then Vim can send requests to the server:
|
||||
# :let response = ch_sendexpr(handle, 'hello!')
|
||||
#
|
||||
# See ":help channel-demo" in Vim.
|
||||
# Used by test_channel.vim.
|
||||
#
|
||||
# This requires Python 2.6 or later.
|
||||
|
||||
@@ -15,6 +9,7 @@ from __future__ import print_function
|
||||
import json
|
||||
import socket
|
||||
import sys
|
||||
import time
|
||||
import threading
|
||||
|
||||
try:
|
||||
@@ -93,6 +88,13 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||
print("sending: {}".format(cmd))
|
||||
self.request.sendall(cmd.encode('utf-8'))
|
||||
response = "ok"
|
||||
elif decoded[1] == 'eval-error':
|
||||
# Send an eval request that works but the result can't
|
||||
# be encoded.
|
||||
cmd = '["eval","function(\\"tr\\")", -3]'
|
||||
print("sending: {}".format(cmd))
|
||||
self.request.sendall(cmd.encode('utf-8'))
|
||||
response = "ok"
|
||||
elif decoded[1] == 'eval-bad':
|
||||
# Send an eval request missing the third argument.
|
||||
cmd = '["eval","xxx"]'
|
||||
@@ -123,19 +125,32 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||
elif decoded[1] == 'eval-result':
|
||||
# Send back the last received eval result.
|
||||
response = last_eval
|
||||
elif decoded[1] == 'call me':
|
||||
cmd = '[0,"we called you"]'
|
||||
print("sending: {}".format(cmd))
|
||||
self.request.sendall(cmd.encode('utf-8'))
|
||||
response = "ok"
|
||||
elif decoded[1] == 'call me again':
|
||||
cmd = '[0,"we did call you"]'
|
||||
print("sending: {}".format(cmd))
|
||||
self.request.sendall(cmd.encode('utf-8'))
|
||||
response = ""
|
||||
elif decoded[1] == '!quit!':
|
||||
# we're done
|
||||
self.server.shutdown()
|
||||
break
|
||||
return
|
||||
elif decoded[1] == '!crash!':
|
||||
# Crash!
|
||||
42 / 0
|
||||
else:
|
||||
response = "what?"
|
||||
|
||||
encoded = json.dumps([decoded[0], response])
|
||||
print("sending: {}".format(encoded))
|
||||
self.request.sendall(encoded.encode('utf-8'))
|
||||
if response == "":
|
||||
print("no response")
|
||||
else:
|
||||
encoded = json.dumps([decoded[0], response])
|
||||
print("sending: {}".format(encoded))
|
||||
self.request.sendall(encoded.encode('utf-8'))
|
||||
|
||||
# Negative numbers are used for "eval" responses.
|
||||
elif decoded[0] < 0:
|
||||
@@ -144,9 +159,25 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||
class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
|
||||
pass
|
||||
|
||||
def writePortInFile(port):
|
||||
# Write the port number in Xportnr, so that the test knows it.
|
||||
f = open("Xportnr", "w")
|
||||
f.write("{}".format(port))
|
||||
f.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
HOST, PORT = "localhost", 0
|
||||
|
||||
# Wait half a second before opening the port to test waittime in ch_open().
|
||||
# We do want to get the port number, get that first. We cannot open the
|
||||
# socket, guess a port is free.
|
||||
if len(sys.argv) >= 2 and sys.argv[1] == 'delay':
|
||||
PORT = 13684
|
||||
writePortInFile(PORT)
|
||||
|
||||
print("Wait for it...")
|
||||
time.sleep(0.5)
|
||||
|
||||
server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler)
|
||||
ip, port = server.server_address
|
||||
|
||||
@@ -155,10 +186,7 @@ if __name__ == "__main__":
|
||||
server_thread = threading.Thread(target=server.serve_forever)
|
||||
server_thread.start()
|
||||
|
||||
# Write the port number in Xportnr, so that the test knows it.
|
||||
f = open("Xportnr", "w")
|
||||
f.write("{}".format(port))
|
||||
f.close()
|
||||
writePortInFile(port)
|
||||
|
||||
print("Listening on port {}".format(port))
|
||||
|
||||
|
||||
+303
-53
@@ -8,77 +8,103 @@ endif
|
||||
" This test requires the Python command to run the test server.
|
||||
" This most likely only works on Unix and Windows.
|
||||
if has('unix')
|
||||
" We also need the pkill command to make sure the server can be stopped.
|
||||
if !executable('python') || !executable('pkill')
|
||||
" We also need the job feature or the pkill command to make sure the server
|
||||
" can be stopped.
|
||||
if !(executable('python') && (has('job') || executable('pkill')))
|
||||
finish
|
||||
endif
|
||||
let s:python = 'python'
|
||||
elseif has('win32')
|
||||
" Use Python Launcher for Windows (py.exe).
|
||||
if !executable('py')
|
||||
" Use Python Launcher for Windows (py.exe) if available.
|
||||
if executable('py.exe')
|
||||
let s:python = 'py.exe'
|
||||
elseif executable('python.exe')
|
||||
let s:python = 'python.exe'
|
||||
else
|
||||
finish
|
||||
endif
|
||||
else
|
||||
" Can't run this test.
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:port = -1
|
||||
let s:chopt = {}
|
||||
|
||||
func s:start_server()
|
||||
" Run "testfunc" after sarting the server and stop the server afterwards.
|
||||
func s:run_server(testfunc, ...)
|
||||
" The Python program writes the port number in Xportnr.
|
||||
call delete("Xportnr")
|
||||
|
||||
if has('win32')
|
||||
silent !start cmd /c start "test_channel" py test_channel.py
|
||||
if a:0 == 1
|
||||
let arg = ' ' . a:1
|
||||
else
|
||||
silent !python test_channel.py&
|
||||
let arg = ''
|
||||
endif
|
||||
let cmd = s:python . " test_channel.py" . arg
|
||||
|
||||
" Wait for up to 2 seconds for the port number to be there.
|
||||
let cnt = 20
|
||||
let l = []
|
||||
while cnt > 0
|
||||
try
|
||||
let l = readfile("Xportnr")
|
||||
catch
|
||||
endtry
|
||||
if len(l) >= 1
|
||||
break
|
||||
try
|
||||
if has('job')
|
||||
let s:job = job_start(cmd)
|
||||
elseif has('win32')
|
||||
exe 'silent !start cmd /c start "test_channel" ' . cmd
|
||||
else
|
||||
exe 'silent !' . cmd . '&'
|
||||
endif
|
||||
sleep 100m
|
||||
let cnt -= 1
|
||||
endwhile
|
||||
call delete("Xportnr")
|
||||
|
||||
if len(l) == 0
|
||||
" Can't make the connection, give up.
|
||||
" Wait for up to 2 seconds for the port number to be there.
|
||||
let cnt = 20
|
||||
let l = []
|
||||
while cnt > 0
|
||||
try
|
||||
let l = readfile("Xportnr")
|
||||
catch
|
||||
endtry
|
||||
if len(l) >= 1
|
||||
break
|
||||
endif
|
||||
sleep 100m
|
||||
let cnt -= 1
|
||||
endwhile
|
||||
call delete("Xportnr")
|
||||
|
||||
if len(l) == 0
|
||||
" Can't make the connection, give up.
|
||||
call assert_false(1, "Can't start test_channel.py")
|
||||
return -1
|
||||
endif
|
||||
let port = l[0]
|
||||
|
||||
call call(function(a:testfunc), [port])
|
||||
catch
|
||||
call assert_false(1, "Caught exception: " . v:exception)
|
||||
finally
|
||||
call s:kill_server()
|
||||
call assert_false(1, "Can't start test_channel.py")
|
||||
return -1
|
||||
endif
|
||||
let s:port = l[0]
|
||||
|
||||
let handle = ch_open('localhost:' . s:port)
|
||||
return handle
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func s:kill_server()
|
||||
if has('win32')
|
||||
call system('taskkill /IM py.exe /T /F /FI "WINDOWTITLE eq test_channel"')
|
||||
if has('job')
|
||||
if exists('s:job')
|
||||
call job_stop(s:job)
|
||||
unlet s:job
|
||||
endif
|
||||
elseif has('win32')
|
||||
call system('taskkill /IM ' . s:python . ' /T /F /FI "WINDOWTITLE eq test_channel"')
|
||||
else
|
||||
call system("pkill -f test_channel.py")
|
||||
endif
|
||||
endfunc
|
||||
|
||||
let s:responseHandle = -1
|
||||
let s:responseMsg = ''
|
||||
func s:RequestHandler(handle, msg)
|
||||
let s:responseHandle = a:handle
|
||||
let s:responseMsg = a:msg
|
||||
endfunc
|
||||
|
||||
func Test_communicate()
|
||||
let handle = s:start_server()
|
||||
if handle < 0
|
||||
func s:communicate(port)
|
||||
let handle = ch_open('localhost:' . a:port, s:chopt)
|
||||
if ch_status(handle) == "fail"
|
||||
call assert_false(1, "Can't open channel")
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -98,11 +124,33 @@ func Test_communicate()
|
||||
call assert_equal('added more', getline('$'))
|
||||
|
||||
" Send a request with a specific handler.
|
||||
call ch_sendexpr(handle, 'hello!', 's:RequestHandler')
|
||||
call ch_sendexpr(handle, 'hello!', {'callback': 's:RequestHandler'})
|
||||
sleep 10m
|
||||
call assert_equal(handle, s:responseHandle)
|
||||
if !exists('s:responseHandle')
|
||||
call assert_false(1, 's:responseHandle was not set')
|
||||
else
|
||||
call assert_equal(handle, s:responseHandle)
|
||||
endif
|
||||
call assert_equal('got it', s:responseMsg)
|
||||
|
||||
unlet s:responseHandle
|
||||
let s:responseMsg = ''
|
||||
call ch_sendexpr(handle, 'hello!', {'callback': function('s:RequestHandler')})
|
||||
sleep 10m
|
||||
if !exists('s:responseHandle')
|
||||
call assert_false(1, 's:responseHandle was not set')
|
||||
else
|
||||
call assert_equal(handle, s:responseHandle)
|
||||
endif
|
||||
call assert_equal('got it', s:responseMsg)
|
||||
|
||||
" check setting options (without testing the effect)
|
||||
call ch_setoptions(handle, {'callback': 's:NotUsed'})
|
||||
call ch_setoptions(handle, {'timeout': 1111})
|
||||
call assert_fails("call ch_setoptions(handle, {'waittime': 111})", "E475")
|
||||
call assert_fails("call ch_setoptions(handle, {'mode': 'json'})", "E475")
|
||||
call ch_setoptions(handle, {'callback': ''})
|
||||
|
||||
" Send an eval request that works.
|
||||
call assert_equal('ok', ch_sendexpr(handle, 'eval-works'))
|
||||
sleep 10m
|
||||
@@ -113,10 +161,15 @@ func Test_communicate()
|
||||
sleep 10m
|
||||
call assert_equal([-2, 'ERROR'], ch_sendexpr(handle, 'eval-result'))
|
||||
|
||||
" Send an eval request that works but can't be encoded.
|
||||
call assert_equal('ok', ch_sendexpr(handle, 'eval-error'))
|
||||
sleep 10m
|
||||
call assert_equal([-3, 'ERROR'], ch_sendexpr(handle, 'eval-result'))
|
||||
|
||||
" Send a bad eval request. There will be no response.
|
||||
call assert_equal('ok', ch_sendexpr(handle, 'eval-bad'))
|
||||
sleep 10m
|
||||
call assert_equal([-2, 'ERROR'], ch_sendexpr(handle, 'eval-result'))
|
||||
call assert_equal([-3, 'ERROR'], ch_sendexpr(handle, 'eval-result'))
|
||||
|
||||
" Send an expr request
|
||||
call assert_equal('ok', ch_sendexpr(handle, 'an expr'))
|
||||
@@ -132,38 +185,235 @@ func Test_communicate()
|
||||
call assert_equal('ok', ch_sendexpr(handle, 'empty-request'))
|
||||
|
||||
" make the server quit, can't check if this works, should not hang.
|
||||
call ch_sendexpr(handle, '!quit!', 0)
|
||||
call ch_sendexpr(handle, '!quit!', {'callback': 0})
|
||||
endfunc
|
||||
|
||||
call s:kill_server()
|
||||
func Test_communicate()
|
||||
call ch_log('Test_communicate()')
|
||||
call s:run_server('s:communicate')
|
||||
endfunc
|
||||
|
||||
" Test that we can open two channels.
|
||||
func Test_two_channels()
|
||||
let handle = s:start_server()
|
||||
if handle < 0
|
||||
func s:two_channels(port)
|
||||
let handle = ch_open('localhost:' . a:port, s:chopt)
|
||||
if ch_status(handle) == "fail"
|
||||
call assert_false(1, "Can't open channel")
|
||||
return
|
||||
endif
|
||||
|
||||
call assert_equal('got it', ch_sendexpr(handle, 'hello!'))
|
||||
|
||||
let newhandle = ch_open('localhost:' . s:port)
|
||||
let newhandle = ch_open('localhost:' . a:port, s:chopt)
|
||||
if ch_status(newhandle) == "fail"
|
||||
call assert_false(1, "Can't open second channel")
|
||||
return
|
||||
endif
|
||||
call assert_equal('got it', ch_sendexpr(newhandle, 'hello!'))
|
||||
call assert_equal('got it', ch_sendexpr(handle, 'hello!'))
|
||||
|
||||
call ch_close(handle)
|
||||
call assert_equal('got it', ch_sendexpr(newhandle, 'hello!'))
|
||||
|
||||
call s:kill_server()
|
||||
call ch_close(newhandle)
|
||||
endfunc
|
||||
|
||||
func Test_two_channels()
|
||||
call ch_log('Test_two_channels()')
|
||||
call s:run_server('s:two_channels')
|
||||
endfunc
|
||||
|
||||
" Test that a server crash is handled gracefully.
|
||||
func Test_server_crash()
|
||||
let handle = s:start_server()
|
||||
if handle < 0
|
||||
func s:server_crash(port)
|
||||
let handle = ch_open('localhost:' . a:port, s:chopt)
|
||||
if ch_status(handle) == "fail"
|
||||
call assert_false(1, "Can't open channel")
|
||||
return
|
||||
endif
|
||||
|
||||
call ch_sendexpr(handle, '!crash!')
|
||||
|
||||
" kill the server in case if failed to crash
|
||||
sleep 10m
|
||||
call s:kill_server()
|
||||
endfunc
|
||||
|
||||
func Test_server_crash()
|
||||
call ch_log('Test_server_crash()')
|
||||
call s:run_server('s:server_crash')
|
||||
endfunc
|
||||
|
||||
let s:reply = ""
|
||||
func s:Handler(chan, msg)
|
||||
unlet s:reply
|
||||
let s:reply = a:msg
|
||||
endfunc
|
||||
|
||||
func s:channel_handler(port)
|
||||
let handle = ch_open('localhost:' . a:port, s:chopt)
|
||||
if ch_status(handle) == "fail"
|
||||
call assert_false(1, "Can't open channel")
|
||||
return
|
||||
endif
|
||||
|
||||
" Test that it works while waiting on a numbered message.
|
||||
call assert_equal('ok', ch_sendexpr(handle, 'call me'))
|
||||
sleep 10m
|
||||
call assert_equal('we called you', s:reply)
|
||||
|
||||
" Test that it works while not waiting on a numbered message.
|
||||
call ch_sendexpr(handle, 'call me again', {'callback': 0})
|
||||
sleep 10m
|
||||
call assert_equal('we did call you', s:reply)
|
||||
endfunc
|
||||
|
||||
func Test_channel_handler()
|
||||
call ch_log('Test_channel_handler()')
|
||||
let s:chopt.callback = 's:Handler'
|
||||
call s:run_server('s:channel_handler')
|
||||
let s:chopt.callback = function('s:Handler')
|
||||
call s:run_server('s:channel_handler')
|
||||
unlet s:chopt.callback
|
||||
endfunc
|
||||
|
||||
" Test that trying to connect to a non-existing port fails quickly.
|
||||
func Test_connect_waittime()
|
||||
call ch_log('Test_connect_waittime()')
|
||||
let start = reltime()
|
||||
let handle = ch_open('localhost:9876', s:chopt)
|
||||
if ch_status(handle) != "fail"
|
||||
" Oops, port does exists.
|
||||
call ch_close(handle)
|
||||
else
|
||||
let elapsed = reltime(start)
|
||||
call assert_true(reltimefloat(elapsed) < 1.0)
|
||||
endif
|
||||
|
||||
let start = reltime()
|
||||
let handle = ch_open('localhost:9867', {'waittime': 500})
|
||||
if ch_status(handle) != "fail"
|
||||
" Oops, port does exists.
|
||||
call ch_close(handle)
|
||||
else
|
||||
" Failed connection doesn't wait the full time on Unix.
|
||||
" TODO: why is MS-Windows different?
|
||||
let elapsed = reltime(start)
|
||||
call assert_true(reltimefloat(elapsed) < 1.0)
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func Test_raw_pipe()
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_raw_pipe()')
|
||||
let job = job_start(s:python . " test_channel_pipe.py", {'mode': 'raw'})
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
let handle = job_getchannel(job)
|
||||
call ch_sendraw(handle, "echo something\n", {'callback': 0})
|
||||
let msg = ch_readraw(handle)
|
||||
call assert_equal("something\n", substitute(msg, "\r", "", 'g'))
|
||||
|
||||
call ch_sendraw(handle, "double this\n", {'callback': 0})
|
||||
let msg = ch_readraw(handle)
|
||||
call assert_equal("this\nAND this\n", substitute(msg, "\r", "", 'g'))
|
||||
|
||||
let reply = ch_sendraw(handle, "quit\n")
|
||||
call assert_equal("Goodbye!\n", substitute(reply, "\r", "", 'g'))
|
||||
finally
|
||||
call job_stop(job)
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_nl_pipe()
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_nl_pipe()')
|
||||
let job = job_start(s:python . " test_channel_pipe.py")
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
let handle = job_getchannel(job)
|
||||
call ch_sendraw(handle, "echo something\n", {'callback': 0})
|
||||
call assert_equal("something", ch_readraw(handle))
|
||||
|
||||
call ch_sendraw(handle, "double this\n", {'callback': 0})
|
||||
call assert_equal("this", ch_readraw(handle))
|
||||
call assert_equal("AND this", ch_readraw(handle))
|
||||
|
||||
let reply = ch_sendraw(handle, "quit\n")
|
||||
call assert_equal("Goodbye!", reply)
|
||||
finally
|
||||
call job_stop(job)
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
""""""""""
|
||||
|
||||
let s:unletResponse = ''
|
||||
func s:UnletHandler(handle, msg)
|
||||
let s:unletResponse = a:msg
|
||||
unlet s:channelfd
|
||||
endfunc
|
||||
|
||||
" Test that "unlet handle" in a handler doesn't crash Vim.
|
||||
func s:unlet_handle(port)
|
||||
let s:channelfd = ch_open('localhost:' . a:port, s:chopt)
|
||||
call ch_sendexpr(s:channelfd, "test", {'callback': function('s:UnletHandler')})
|
||||
sleep 10m
|
||||
call assert_equal('what?', s:unletResponse)
|
||||
endfunc
|
||||
|
||||
func Test_unlet_handle()
|
||||
call ch_log('Test_unlet_handle()')
|
||||
call s:run_server('s:unlet_handle')
|
||||
endfunc
|
||||
|
||||
""""""""""
|
||||
|
||||
let s:unletResponse = ''
|
||||
func s:CloseHandler(handle, msg)
|
||||
let s:unletResponse = a:msg
|
||||
call ch_close(s:channelfd)
|
||||
endfunc
|
||||
|
||||
" Test that "unlet handle" in a handler doesn't crash Vim.
|
||||
func s:close_handle(port)
|
||||
let s:channelfd = ch_open('localhost:' . a:port, s:chopt)
|
||||
call ch_sendexpr(s:channelfd, "test", {'callback': function('s:CloseHandler')})
|
||||
sleep 10m
|
||||
call assert_equal('what?', s:unletResponse)
|
||||
endfunc
|
||||
|
||||
func Test_close_handle()
|
||||
call ch_log('Test_close_handle()')
|
||||
call s:run_server('s:close_handle')
|
||||
endfunc
|
||||
|
||||
""""""""""
|
||||
|
||||
func Test_open_fail()
|
||||
call ch_log('Test_open_fail()')
|
||||
silent! let ch = ch_open("noserver")
|
||||
echo ch
|
||||
let d = ch
|
||||
endfunc
|
||||
|
||||
""""""""""
|
||||
|
||||
func s:open_delay(port)
|
||||
" Wait up to a second for the port to open.
|
||||
let s:chopt.waittime = 1000
|
||||
let channel = ch_open('localhost:' . a:port, s:chopt)
|
||||
unlet s:chopt.waittime
|
||||
if ch_status(channel) == "fail"
|
||||
call assert_false(1, "Can't open channel")
|
||||
return
|
||||
endif
|
||||
call assert_equal('got it', ch_sendexpr(channel, 'hello!'))
|
||||
call ch_close(channel)
|
||||
endfunc
|
||||
|
||||
func Test_open_delay()
|
||||
call ch_log('Test_open_delay()')
|
||||
" The server will wait half a second before creating the port.
|
||||
call s:run_server('s:open_delay', 'delay')
|
||||
endfunc
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# Server that will communicate over stdin/stderr
|
||||
#
|
||||
# This requires Python 2.6 or later.
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
print(sys.argv[1])
|
||||
|
||||
while True:
|
||||
typed = sys.stdin.readline()
|
||||
if typed.startswith("quit"):
|
||||
print("Goodbye!")
|
||||
sys.stdout.flush()
|
||||
break
|
||||
if typed.startswith("echo"):
|
||||
print(typed[5:-1])
|
||||
sys.stdout.flush()
|
||||
if typed.startswith("double"):
|
||||
print(typed[7:-1] + "\nAND " + typed[7:-1])
|
||||
sys.stdout.flush()
|
||||
|
||||
@@ -20,16 +20,35 @@ func Test_move_cursor()
|
||||
call assert_equal([4, 3, 0, 3], getcurpos()[1:])
|
||||
|
||||
call cursor(2, 2)
|
||||
call assert_equal([2, 2, 0, 3], getcurpos()[1:])
|
||||
call assert_equal([2, 2, 0, 2], getcurpos()[1:])
|
||||
" line number zero keeps the line number
|
||||
call cursor(0, 1)
|
||||
call assert_equal([2, 1, 0, 3], getcurpos()[1:])
|
||||
call assert_equal([2, 1, 0, 1], getcurpos()[1:])
|
||||
" col number zero keeps the column
|
||||
call cursor(3, 0)
|
||||
call assert_equal([3, 1, 0, 3], getcurpos()[1:])
|
||||
call assert_equal([3, 1, 0, 1], getcurpos()[1:])
|
||||
" below last line goes to last line
|
||||
call cursor(9, 1)
|
||||
call assert_equal([4, 1, 0, 3], getcurpos()[1:])
|
||||
call assert_equal([4, 1, 0, 1], getcurpos()[1:])
|
||||
|
||||
quit!
|
||||
endfunc
|
||||
|
||||
" Very short version of what matchparen does.
|
||||
function s:Highlight_Matching_Pair()
|
||||
let save_cursor = getcurpos()
|
||||
call setpos('.', save_cursor)
|
||||
endfunc
|
||||
|
||||
func Test_curswant_with_autocommand()
|
||||
new
|
||||
call setline(1, ['func()', '{', '}', '----'])
|
||||
autocmd! CursorMovedI * call s:Highlight_Matching_Pair()
|
||||
call disable_char_avail_for_testing(1)
|
||||
exe "normal! 3Ga\<Down>X\<Esc>"
|
||||
call disable_char_avail_for_testing(0)
|
||||
call assert_equal('-X---', getline(4))
|
||||
autocmd! CursorMovedI *
|
||||
quit!
|
||||
endfunc
|
||||
|
||||
|
||||
+180
-60
@@ -32,9 +32,12 @@ let l3 = [1, 2]
|
||||
let s:varl3 = [l3, l3]
|
||||
|
||||
let s:jsond1 = '{"a":1,"b":"bee","c":[1,2]}'
|
||||
let s:jsd1 = '{a:1,b:"bee",c:[1,2]}'
|
||||
let s:vard1 = {"a": 1, "b": "bee","c": [1,2]}
|
||||
let s:jsond2 = '{"1":1,"2":{"a":"aa","b":{},"c":"cc"},"3":3}'
|
||||
let s:jsd2 = '{"1":1,"2":{a:"aa",b:{},c:"cc"},"3":3}'
|
||||
let s:jsond2s = " { \"1\" : 1 , \"2\" :\n{ \"a\"\r: \"aa\" , \"b\" : {\<Tab>} , \"c\" : \"cc\" } , \"3\" : 3 }\r\n"
|
||||
let s:jsd2s = " { \"1\" : 1 , \"2\" :\n{ a\r: \"aa\" , b : {\<Tab>} , c : \"cc\" } , \"3\" : 3 }\r\n"
|
||||
let s:vard2 = {"1": 1, "2": 2, "3": 3}
|
||||
let d2 = {"a": "aa", "b": s:vard2, "c": "cc"}
|
||||
let s:vard2["2"] = d2
|
||||
@@ -42,92 +45,209 @@ let s:vard2x = {"1": 1, "2": {"a": "aa", "b": {}, "c": "cc"}, "3": 3}
|
||||
let d3 = {"a": 1, "b": 2}
|
||||
let s:vard3 = {"x": d3, "y": d3}
|
||||
let s:jsond3 = '{"x":{"a":1,"b":2},"y":{"a":1,"b":2}}'
|
||||
let s:jsd3 = '{x:{a:1,b:2},y:{a:1,b:2}}'
|
||||
let s:vard4 = {"key": v:none}
|
||||
let s:vard4x = {"key": v:null}
|
||||
let s:jsond4 = '{"key":null}'
|
||||
let s:jsd4 = '{key:null}'
|
||||
|
||||
let s:jsonvals = '[true,false,,null]'
|
||||
let s:varvals = [v:true, v:false, v:none, v:null]
|
||||
let s:jsonvals = '[true,false,null,null]'
|
||||
let s:varvals = [v:true, v:false, v:null, v:null]
|
||||
|
||||
func Test_encode()
|
||||
call assert_equal(s:json1, jsonencode(s:var1))
|
||||
call assert_equal(s:json2, jsonencode(s:var2))
|
||||
call assert_equal(s:json3, jsonencode(s:var3))
|
||||
call assert_equal(s:json4, jsonencode(s:var4))
|
||||
call assert_equal(s:json5, jsonencode(s:var5))
|
||||
func Test_json_encode()
|
||||
call assert_equal(s:json1, json_encode(s:var1))
|
||||
call assert_equal(s:json2, json_encode(s:var2))
|
||||
call assert_equal(s:json3, json_encode(s:var3))
|
||||
call assert_equal(s:json4, json_encode(s:var4))
|
||||
call assert_equal(s:json5, json_encode(s:var5))
|
||||
|
||||
if has('multi_byte')
|
||||
call assert_equal(s:jsonmb, jsonencode(s:varmb))
|
||||
call assert_equal(s:jsonmb, json_encode(s:varmb))
|
||||
endif
|
||||
|
||||
call assert_equal(s:jsonnr, jsonencode(s:varnr))
|
||||
call assert_equal(s:jsonnr, json_encode(s:varnr))
|
||||
if has('float')
|
||||
call assert_equal(s:jsonfl, jsonencode(s:varfl))
|
||||
call assert_equal(s:jsonfl, json_encode(s:varfl))
|
||||
endif
|
||||
|
||||
call assert_equal(s:jsonl1, jsonencode(s:varl1))
|
||||
call assert_equal(s:jsonl2, jsonencode(s:varl2))
|
||||
call assert_equal(s:jsonl3, jsonencode(s:varl3))
|
||||
call assert_equal(s:jsonl1, json_encode(s:varl1))
|
||||
call assert_equal(s:jsonl2, json_encode(s:varl2))
|
||||
call assert_equal(s:jsonl3, json_encode(s:varl3))
|
||||
|
||||
call assert_equal(s:jsond1, jsonencode(s:vard1))
|
||||
call assert_equal(s:jsond2, jsonencode(s:vard2))
|
||||
call assert_equal(s:jsond3, jsonencode(s:vard3))
|
||||
call assert_equal(s:jsond1, json_encode(s:vard1))
|
||||
call assert_equal(s:jsond2, json_encode(s:vard2))
|
||||
call assert_equal(s:jsond3, json_encode(s:vard3))
|
||||
call assert_equal(s:jsond4, json_encode(s:vard4))
|
||||
|
||||
call assert_equal(s:jsonvals, jsonencode(s:varvals))
|
||||
call assert_equal(s:jsonvals, json_encode(s:varvals))
|
||||
|
||||
call assert_fails('echo jsonencode(function("tr"))', 'E474:')
|
||||
call assert_fails('echo jsonencode([function("tr")])', 'E474:')
|
||||
call assert_fails('echo json_encode(function("tr"))', 'E474:')
|
||||
call assert_fails('echo json_encode([function("tr")])', 'E474:')
|
||||
|
||||
silent! let res = json_encode(function("tr"))
|
||||
call assert_equal("", res)
|
||||
endfunc
|
||||
|
||||
func Test_decode()
|
||||
call assert_equal(s:var1, jsondecode(s:json1))
|
||||
call assert_equal(s:var2, jsondecode(s:json2))
|
||||
call assert_equal(s:var3, jsondecode(s:json3))
|
||||
call assert_equal(s:var4, jsondecode(s:json4))
|
||||
call assert_equal(s:var5, jsondecode(s:json5))
|
||||
func Test_json_decode()
|
||||
call assert_equal(s:var1, json_decode(s:json1))
|
||||
call assert_equal(s:var2, json_decode(s:json2))
|
||||
call assert_equal(s:var3, json_decode(s:json3))
|
||||
call assert_equal(s:var4, json_decode(s:json4))
|
||||
call assert_equal(s:var5, json_decode(s:json5))
|
||||
|
||||
if has('multi_byte')
|
||||
call assert_equal(s:varmb, jsondecode(s:jsonmb))
|
||||
call assert_equal(s:varmb, json_decode(s:jsonmb))
|
||||
endif
|
||||
|
||||
call assert_equal(s:varnr, jsondecode(s:jsonnr))
|
||||
call assert_equal(s:varnr, json_decode(s:jsonnr))
|
||||
if has('float')
|
||||
call assert_equal(s:varfl, jsondecode(s:jsonfl))
|
||||
call assert_equal(s:varfl, json_decode(s:jsonfl))
|
||||
endif
|
||||
|
||||
call assert_equal(s:varl1, jsondecode(s:jsonl1))
|
||||
call assert_equal(s:varl2x, jsondecode(s:jsonl2))
|
||||
call assert_equal(s:varl2x, jsondecode(s:jsonl2s))
|
||||
call assert_equal(s:varl3, jsondecode(s:jsonl3))
|
||||
call assert_equal(s:varl1, json_decode(s:jsonl1))
|
||||
call assert_equal(s:varl2x, json_decode(s:jsonl2))
|
||||
call assert_equal(s:varl2x, json_decode(s:jsonl2s))
|
||||
call assert_equal(s:varl3, json_decode(s:jsonl3))
|
||||
|
||||
call assert_equal(s:vard1, jsondecode(s:jsond1))
|
||||
call assert_equal(s:vard2x, jsondecode(s:jsond2))
|
||||
call assert_equal(s:vard3, jsondecode(s:jsond3))
|
||||
call assert_equal(s:vard1, json_decode(s:jsond1))
|
||||
call assert_equal(s:vard2x, json_decode(s:jsond2))
|
||||
call assert_equal(s:vard2x, json_decode(s:jsond2s))
|
||||
call assert_equal(s:vard3, json_decode(s:jsond3))
|
||||
call assert_equal(s:vard4x, json_decode(s:jsond4))
|
||||
|
||||
call assert_equal(s:varvals, jsondecode(s:jsonvals))
|
||||
call assert_equal(s:varvals, json_decode(s:jsonvals))
|
||||
|
||||
call assert_equal(v:true, jsondecode('true'))
|
||||
call assert_equal(type(v:true), type(jsondecode('true')))
|
||||
call assert_equal(v:none, jsondecode(''))
|
||||
call assert_equal(type(v:none), type(jsondecode('')))
|
||||
call assert_equal("", jsondecode('""'))
|
||||
call assert_equal(v:true, json_decode('true'))
|
||||
call assert_equal(type(v:true), type(json_decode('true')))
|
||||
call assert_equal(v:none, json_decode(''))
|
||||
call assert_equal(type(v:none), type(json_decode('')))
|
||||
call assert_equal("", json_decode('""'))
|
||||
|
||||
call assert_equal({'n': 1}, jsondecode('{"n":1,}'))
|
||||
call assert_equal({'n': 1}, json_decode('{"n":1,}'))
|
||||
|
||||
call assert_fails('call jsondecode("\"")', "E474:")
|
||||
call assert_fails('call jsondecode("blah")', "E474:")
|
||||
call assert_fails('call jsondecode("true blah")', "E474:")
|
||||
call assert_fails('call jsondecode("<foobar>")', "E474:")
|
||||
call assert_fails('call json_decode("\"")', "E474:")
|
||||
call assert_fails('call json_decode("blah")', "E474:")
|
||||
call assert_fails('call json_decode("true blah")', "E474:")
|
||||
call assert_fails('call json_decode("<foobar>")', "E474:")
|
||||
|
||||
call assert_fails('call jsondecode("{")', "E474:")
|
||||
call assert_fails('call jsondecode("{foobar}")', "E474:")
|
||||
call assert_fails('call jsondecode("{\"n\",")', "E474:")
|
||||
call assert_fails('call jsondecode("{\"n\":")', "E474:")
|
||||
call assert_fails('call jsondecode("{\"n\":1")', "E474:")
|
||||
call assert_fails('call jsondecode("{\"n\":1,")', "E474:")
|
||||
call assert_fails('call jsondecode("{\"n\",1}")', "E474:")
|
||||
call assert_fails('call jsondecode("{-}")', "E474:")
|
||||
call assert_fails('call json_decode("{")', "E474:")
|
||||
call assert_fails('call json_decode("{foobar}")', "E474:")
|
||||
call assert_fails('call json_decode("{\"n\",")', "E474:")
|
||||
call assert_fails('call json_decode("{\"n\":")', "E474:")
|
||||
call assert_fails('call json_decode("{\"n\":1")', "E474:")
|
||||
call assert_fails('call json_decode("{\"n\":1,")', "E474:")
|
||||
call assert_fails('call json_decode("{\"n\",1}")', "E474:")
|
||||
call assert_fails('call json_decode("{-}")', "E474:")
|
||||
|
||||
call assert_fails('call jsondecode("[foobar]")', "E474:")
|
||||
call assert_fails('call jsondecode("[")', "E474:")
|
||||
call assert_fails('call jsondecode("[1")', "E474:")
|
||||
call assert_fails('call jsondecode("[1,")', "E474:")
|
||||
call assert_fails('call jsondecode("[1 2]")', "E474:")
|
||||
call assert_fails('call json_decode("[foobar]")', "E474:")
|
||||
call assert_fails('call json_decode("[")', "E474:")
|
||||
call assert_fails('call json_decode("[1")', "E474:")
|
||||
call assert_fails('call json_decode("[1,")', "E474:")
|
||||
call assert_fails('call json_decode("[1 2]")', "E474:")
|
||||
|
||||
call assert_fails('call json_decode("[1,,2]")', "E474:")
|
||||
endfunc
|
||||
|
||||
let s:jsl5 = '[7,,,]'
|
||||
let s:varl5 = [7, v:none, v:none]
|
||||
|
||||
func Test_js_encode()
|
||||
call assert_equal(s:json1, js_encode(s:var1))
|
||||
call assert_equal(s:json2, js_encode(s:var2))
|
||||
call assert_equal(s:json3, js_encode(s:var3))
|
||||
call assert_equal(s:json4, js_encode(s:var4))
|
||||
call assert_equal(s:json5, js_encode(s:var5))
|
||||
|
||||
if has('multi_byte')
|
||||
call assert_equal(s:jsonmb, js_encode(s:varmb))
|
||||
endif
|
||||
|
||||
call assert_equal(s:jsonnr, js_encode(s:varnr))
|
||||
if has('float')
|
||||
call assert_equal(s:jsonfl, js_encode(s:varfl))
|
||||
endif
|
||||
|
||||
call assert_equal(s:jsonl1, js_encode(s:varl1))
|
||||
call assert_equal(s:jsonl2, js_encode(s:varl2))
|
||||
call assert_equal(s:jsonl3, js_encode(s:varl3))
|
||||
|
||||
call assert_equal(s:jsd1, js_encode(s:vard1))
|
||||
call assert_equal(s:jsd2, js_encode(s:vard2))
|
||||
call assert_equal(s:jsd3, js_encode(s:vard3))
|
||||
call assert_equal(s:jsd4, js_encode(s:vard4))
|
||||
|
||||
call assert_equal(s:jsonvals, js_encode(s:varvals))
|
||||
|
||||
call assert_fails('echo js_encode(function("tr"))', 'E474:')
|
||||
call assert_fails('echo js_encode([function("tr")])', 'E474:')
|
||||
|
||||
silent! let res = js_encode(function("tr"))
|
||||
call assert_equal("", res)
|
||||
|
||||
call assert_equal(s:jsl5, js_encode(s:varl5))
|
||||
endfunc
|
||||
|
||||
func Test_js_decode()
|
||||
call assert_equal(s:var1, js_decode(s:json1))
|
||||
call assert_equal(s:var2, js_decode(s:json2))
|
||||
call assert_equal(s:var3, js_decode(s:json3))
|
||||
call assert_equal(s:var4, js_decode(s:json4))
|
||||
call assert_equal(s:var5, js_decode(s:json5))
|
||||
|
||||
if has('multi_byte')
|
||||
call assert_equal(s:varmb, js_decode(s:jsonmb))
|
||||
endif
|
||||
|
||||
call assert_equal(s:varnr, js_decode(s:jsonnr))
|
||||
if has('float')
|
||||
call assert_equal(s:varfl, js_decode(s:jsonfl))
|
||||
endif
|
||||
|
||||
call assert_equal(s:varl1, js_decode(s:jsonl1))
|
||||
call assert_equal(s:varl2x, js_decode(s:jsonl2))
|
||||
call assert_equal(s:varl2x, js_decode(s:jsonl2s))
|
||||
call assert_equal(s:varl3, js_decode(s:jsonl3))
|
||||
|
||||
call assert_equal(s:vard1, js_decode(s:jsond1))
|
||||
call assert_equal(s:vard1, js_decode(s:jsd1))
|
||||
call assert_equal(s:vard2x, js_decode(s:jsond2))
|
||||
call assert_equal(s:vard2x, js_decode(s:jsd2))
|
||||
call assert_equal(s:vard2x, js_decode(s:jsond2s))
|
||||
call assert_equal(s:vard2x, js_decode(s:jsd2s))
|
||||
call assert_equal(s:vard3, js_decode(s:jsond3))
|
||||
call assert_equal(s:vard3, js_decode(s:jsd3))
|
||||
call assert_equal(s:vard4x, js_decode(s:jsond4))
|
||||
call assert_equal(s:vard4x, js_decode(s:jsd4))
|
||||
|
||||
call assert_equal(s:varvals, js_decode(s:jsonvals))
|
||||
|
||||
call assert_equal(v:true, js_decode('true'))
|
||||
call assert_equal(type(v:true), type(js_decode('true')))
|
||||
call assert_equal(v:none, js_decode(''))
|
||||
call assert_equal(type(v:none), type(js_decode('')))
|
||||
call assert_equal("", js_decode('""'))
|
||||
|
||||
call assert_equal({'n': 1}, js_decode('{"n":1,}'))
|
||||
|
||||
call assert_fails('call js_decode("\"")', "E474:")
|
||||
call assert_fails('call js_decode("blah")', "E474:")
|
||||
call assert_fails('call js_decode("true blah")', "E474:")
|
||||
call assert_fails('call js_decode("<foobar>")', "E474:")
|
||||
|
||||
call assert_fails('call js_decode("{")', "E474:")
|
||||
call assert_fails('call js_decode("{foobar}")', "E474:")
|
||||
call assert_fails('call js_decode("{\"n\",")', "E474:")
|
||||
call assert_fails('call js_decode("{\"n\":")', "E474:")
|
||||
call assert_fails('call js_decode("{\"n\":1")', "E474:")
|
||||
call assert_fails('call js_decode("{\"n\":1,")', "E474:")
|
||||
call assert_fails('call js_decode("{\"n\",1}")', "E474:")
|
||||
call assert_fails('call js_decode("{-}")', "E474:")
|
||||
|
||||
call assert_fails('call js_decode("[foobar]")', "E474:")
|
||||
call assert_fails('call js_decode("[")', "E474:")
|
||||
call assert_fails('call js_decode("[1")', "E474:")
|
||||
call assert_fails('call js_decode("[1,")', "E474:")
|
||||
call assert_fails('call js_decode("[1 2]")', "E474:")
|
||||
|
||||
call assert_equal(s:varl5, js_decode(s:jsl5))
|
||||
endfunc
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
" Tests for reltime()
|
||||
|
||||
if !has('reltime') || !has('float')
|
||||
finish
|
||||
endif
|
||||
|
||||
func Test_reltime()
|
||||
let now = reltime()
|
||||
sleep 10m
|
||||
let later = reltime()
|
||||
let elapsed = reltime(now)
|
||||
call assert_true(reltimestr(elapsed) =~ '0\.0')
|
||||
call assert_true(reltimestr(elapsed) != '0.0')
|
||||
call assert_true(reltimefloat(elapsed) < 0.1)
|
||||
call assert_true(reltimefloat(elapsed) > 0.0)
|
||||
|
||||
let same = reltime(now, now)
|
||||
call assert_equal('0.000', split(reltimestr(same))[0][:4])
|
||||
call assert_equal(0.0, reltimefloat(same))
|
||||
|
||||
let differs = reltime(now, later)
|
||||
call assert_true(reltimestr(differs) =~ '0\.0')
|
||||
call assert_true(reltimestr(differs) != '0.0')
|
||||
call assert_true(reltimefloat(differs) < 0.1)
|
||||
call assert_true(reltimefloat(differs) > 0.0)
|
||||
|
||||
endfunc
|
||||
@@ -1027,6 +1027,30 @@ func Test_type()
|
||||
call ChangeYourMind()
|
||||
endfunc
|
||||
|
||||
"-------------------------------------------------------------------------------
|
||||
" Test 92: skipping code {{{1
|
||||
"-------------------------------------------------------------------------------
|
||||
|
||||
func Test_skip()
|
||||
let Fn = function('Test_type')
|
||||
call assert_false(0 && Fn[1])
|
||||
call assert_false(0 && string(Fn))
|
||||
call assert_false(0 && len(Fn))
|
||||
let l = []
|
||||
call assert_false(0 && l[1])
|
||||
call assert_false(0 && string(l))
|
||||
call assert_false(0 && len(l))
|
||||
let f = 1.0
|
||||
call assert_false(0 && f[1])
|
||||
call assert_false(0 && string(f))
|
||||
call assert_false(0 && len(f))
|
||||
let sp = v:null
|
||||
call assert_false(0 && sp[1])
|
||||
call assert_false(0 && string(sp))
|
||||
call assert_false(0 && len(sp))
|
||||
|
||||
endfunc
|
||||
|
||||
"-------------------------------------------------------------------------------
|
||||
" Modelines {{{1
|
||||
" vim: ts=8 sw=4 tw=80 fdm=marker
|
||||
|
||||
@@ -116,7 +116,9 @@ static void u_freeentry(u_entry_T *, long);
|
||||
static void corruption_error(char *mesg, char_u *file_name);
|
||||
static void u_free_uhp(u_header_T *uhp);
|
||||
static int undo_write(bufinfo_T *bi, char_u *ptr, size_t len);
|
||||
# ifdef FEAT_CRYPT
|
||||
static int undo_flush(bufinfo_T *bi);
|
||||
# endif
|
||||
static int fwrite_crypt(bufinfo_T *bi, char_u *ptr, size_t len);
|
||||
static int undo_write_bytes(bufinfo_T *bi, long_u nr, int len);
|
||||
static void put_header_ptr(bufinfo_T *bi, u_header_T *uhp);
|
||||
|
||||
+199
@@ -294,6 +294,11 @@ static char *(features[]) =
|
||||
#else
|
||||
"-insert_expand",
|
||||
#endif
|
||||
#ifdef FEAT_JOB
|
||||
"+job",
|
||||
#else
|
||||
"-job",
|
||||
#endif
|
||||
#ifdef FEAT_JUMPLIST
|
||||
"+jumplist",
|
||||
#else
|
||||
@@ -757,6 +762,200 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1362,
|
||||
/**/
|
||||
1361,
|
||||
/**/
|
||||
1360,
|
||||
/**/
|
||||
1359,
|
||||
/**/
|
||||
1358,
|
||||
/**/
|
||||
1357,
|
||||
/**/
|
||||
1356,
|
||||
/**/
|
||||
1355,
|
||||
/**/
|
||||
1354,
|
||||
/**/
|
||||
1353,
|
||||
/**/
|
||||
1352,
|
||||
/**/
|
||||
1351,
|
||||
/**/
|
||||
1350,
|
||||
/**/
|
||||
1349,
|
||||
/**/
|
||||
1348,
|
||||
/**/
|
||||
1347,
|
||||
/**/
|
||||
1346,
|
||||
/**/
|
||||
1345,
|
||||
/**/
|
||||
1344,
|
||||
/**/
|
||||
1343,
|
||||
/**/
|
||||
1342,
|
||||
/**/
|
||||
1341,
|
||||
/**/
|
||||
1340,
|
||||
/**/
|
||||
1339,
|
||||
/**/
|
||||
1338,
|
||||
/**/
|
||||
1337,
|
||||
/**/
|
||||
1336,
|
||||
/**/
|
||||
1335,
|
||||
/**/
|
||||
1334,
|
||||
/**/
|
||||
1333,
|
||||
/**/
|
||||
1332,
|
||||
/**/
|
||||
1331,
|
||||
/**/
|
||||
1330,
|
||||
/**/
|
||||
1329,
|
||||
/**/
|
||||
1328,
|
||||
/**/
|
||||
1327,
|
||||
/**/
|
||||
1326,
|
||||
/**/
|
||||
1325,
|
||||
/**/
|
||||
1324,
|
||||
/**/
|
||||
1323,
|
||||
/**/
|
||||
1322,
|
||||
/**/
|
||||
1321,
|
||||
/**/
|
||||
1320,
|
||||
/**/
|
||||
1319,
|
||||
/**/
|
||||
1318,
|
||||
/**/
|
||||
1317,
|
||||
/**/
|
||||
1316,
|
||||
/**/
|
||||
1315,
|
||||
/**/
|
||||
1314,
|
||||
/**/
|
||||
1313,
|
||||
/**/
|
||||
1312,
|
||||
/**/
|
||||
1311,
|
||||
/**/
|
||||
1310,
|
||||
/**/
|
||||
1309,
|
||||
/**/
|
||||
1308,
|
||||
/**/
|
||||
1307,
|
||||
/**/
|
||||
1306,
|
||||
/**/
|
||||
1305,
|
||||
/**/
|
||||
1304,
|
||||
/**/
|
||||
1303,
|
||||
/**/
|
||||
1302,
|
||||
/**/
|
||||
1301,
|
||||
/**/
|
||||
1300,
|
||||
/**/
|
||||
1299,
|
||||
/**/
|
||||
1298,
|
||||
/**/
|
||||
1297,
|
||||
/**/
|
||||
1296,
|
||||
/**/
|
||||
1295,
|
||||
/**/
|
||||
1294,
|
||||
/**/
|
||||
1293,
|
||||
/**/
|
||||
1292,
|
||||
/**/
|
||||
1291,
|
||||
/**/
|
||||
1290,
|
||||
/**/
|
||||
1289,
|
||||
/**/
|
||||
1288,
|
||||
/**/
|
||||
1287,
|
||||
/**/
|
||||
1286,
|
||||
/**/
|
||||
1285,
|
||||
/**/
|
||||
1284,
|
||||
/**/
|
||||
1283,
|
||||
/**/
|
||||
1282,
|
||||
/**/
|
||||
1281,
|
||||
/**/
|
||||
1280,
|
||||
/**/
|
||||
1279,
|
||||
/**/
|
||||
1278,
|
||||
/**/
|
||||
1277,
|
||||
/**/
|
||||
1276,
|
||||
/**/
|
||||
1275,
|
||||
/**/
|
||||
1274,
|
||||
/**/
|
||||
1273,
|
||||
/**/
|
||||
1272,
|
||||
/**/
|
||||
1271,
|
||||
/**/
|
||||
1270,
|
||||
/**/
|
||||
1269,
|
||||
/**/
|
||||
1268,
|
||||
/**/
|
||||
1267,
|
||||
/**/
|
||||
1266,
|
||||
/**/
|
||||
1265,
|
||||
/**/
|
||||
|
||||
@@ -1733,6 +1733,12 @@ typedef struct timeval proftime_T;
|
||||
typedef int proftime_T; /* dummy for function prototypes */
|
||||
#endif
|
||||
|
||||
#ifdef _WIN64
|
||||
typedef __int64 sock_T;
|
||||
#else
|
||||
typedef int sock_T;
|
||||
#endif
|
||||
|
||||
/* Include option.h before structs.h, because the number of window-local and
|
||||
* buffer-local options is used there. */
|
||||
#include "option.h" /* options and default values */
|
||||
@@ -1973,14 +1979,6 @@ typedef int VimClipboard; /* This is required for the prototypes. */
|
||||
# define stat(a,b) (access(a,0) ? -1 : stat(a,b))
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_CHANNEL
|
||||
# ifdef WIN64
|
||||
typedef __int64 sock_T;
|
||||
# else
|
||||
typedef int sock_T;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "ex_cmds.h" /* Ex command defines */
|
||||
#include "proto.h" /* function prototypes */
|
||||
|
||||
@@ -2320,6 +2318,10 @@ typedef int sock_T;
|
||||
# define MAX_OPEN_CHANNELS 0
|
||||
#endif
|
||||
|
||||
/* Options for json_encode() and json_decode. */
|
||||
#define JSON_JS 1 /* use JS instead of JSON */
|
||||
#define JSON_NO_NONE 2 /* v:none item not allowed */
|
||||
|
||||
#ifdef FEAT_MZSCHEME
|
||||
/* this is in main.c, cproto can't handle it. */
|
||||
int vim_main2(int argc, char **argv);
|
||||
|
||||
Reference in New Issue
Block a user