mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-07 15:37:14 +02:00
Compare commits
237 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1cfc3ae8fd | |||
| 6656c5dc0c | |||
| b984b80cd8 | |||
| dec04ee38a | |||
| 49a613f84a | |||
| 238d43b328 | |||
| a038cb5eab | |||
| c212798333 | |||
| b4d5fbabc9 | |||
| 45d5f26d11 | |||
| 95c83c64be | |||
| 65f084749b | |||
| c168bd4bd3 | |||
| 414168d97f | |||
| e9f6fd27d0 | |||
| 8696bbaf52 | |||
| e09ba7bae5 | |||
| 7be9b50fd7 | |||
| 5b5adf5b9c | |||
| 9d18961323 | |||
| aba680a851 | |||
| 74121231be | |||
| 09d6c3818d | |||
| b4ea1914b8 | |||
| b15a5a564a | |||
| fe386641b0 | |||
| 3c518400d1 | |||
| 1a735d6c9b | |||
| 2dc9d26c14 | |||
| ba2929b6af | |||
| 99433291b1 | |||
| c5520eef7a | |||
| c6da01a5b8 | |||
| 75a60f74ce | |||
| 37b53270e1 | |||
| e5e5f79ac7 | |||
| 8ebe7eb25f | |||
| 618d6d277e | |||
| 4c0698e34d | |||
| e723c42836 | |||
| 2e49b6b20c | |||
| c35e4cb4fe | |||
| 46e2f361b4 | |||
| d0fef7608b | |||
| 1b9f9d315f | |||
| 28550b74bb | |||
| c3f81394ef | |||
| 6756c7037f | |||
| 3971905bac | |||
| 3d8d2c7ca5 | |||
| 8b53b79ea5 | |||
| 1bfdc07a49 | |||
| 6e32f615eb | |||
| 11aa62f8f9 | |||
| 178333783f | |||
| 9d954207e2 | |||
| ac46984df5 | |||
| e88fc7a574 | |||
| 9d654a8d8c | |||
| 595a40226e | |||
| d8d85bfb7d | |||
| 5e80de3f3e | |||
| 00ccf54630 | |||
| ae96b8d058 | |||
| 6a8691d483 | |||
| 2254a8ad0c | |||
| 4ec86ddd77 | |||
| 9f45ccd1bf | |||
| e2e69e4813 | |||
| 3653822546 | |||
| b31cf2bb0b | |||
| cf4b00c856 | |||
| da22b8cc8b | |||
| dada6d2a8e | |||
| ef68e4fa52 | |||
| 3346cc4ffb | |||
| 995e4afcfe | |||
| 9ac9dfa9e2 | |||
| 2c809b7c7d | |||
| 9e8dcf9d6f | |||
| da73253a0b | |||
| 3d593c2dc9 | |||
| 2db0ec4b2e | |||
| 41d097c6d1 | |||
| 5c6dbcb03f | |||
| 4e83961985 | |||
| 4bebc9a056 | |||
| a539f4f1ae | |||
| 1a333bc44a | |||
| dc5471d482 | |||
| 0f0f230012 | |||
| d41babef89 | |||
| 4ad3b2b588 | |||
| dde6034111 | |||
| f3af54eeb1 | |||
| 97a80e440a | |||
| b47a2597e6 | |||
| 7151602a88 | |||
| e561a7e2fa | |||
| 48340b62e8 | |||
| 97f65fafdb | |||
| c2d7e784f2 | |||
| 3c37a8e660 | |||
| 4db2554954 | |||
| 33f2e0c190 | |||
| 1dccf6351d | |||
| cbe6944956 | |||
| c572da5f67 | |||
| 7adf06f4e2 | |||
| 4ab7968aa9 | |||
| 8d9f0ef5c6 | |||
| e85928a324 | |||
| 02e177d3e8 | |||
| 0903d56f5c | |||
| 13ebb03e75 | |||
| dde81312b0 | |||
| a4f99f5a8b | |||
| e922460394 | |||
| 833e0e3c8c | |||
| e8ae05cc39 | |||
| 753289f9bf | |||
| f15c436680 | |||
| be0b72977f | |||
| f6d9f96b2d | |||
| a7a8d32ca8 | |||
| 33d66bd9fa | |||
| 6c4d12c527 | |||
| 285f243e50 | |||
| 77f7474d08 | |||
| 829aa64cf5 | |||
| 2ecbffb1ee | |||
| d2c45a1964 | |||
| ec0e07a324 | |||
| 6d0826dfbb | |||
| 5830232c02 | |||
| 5130947405 | |||
| 3f9a1ff141 | |||
| 740c433c59 | |||
| 0cbba82359 | |||
| b109bb4e12 | |||
| eef0531621 | |||
| 37819ed540 | |||
| 5983d50247 | |||
| b241208a13 | |||
| edbc0d46cf | |||
| 8efa026a25 | |||
| ce1c32780a | |||
| 43d09fb2b8 | |||
| 37b9b81997 | |||
| 0aed9a2e2e | |||
| d6a7b3e6bb | |||
| dc926dd0dd | |||
| 77ac9b5c62 | |||
| 93c92eff26 | |||
| fc8bec0be4 | |||
| 3eee06e7d4 | |||
| 683b796725 | |||
| d21f8b54b2 | |||
| 9aa1569128 | |||
| 98ebd2bbec | |||
| 4c45ccc606 | |||
| 8e539c51c3 | |||
| f66a2cda2c | |||
| ea5d6fadbb | |||
| 97bd5e6527 | |||
| 4da4a08258 | |||
| cfce71710b | |||
| 82de3c2c03 | |||
| bc906e445c | |||
| f5be7cd016 | |||
| a83e3962ac | |||
| 84ed4ad084 | |||
| ade59630c7 | |||
| f4ab9b32ba | |||
| 9e13aa7729 | |||
| 989a70c590 | |||
| 6fe15bbc87 | |||
| 47d91337bd | |||
| a9f8ee05f4 | |||
| 60104f183c | |||
| d21b16f3c0 | |||
| 3678393baa | |||
| 4fa1019f80 | |||
| 05fbfdcda4 | |||
| c08706135d | |||
| 51c23687a9 | |||
| 6bb18a878c | |||
| bce4f62d30 | |||
| 2bb7b6b0e4 | |||
| 304b64c9e6 | |||
| 6b93b0e838 | |||
| 9f0139a2a8 | |||
| 4f44b88684 | |||
| 69905d108b | |||
| e62780543f | |||
| 2438ae3d67 | |||
| dcaa61384c | |||
| 274a52fd58 | |||
| e0f314aa8d | |||
| 62426e168e | |||
| 5cc1f2c477 | |||
| 679653e59c | |||
| 55b6926450 | |||
| 3d9bdfebf1 | |||
| 893029ab20 | |||
| c977092053 | |||
| 3cd43ccccb | |||
| 589b1109c5 | |||
| 37c4583594 | |||
| 7eedd4398a | |||
| 0cd2a94a40 | |||
| 9698ad7201 | |||
| 8cad930a25 | |||
| a9f41842d0 | |||
| b81bc77ae7 | |||
| da43b61ddd | |||
| 8ed5400739 | |||
| 08d384ff3a | |||
| 89e06c807a | |||
| d9bc8a801a | |||
| 444fda2084 | |||
| ae33833850 | |||
| cf8d840ce9 | |||
| 1ccd8fff8a | |||
| 05aafed54b | |||
| 76ca1b4041 | |||
| ab6c8587ba | |||
| 2d33e90f81 | |||
| e41e3b41f9 | |||
| f1237f1814 | |||
| dd693ce28b | |||
| c810e7ea3d | |||
| 8ab3c1dc6b | |||
| 0a0217abfa | |||
| 1c8be134a1 | |||
| 82b9ca05f4 | |||
| 292d569935 |
@@ -105,6 +105,7 @@ SRC_ALL = \
|
||||
src/testdir/Make_all.mak \
|
||||
src/testdir/*.in \
|
||||
src/testdir/*.py \
|
||||
src/testdir/lsan-suppress.txt \
|
||||
src/testdir/sautest/autoload/*.vim \
|
||||
src/testdir/runtest.vim \
|
||||
src/testdir/shared.vim \
|
||||
@@ -637,6 +638,7 @@ RT_ALL = \
|
||||
runtime/pack/dist/opt/matchit/doc/tags \
|
||||
runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim \
|
||||
runtime/pack/dist/opt/swapmouse/plugin/swapmouse.vim \
|
||||
runtime/pack/dist/opt/termdebug/plugin/termdebug.vim \
|
||||
|
||||
# runtime files for all distributions without CR-NL translation
|
||||
RT_ALL_BIN = \
|
||||
|
||||
+12
-1
@@ -191,13 +191,16 @@ Section "Vim executables and runtime files"
|
||||
File ${VIMSRC}\vimrun.exe
|
||||
File /oname=tee.exe ${VIMSRC}\teew32.exe
|
||||
File /oname=xxd.exe ${VIMSRC}\xxdw32.exe
|
||||
File ${VIMTOOLS}\diff.exe
|
||||
File ${VIMRT}\vimtutor.bat
|
||||
File ${VIMRT}\README.txt
|
||||
File ..\uninstal.txt
|
||||
File ${VIMRT}\*.vim
|
||||
File ${VIMRT}\rgb.txt
|
||||
|
||||
File ${VIMTOOLS}\diff.exe
|
||||
File ${VIMTOOLS}\winpty32.dll
|
||||
File ${VIMTOOLS}\winpty-agent.exe
|
||||
|
||||
SetOutPath $0\colors
|
||||
File ${VIMRT}\colors\*.*
|
||||
|
||||
@@ -216,6 +219,14 @@ Section "Vim executables and runtime files"
|
||||
|
||||
SetOutPath $0\macros
|
||||
File ${VIMRT}\macros\*.*
|
||||
SetOutPath $0\macros\hanoi
|
||||
File ${VIMRT}\macros\hanoi\*.*
|
||||
SetOutPath $0\macros\life
|
||||
File ${VIMRT}\macros\life\*.*
|
||||
SetOutPath $0\macros\maze
|
||||
File ${VIMRT}\macros\maze\*.*
|
||||
SetOutPath $0\macros\urm
|
||||
File ${VIMRT}\macros\urm\*.*
|
||||
|
||||
SetOutPath $0\pack\dist\opt\dvorak\dvorak
|
||||
File ${VIMRT}\pack\dist\opt\dvorak\dvorak\*.*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*channel.txt* For Vim version 8.0. Last change: 2017 Jul 22
|
||||
*channel.txt* For Vim version 8.0. Last change: 2017 Aug 11
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -427,8 +427,8 @@ 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. You can use |ch_canread()|
|
||||
to check if there is something to read.
|
||||
|
||||
Note that when there is no callback message are dropped. To avoid that add a
|
||||
close callback to the channel.
|
||||
Note that when there is no callback, messages are dropped. To avoid that add
|
||||
a close callback to the channel.
|
||||
|
||||
To read all output from a RAW channel that is available: >
|
||||
let output = ch_readraw(channel)
|
||||
@@ -696,6 +696,10 @@ See |job_setoptions()| and |ch_setoptions()|.
|
||||
"block_write": number only for testing: pretend every other write to stdin
|
||||
will block
|
||||
|
||||
"env": dict environment variables for the new process
|
||||
"cwd": "/path/to/dir" current working directory for the new process;
|
||||
if the directory does not exist an error is given
|
||||
|
||||
|
||||
Writing to a buffer ~
|
||||
*out_io-buffer*
|
||||
@@ -731,10 +735,6 @@ The "out_msg" option can be used to specify whether a new buffer will have the
|
||||
first line set to "Reading from channel output...". The default is to add the
|
||||
message. "err_msg" does the same for channel error.
|
||||
|
||||
'modifiable' option off, or write to a buffer that has 'modifiable' off. That
|
||||
means that lines will be appended to the buffer, but the user can't easily
|
||||
change the buffer.
|
||||
|
||||
When an existing buffer is to be written where 'modifiable' is off and the
|
||||
"out_modifiable" or "err_modifiable" options is not zero, an error is given
|
||||
and the buffer will not be written to.
|
||||
|
||||
@@ -830,6 +830,11 @@ Also see |`=|.
|
||||
Note: these are typed literally, they are not special keys!
|
||||
<cword> is replaced with the word under the cursor (like |star|)
|
||||
<cWORD> is replaced with the WORD under the cursor (see |WORD|)
|
||||
<cexpr> is replaced with the word under the cursor, including more
|
||||
to form a C expression. E.g., when the cursor is on "arg"
|
||||
of "ptr->arg" then the result is "ptr->arg"; when the
|
||||
cursor is on "]" of "list[idx]" then the result is
|
||||
"list[idx]". This is used for |v:beval_text|.
|
||||
<cfile> is replaced with the path name under the cursor (like what
|
||||
|gf| uses)
|
||||
<afile> When executing autocommands, is replaced with the file name
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*editing.txt* For Vim version 8.0. Last change: 2017 Aug 01
|
||||
*editing.txt* For Vim version 8.0. Last change: 2017 Aug 21
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1109,6 +1109,7 @@ The names can be in upper- or lowercase.
|
||||
window in the current tab page the current tab page is
|
||||
closed |tab-page|.
|
||||
Triggers the |QuitPre| autocommand event.
|
||||
See |CTRL-W_q| for quitting another window.
|
||||
|
||||
:conf[irm] q[uit] Quit, but give prompt when changes have been made, or
|
||||
the last file in the argument list has not been
|
||||
|
||||
+201
-51
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 8.0. Last change: 2017 Aug 06
|
||||
*eval.txt* For Vim version 8.0. Last change: 2017 Sep 11
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1449,7 +1449,7 @@ v:beval_text The text under or after the mouse pointer. Usually a word as
|
||||
but a dot and "->" before the position is included. When on a
|
||||
']' the text before it is used, including the matching '[' and
|
||||
word before it. When on a Visual area within one line the
|
||||
highlighted text is used.
|
||||
highlighted text is used. Also see |<cexpr>|.
|
||||
Only valid while evaluating the 'balloonexpr' option.
|
||||
|
||||
*v:beval_winnr* *beval_winnr-variable*
|
||||
@@ -1902,6 +1902,26 @@ v:termresponse The escape sequence returned by the terminal for the |t_RV|
|
||||
always 95 or bigger). Pc is always zero.
|
||||
{only when compiled with |+termresponse| feature}
|
||||
|
||||
*v:termblinkresp*
|
||||
v:termblinkresp The escape sequence returned by the terminal for the |t_RC|
|
||||
termcap entry. This is used to find out whether the terminal
|
||||
cursor is blinking. This is used by |term_getcursor()|.
|
||||
|
||||
*v:termstyleresp*
|
||||
v:termstyleresp The escape sequence returned by the terminal for the |t_RS|
|
||||
termcap entry. This is used to find out what the shape of the
|
||||
cursor is. This is used by |term_getcursor()|.
|
||||
|
||||
*v:termrgbresp*
|
||||
v:termrgbresp The escape sequence returned by the terminal for the |t_RB|
|
||||
termcap entry. This is used to find out what the terminal
|
||||
background color is, see 'background'.
|
||||
|
||||
*v:termu7resp*
|
||||
v:termu7resp The escape sequence returned by the terminal for the |t_u7|
|
||||
termcap entry. This is used to find out what the terminal
|
||||
does with ambiguous width characters, see 'ambiwidth'.
|
||||
|
||||
*v:testing* *testing-variable*
|
||||
v:testing Must be set before using `test_garbagecollect_now()`.
|
||||
Also, when set certain error messages won't be shown for 2
|
||||
@@ -2296,6 +2316,9 @@ searchpos({pattern} [, {flags} [, {stopline} [, {timeout}]]])
|
||||
server2client({clientid}, {string})
|
||||
Number send reply string
|
||||
serverlist() String get a list of available servers
|
||||
setbufline( {expr}, {lnum}, {line})
|
||||
Number set line {lnum} to {line} in buffer
|
||||
{expr}
|
||||
setbufvar({expr}, {varname}, {val})
|
||||
none set {varname} in buffer {expr} to {val}
|
||||
setcharsearch({dict}) Dict set character search from {dict}
|
||||
@@ -2369,14 +2392,16 @@ tagfiles() List tags files used
|
||||
tan({expr}) Float tangent of {expr}
|
||||
tanh({expr}) Float hyperbolic tangent of {expr}
|
||||
tempname() String name for a temporary file
|
||||
term_getaltscreen({buf}) Number get the alternate screen flag
|
||||
term_getattr({attr}, {what}) Number get the value of attribute {what}
|
||||
term_getcursor({buf}) List get the cursor position of a terminal
|
||||
term_getjob({buf}) Job get the job associated with a terminal
|
||||
term_getline({buf}, {row}) String get a line of text from a terminal
|
||||
term_getscrolled({buf}) Number get the scroll count of a terminal
|
||||
term_getsize({buf}) List get the size of a terminal
|
||||
term_getstatus({buf}) String get the status of a terminal
|
||||
term_gettitle({buf}) String get the title of a terminal
|
||||
term_gettty({buf}) String get the tty name of a terminal
|
||||
term_getttty({buf}, [{input}]) String get the tty name of a terminal
|
||||
term_list() List get the list of terminal buffers
|
||||
term_scrape({buf}, {row}) List get row of a terminal screen
|
||||
term_sendkeys({buf}, {keys}) none send keystrokes to a terminal
|
||||
@@ -2385,6 +2410,7 @@ term_wait({buf} [, {time}]) Number wait for screen to be updated
|
||||
test_alloc_fail({id}, {countdown}, {repeat})
|
||||
none make memory allocation fail
|
||||
test_autochdir() none enable 'autochdir' during startup
|
||||
test_feedinput() none add key sequence to input buffer
|
||||
test_garbagecollect_now() none free memory right now for testing
|
||||
test_ignore_error({expr}) none ignore a specific error
|
||||
test_null_channel() Channel null value for testing
|
||||
@@ -2984,6 +3010,11 @@ ch_logfile({fname} [, {mode}]) *ch_logfile()*
|
||||
The file is flushed after every message, on Unix you can use
|
||||
"tail -f" to see what is going on in real time.
|
||||
|
||||
This function is not available in the |sandbox|.
|
||||
NOTE: the channel communication is stored in the file, be
|
||||
aware that this may contain confidential and privacy sensitive
|
||||
information, e.g. a password you type in a terminal window.
|
||||
|
||||
|
||||
ch_open({address} [, {options}]) *ch_open()*
|
||||
Open a channel to {address}. See |channel|.
|
||||
@@ -3270,7 +3301,7 @@ count({comp}, {expr} [, {ic} [, {start}]]) *count()*
|
||||
When {ic} is given and it's |TRUE| then case is ignored.
|
||||
|
||||
When {comp} is a string then the number of not overlapping
|
||||
occurences of {expr} is returned.
|
||||
occurrences of {expr} is returned.
|
||||
|
||||
|
||||
*cscope_connection()*
|
||||
@@ -3436,7 +3467,7 @@ escape({string}, {chars}) *escape()*
|
||||
:echo escape('c:\program files\vim', ' \')
|
||||
< results in: >
|
||||
c:\\program\ files\\vim
|
||||
< Also see |shellescape()|.
|
||||
< Also see |shellescape()| and |fnameescape()|.
|
||||
|
||||
*eval()*
|
||||
eval({string}) Evaluate {string} and return the result. Especially useful to
|
||||
@@ -3856,7 +3887,7 @@ float2nr({expr}) *float2nr()*
|
||||
When the value of {expr} is out of range for a |Number| the
|
||||
result is truncated to 0x7fffffff or -0x7fffffff (or when
|
||||
64-bit Number support is enabled, 0x7fffffffffffffff or
|
||||
-0x7fffffffffffffff. NaN results in -0x80000000 (or when
|
||||
-0x7fffffffffffffff). NaN results in -0x80000000 (or when
|
||||
64-bit Number support is enabled, -0x8000000000000000).
|
||||
Examples: >
|
||||
echo float2nr(3.95)
|
||||
@@ -4605,23 +4636,39 @@ getqflist([{what}]) *getqflist()*
|
||||
returns only the items listed in {what} as a dictionary. The
|
||||
following string items are supported in {what}:
|
||||
context get the context stored with |setqflist()|
|
||||
efm errorformat to use when parsing "lines". If
|
||||
not present, then the 'erroformat' option
|
||||
value is used.
|
||||
id get information for the quickfix list with
|
||||
|quickfix-ID|; zero means the id for the
|
||||
current list or the list specifed by "nr"
|
||||
items quickfix list entries
|
||||
lines use 'errorformat' to extract items from a list
|
||||
of lines and return the resulting entries.
|
||||
Only a |List| type is accepted. The current
|
||||
quickfix list is not modified.
|
||||
nr get information for this quickfix list; zero
|
||||
means the current quickfix list and '$' means
|
||||
means the current quickfix list and "$" means
|
||||
the last quickfix list
|
||||
title get the list title
|
||||
winid get the |window-ID| (if opened)
|
||||
all all of the above quickfix properties
|
||||
Non-string items in {what} are ignored.
|
||||
If "nr" is not present then the current quickfix list is used.
|
||||
To get the number of lists in the quickfix stack, set 'nr' to
|
||||
'$' in {what}. The 'nr' value in the returned dictionary
|
||||
If both "nr" and a non-zero "id" are specified, then the list
|
||||
specified by "id" is used.
|
||||
To get the number of lists in the quickfix stack, set "nr" to
|
||||
"$" in {what}. The "nr" value in the returned dictionary
|
||||
contains the quickfix stack size.
|
||||
When "lines" is specified, all the other items except "efm"
|
||||
are ignored. The returned dictionary contains the entry
|
||||
"items" with the list of entries.
|
||||
In case of error processing {what}, an empty dictionary is
|
||||
returned.
|
||||
|
||||
The returned dictionary contains the following entries:
|
||||
context context information stored with |setqflist()|
|
||||
id quickfix list ID |quickfix-ID|
|
||||
items quickfix list entries
|
||||
nr quickfix list number
|
||||
title quickfix list title text
|
||||
@@ -4630,6 +4677,7 @@ getqflist([{what}]) *getqflist()*
|
||||
Examples: >
|
||||
:echo getqflist({'all': 1})
|
||||
:echo getqflist({'nr': 2, 'title': 1})
|
||||
:echo getqflist({'lines' : ["F1:10:L10"]})
|
||||
<
|
||||
|
||||
getreg([{regname} [, 1 [, {list}]]]) *getreg()*
|
||||
@@ -4740,6 +4788,8 @@ getwininfo([{winid}]) *getwininfo()*
|
||||
{only with the +quickfix feature}
|
||||
quickfix 1 if quickfix or location list window
|
||||
{only with the +quickfix feature}
|
||||
terminal 1 if a terminal window
|
||||
{only with the +terminal feature}
|
||||
tabnr tab page number
|
||||
variables a reference to the dictionary with
|
||||
window-local variables
|
||||
@@ -5195,7 +5245,8 @@ job_info({job}) *job_info()*
|
||||
"status" what |job_status()| returns
|
||||
"channel" what |job_getchannel()| returns
|
||||
"process" process ID
|
||||
"tty" controlling terminal name, empty when none
|
||||
"tty_in" terminal input name, empty when none
|
||||
"tty_out" terminal output name, empty when none
|
||||
"exitval" only valid when "status" is "dead"
|
||||
"exit_cb" function to be called on exit
|
||||
"stoponexit" |job-stoponexit|
|
||||
@@ -5208,6 +5259,7 @@ job_setoptions({job}, {options}) *job_setoptions()*
|
||||
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.
|
||||
To start a job in a terminal window see |term_start()|.
|
||||
|
||||
{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
|
||||
@@ -5946,7 +5998,7 @@ mode([expr]) Return a string that indicates the current mode.
|
||||
a non-empty String (|non-zero-arg|), then the full mode is
|
||||
returned, otherwise only the first letter is returned.
|
||||
|
||||
n Normal
|
||||
n Normal, Terminal-Normal
|
||||
no Operator-pending
|
||||
v Visual by character
|
||||
V Visual by line
|
||||
@@ -5968,6 +6020,7 @@ mode([expr]) Return a string that indicates the current mode.
|
||||
rm The -- more -- prompt
|
||||
r? A |:confirm| query of some sort
|
||||
! Shell or external command is executing
|
||||
t Terminal-Job mode: keys go to the job
|
||||
This is useful in the 'statusline' option or when used
|
||||
with |remote_expr()| In most other places it always returns
|
||||
"c" or "n".
|
||||
@@ -6813,6 +6866,19 @@ serverlist() *serverlist()*
|
||||
Example: >
|
||||
:echo serverlist()
|
||||
<
|
||||
setbufline({expr}, {lnum}, {text}) *setbufline()*
|
||||
Set line {lnum} to {text} in buffer {expr}. To insert
|
||||
lines use |append()|.
|
||||
|
||||
For the use of {expr}, see |bufname()| above.
|
||||
|
||||
{lnum} is used like with |setline()|.
|
||||
This works like |setline()| for the specified buffer.
|
||||
On success 0 is returned, on failure 1 is returned.
|
||||
|
||||
If {expr} is not a valid buffer or {lnum} is not valid, an
|
||||
error message is given.
|
||||
|
||||
setbufvar({expr}, {varname}, {val}) *setbufvar()*
|
||||
Set option or local variable {varname} in buffer {expr} to
|
||||
{val}.
|
||||
@@ -6881,13 +6947,19 @@ setfperm({fname}, {mode}) *setfperm()* *chmod*
|
||||
|
||||
setline({lnum}, {text}) *setline()*
|
||||
Set line {lnum} of the current buffer to {text}. To insert
|
||||
lines use |append()|.
|
||||
lines use |append()|. To set lines in another buffer use
|
||||
|setbufline()|.
|
||||
|
||||
{lnum} is used like with |getline()|.
|
||||
When {lnum} is just below the last line the {text} will be
|
||||
added as a new line.
|
||||
|
||||
If this succeeds, 0 is returned. If this fails (most likely
|
||||
because {lnum} is invalid) 1 is returned. Example: >
|
||||
because {lnum} is invalid) 1 is returned.
|
||||
|
||||
Example: >
|
||||
:call setline(5, strftime("%c"))
|
||||
|
||||
< When {text} is a |List| then line {lnum} and following lines
|
||||
will be set to the items in the list. Example: >
|
||||
:call setline(5, ['aaa', 'bbb', 'ccc'])
|
||||
@@ -6895,6 +6967,7 @@ setline({lnum}, {text}) *setline()*
|
||||
:for [n, l] in [[5, 'aaa'], [6, 'bbb'], [7, 'ccc']]
|
||||
: call setline(n, l)
|
||||
:endfor
|
||||
|
||||
< Note: The '[ and '] marks are not set.
|
||||
|
||||
setloclist({nr}, {list}[, {action}[, {what}]]) *setloclist()*
|
||||
@@ -6966,10 +7039,12 @@ setpos({expr}, {list})
|
||||
|winrestview()|.
|
||||
|
||||
setqflist({list} [, {action}[, {what}]]) *setqflist()*
|
||||
Create or replace or add to the quickfix list using the items
|
||||
in {list}. Each item in {list} is a dictionary.
|
||||
Non-dictionary items in {list} are ignored. Each dictionary
|
||||
item can contain the following entries:
|
||||
Create or replace or add to the quickfix list.
|
||||
|
||||
When {what} is not present, use the items in {list}. Each
|
||||
item must be a dictionary. Non-dictionary items in {list} are
|
||||
ignored. Each dictionary item can contain the following
|
||||
entries:
|
||||
|
||||
bufnr buffer number; must be the number of a valid
|
||||
buffer
|
||||
@@ -7014,27 +7089,41 @@ setqflist({list} [, {action}[, {what}]]) *setqflist()*
|
||||
freed.
|
||||
|
||||
If {action} is not present or is set to ' ', then a new list
|
||||
is created.
|
||||
is created. The new quickfix list is added after the current
|
||||
quickfix list in the stack and all the following lists are
|
||||
freed. To add a new quickfix list at the end of the stack,
|
||||
set "nr" in {what} to "$".
|
||||
|
||||
If the optional {what} dictionary argument is supplied, then
|
||||
only the items listed in {what} are set. The first {list}
|
||||
argument is ignored. The following items can be specified in
|
||||
{what}:
|
||||
context any Vim type can be stored as a context
|
||||
efm errorformat to use when parsing text from
|
||||
"lines". If this is not present, then the
|
||||
'errorformat' option value is used.
|
||||
id quickfix list identifier |quickfix-ID|
|
||||
items list of quickfix entries. Same as the {list}
|
||||
argument.
|
||||
lines use 'errorformat' to parse a list of lines and
|
||||
add the resulting entries to the quickfix list
|
||||
{nr} or {id}. Only a |List| value is supported.
|
||||
nr list number in the quickfix stack; zero
|
||||
means the current quickfix list and '$' means
|
||||
means the current quickfix list and "$" means
|
||||
the last quickfix list
|
||||
title quickfix list title text
|
||||
Unsupported keys in {what} are ignored.
|
||||
If the "nr" item is not present, then the current quickfix list
|
||||
is modified. When creating a new quickfix list, "nr" can be
|
||||
set to a value one greater than the quickfix stack size.
|
||||
When modifying a quickfix list, to guarantee that the correct
|
||||
list is modified, "id" should be used instead of "nr" to
|
||||
specify the list.
|
||||
|
||||
Examples: >
|
||||
:call setqflist([], 'r', {'title': 'My search'})
|
||||
:call setqflist([], 'r', {'nr': 2, 'title': 'Errors'})
|
||||
:call setqflist([], 'r', {'title': 'My search'})
|
||||
:call setqflist([], 'r', {'nr': 2, 'title': 'Errors'})
|
||||
:call setqflist([], 'a', {'id':myid, 'lines':["F1:10:L10"]})
|
||||
<
|
||||
Returns zero for success, -1 for failure.
|
||||
|
||||
@@ -7076,16 +7165,17 @@ setreg({regname}, {value} [, {options}])
|
||||
:call setreg('a', "1\n2\n3", 'b5')
|
||||
|
||||
< This example shows using the functions to save and restore a
|
||||
register (note: you may not reliably restore register value
|
||||
without using the third argument to |getreg()| as without it
|
||||
newlines are represented as newlines AND Nul bytes are
|
||||
represented as newlines as well, see |NL-used-for-Nul|). >
|
||||
register: >
|
||||
:let var_a = getreg('a', 1, 1)
|
||||
:let var_amode = getregtype('a')
|
||||
....
|
||||
:call setreg('a', var_a, var_amode)
|
||||
< Note: you may not reliably restore register value
|
||||
without using the third argument to |getreg()| as without it
|
||||
newlines are represented as newlines AND Nul bytes are
|
||||
represented as newlines as well, see |NL-used-for-Nul|.
|
||||
|
||||
< You can also change the type of a register by appending
|
||||
You can also change the type of a register by appending
|
||||
nothing: >
|
||||
:call setreg('a', '', 'al')
|
||||
|
||||
@@ -7665,6 +7755,7 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()*
|
||||
"standout" "1" if standout
|
||||
"underline" "1" if underlined
|
||||
"undercurl" "1" if undercurled
|
||||
"strike" "1" if strikethrough
|
||||
|
||||
Example (echoes the color of the syntax item under the
|
||||
cursor): >
|
||||
@@ -7694,12 +7785,12 @@ synconcealed({lnum}, {col}) *synconcealed()*
|
||||
the text is "123456" and both "23" and "45" are concealed
|
||||
and replace by the character "X", then:
|
||||
call returns ~
|
||||
synconcealed(lnum, 1) [0, '', 0]
|
||||
synconcealed(lnum, 2) [1, 'X', 1]
|
||||
synconcealed(lnum, 3) [1, 'X', 1]
|
||||
synconcealed(lnum, 4) [1, 'X', 2]
|
||||
synconcealed(lnum, 5) [1, 'X', 2]
|
||||
synconcealed(lnum, 6) [0, '', 0]
|
||||
synconcealed(lnum, 1) [0, '', 0]
|
||||
synconcealed(lnum, 2) [1, 'X', 1]
|
||||
synconcealed(lnum, 3) [1, 'X', 1]
|
||||
synconcealed(lnum, 4) [1, 'X', 2]
|
||||
synconcealed(lnum, 5) [1, 'X', 2]
|
||||
synconcealed(lnum, 6) [0, '', 0]
|
||||
|
||||
|
||||
synstack({lnum}, {col}) *synstack()*
|
||||
@@ -7908,6 +7999,12 @@ tempname() *tempname()* *temp-file-name*
|
||||
For MS-Windows forward slashes are used when the 'shellslash'
|
||||
option is set or when 'shellcmdflag' starts with '-'.
|
||||
|
||||
term_getaltscreen({buf}) *term_getaltscreen()*
|
||||
Returns 1 if the terminal of {buf} is using the alternate
|
||||
screen.
|
||||
{buf} is used as with |term_getsize()|.
|
||||
{only available when compiled with the |+terminal| feature}
|
||||
|
||||
term_getattr({attr}, {what}) *term_getattr()*
|
||||
Given {attr}, a value returned by term_scrape() in the "attr"
|
||||
item, return whether {what} is on. {what} can be one of:
|
||||
@@ -7920,13 +8017,19 @@ term_getattr({attr}, {what}) *term_getattr()*
|
||||
|
||||
term_getcursor({buf}) *term_getcursor()*
|
||||
Get the cursor position of terminal {buf}. Returns a list with
|
||||
three numbers: [rows, cols, visible]. "rows" and "cols" are
|
||||
one based, the first screen cell is row 1, column 1.
|
||||
"visible" is one when the cursor is visible, zero when it is
|
||||
hidden.
|
||||
two numbers and a dictionary: [rows, cols, dict].
|
||||
|
||||
This is the cursor position of the terminal itself, not of the
|
||||
Vim window.
|
||||
"rows" and "cols" are one based, the first screen cell is row
|
||||
1, column 1. This is the cursor position of the terminal
|
||||
itself, not of the Vim window.
|
||||
|
||||
"dict" can have these members:
|
||||
"visible" one when the cursor is visible, zero when it
|
||||
is hidden.
|
||||
"blink" one when the cursor is visible, zero when it
|
||||
is hidden.
|
||||
"shape" 1 for a block cursor, 2 for underline and 3
|
||||
for a vertical bar.
|
||||
|
||||
{buf} must be the buffer number of a terminal window. If the
|
||||
buffer does not exist or is not a terminal window, an empty
|
||||
@@ -7948,6 +8051,18 @@ term_getline({buf}, {row}) *term_getline()*
|
||||
returned.
|
||||
{only available when compiled with the |+terminal| feature}
|
||||
|
||||
term_getscrolled({buf}) *term_getscrolled()*
|
||||
Return the number of lines that scrolled to above the top of
|
||||
terminal {buf}. This is the offset between the row number
|
||||
used for |term_getline()| and |getline()|, so that: >
|
||||
term_getline(buf, N)
|
||||
< is equal to: >
|
||||
`getline(N + term_getscrolled(buf))
|
||||
< (if that line exists).
|
||||
|
||||
{buf} is used as with |term_getsize()|.
|
||||
{only available when compiled with the |+terminal| feature}
|
||||
|
||||
term_getsize({buf}) *term_getsize()*
|
||||
Get the size of terminal {buf}. Returns a list with two
|
||||
numbers: [rows, cols]. This is the size of the terminal, not
|
||||
@@ -7980,10 +8095,13 @@ term_gettitle({buf}) *term_gettitle()*
|
||||
string is returned.
|
||||
{only available when compiled with the |+terminal| feature}
|
||||
|
||||
term_gettty({buf}) *term_gettty()*
|
||||
term_gettty({buf} [, {input}]) *term_gettty()*
|
||||
Get the name of the controlling terminal associated with
|
||||
terminal window {buf}.
|
||||
{buf} is used as with |term_getsize()|.
|
||||
terminal window {buf}. {buf} is used as with |term_getsize()|.
|
||||
|
||||
When {input} is omitted or 0, return the name for writing
|
||||
(stdout). When {input} is 1 return the name for reading
|
||||
(stdin). On UNIX, both return same name.
|
||||
{only available when compiled with the |+terminal| feature}
|
||||
|
||||
term_list() *term_list()*
|
||||
@@ -8004,7 +8122,7 @@ term_scrape({buf}, {row}) *term_scrape()*
|
||||
"fg" foreground color as #rrggbb
|
||||
"bg" background color as #rrggbb
|
||||
"attr" attributes of the cell, use |term_getattr()|
|
||||
to get the individual flags
|
||||
to get the individual flags
|
||||
"width" cell width: 1 or 2
|
||||
{only available when compiled with the |+terminal| feature}
|
||||
|
||||
@@ -8019,15 +8137,17 @@ term_sendkeys({buf}, {keys}) *term_sendkeys()*
|
||||
term_start({cmd}, {options}) *term_start()*
|
||||
Open a terminal window and run {cmd} in it.
|
||||
|
||||
Returns the buffer number of the terminal window.
|
||||
When opening the window fails zero is returned.
|
||||
Returns the buffer number of the terminal window. If {cmd}
|
||||
cannot be executed the window does open and shows an error
|
||||
message.
|
||||
If opening the window fails zero is returned.
|
||||
|
||||
{options} are similar to what is used for |job_start()|, see
|
||||
|job-options|. However, not all options can be used. These
|
||||
are supported:
|
||||
all timeout options
|
||||
"stoponexit"
|
||||
"out_cb", "err_cb"
|
||||
"callback", "out_cb", "err_cb"
|
||||
"exit_cb", "close_cb"
|
||||
"in_io", "in_top", "in_bot", "in_name", "in_buf"
|
||||
"out_io", "out_name", "out_buf", "out_modifiable", "out_msg"
|
||||
@@ -8036,9 +8156,34 @@ term_start({cmd}, {options}) *term_start()*
|
||||
connected to the terminal. When I/O is connected to the
|
||||
terminal then the callback function for that part is not used.
|
||||
|
||||
There is one extra option:
|
||||
"term_name" name to use for the buffer name, instead of
|
||||
the command name.
|
||||
There are extra options:
|
||||
"term_name" name to use for the buffer name, instead
|
||||
of the command name.
|
||||
"term_rows" vertical size to use for the terminal,
|
||||
instead of using 'termsize'
|
||||
"term_cols" horizontal size to use for the terminal,
|
||||
instead of using 'termsize'
|
||||
"vertical" split the window vertically
|
||||
"curwin" use the current window, do not split the
|
||||
window; fails if the current buffer
|
||||
cannot be |abandon|ed
|
||||
"hidden" do not open a window
|
||||
"term_finish" What to do when the job is finished:
|
||||
"close": close any windows
|
||||
"open": open window if needed
|
||||
Note that "open" can be interruptive.
|
||||
See |term++close| and |term++open|.
|
||||
"term_opencmd" command to use for opening the window when
|
||||
"open" is used for "term_finish"; must
|
||||
have "%d" where the buffer number goes,
|
||||
e.g. "10split|buffer %d"; when not
|
||||
specified "botright sbuf %d" is used
|
||||
"eof_chars" Text to send after all buffer lines were
|
||||
written to the terminal. When not set
|
||||
CTRL-D is used on MS-Windows. For Python
|
||||
use CTRL-Z or "exit()". For a shell use
|
||||
"exit". A CR is always added.
|
||||
|
||||
{only available when compiled with the |+terminal| feature}
|
||||
|
||||
term_wait({buf} [, {time}]) *term_wait()*
|
||||
@@ -8058,6 +8203,11 @@ test_autochdir() *test_autochdir()*
|
||||
Set a flag to enable the effect of 'autochdir' before Vim
|
||||
startup has finished.
|
||||
|
||||
test_feedinput({string}) *test_feedinput()*
|
||||
Characters in {string} are queued for processing as if they
|
||||
were typed by the user. This uses a low level input buffer.
|
||||
This function works only when with |+unix| or GUI is running.
|
||||
|
||||
test_garbagecollect_now() *test_garbagecollect_now()*
|
||||
Like garbagecollect(), but executed right away. This must
|
||||
only be called directly to avoid any structure to exist
|
||||
@@ -8113,7 +8263,7 @@ test_override({name}, {val}) *test_override()*
|
||||
in a way that the test doesn't work properly.
|
||||
When using: >
|
||||
call test_override('starting', 1)
|
||||
< The value of "starting" is saved. It is restored by: >
|
||||
< The value of "starting" is saved. It is restored by: >
|
||||
call test_override('starting', 0)
|
||||
|
||||
test_settime({expr}) *test_settime()*
|
||||
@@ -8415,7 +8565,7 @@ win_getid([{win} [, {tab}]]) *win_getid()*
|
||||
Get the |window-ID| for the specified window.
|
||||
When {win} is missing use the current window.
|
||||
With {win} this is the window number. The top window has
|
||||
number 1.
|
||||
number 1. Use `win_getid(winnr())` for the current window.
|
||||
Without {tab} use the current tab, otherwise the tab with
|
||||
number {tab}. The first tab has number one.
|
||||
Return zero if the window cannot be found.
|
||||
@@ -8562,7 +8712,7 @@ wordcount() *wordcount()*
|
||||
(only in Visual mode)
|
||||
visual_chars Number of chars visually selected
|
||||
(only in Visual mode)
|
||||
visual_words Number of chars visually selected
|
||||
visual_words Number of words visually selected
|
||||
(only in Visual mode)
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
*gui.txt* For Vim version 8.0. Last change: 2017 Jul 15
|
||||
*gui.txt* For Vim version 8.0. Last change: 2017 Aug 27
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -67,7 +67,7 @@ When the GUI starts up initializations are carried out, in this order:
|
||||
executed as an Ex command.
|
||||
- If the user gvimrc file exists, it is sourced. The name of this file is
|
||||
normally "$HOME/.gvimrc". You can check this with ":version".
|
||||
- For Win32, when $HOME is not set, "$VIM\_gvimrc" is used.
|
||||
- For Win32, $HOME is set by Vim if needed, see |$HOME-windows|.
|
||||
- When a "_gvimrc" file is not found, ".gvimrc" is tried too. And vice
|
||||
versa.
|
||||
The name of the first file found is stored in $MYGVIMRC, unless it was
|
||||
|
||||
@@ -894,10 +894,10 @@ On Ubuntu you will want to install these packages for Python 2:
|
||||
python-dev
|
||||
For Python 3:
|
||||
python3
|
||||
pytyon3-dev
|
||||
python3-dev
|
||||
For Python 3.6:
|
||||
python3.6
|
||||
pytyon3.6-dev
|
||||
python3.6-dev
|
||||
|
||||
If you have more than one version of Python 3, you need to link python3 to the
|
||||
one you prefer, before running configure.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*index.txt* For Vim version 8.0. Last change: 2017 Jul 30
|
||||
*index.txt* For Vim version 8.0. Last change: 2017 Aug 02
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -540,7 +540,7 @@ tag command action in Normal mode ~
|
||||
|CTRL-W_J| CTRL-W J move current window to the very bottom
|
||||
|CTRL-W_K| CTRL-W K move current window to the very top
|
||||
|CTRL-W_L| CTRL-W L move current window to the far right
|
||||
|CTRL-W_N| CTRL-W N terminal window: go to Terminal mode
|
||||
|CTRL-W_N| CTRL-W N terminal window: go to Terminal Normal mode
|
||||
|CTRL-W_P| CTRL-W P go to preview window
|
||||
|CTRL-W_R| CTRL-W R rotate windows upwards N times
|
||||
|CTRL-W_S| CTRL-W S same as "CTRL-W s"
|
||||
|
||||
+15
-7
@@ -1,4 +1,4 @@
|
||||
*intro.txt* For Vim version 8.0. Last change: 2017 Jul 30
|
||||
*intro.txt* For Vim version 8.0. Last change: 2017 Aug 24
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -530,7 +530,7 @@ examples and use them directly. Or type them literally, including the '<' and
|
||||
==============================================================================
|
||||
5. Modes, introduction *vim-modes-intro* *vim-modes*
|
||||
|
||||
Vim has six BASIC modes:
|
||||
Vim has seven BASIC modes:
|
||||
|
||||
*Normal* *Normal-mode* *command-mode*
|
||||
Normal mode In Normal mode you can enter all the normal editor
|
||||
@@ -566,6 +566,11 @@ Ex mode Like Command-line mode, but after entering a command
|
||||
you remain in Ex mode. Very limited editing of the
|
||||
command line. |Ex-mode|
|
||||
|
||||
Terminal-Job mode Interacting with a job in a terminal window. Typed
|
||||
keys go to the job and the job output is displayed in
|
||||
the terminal window. See |terminal| about how to
|
||||
switch to other modes.
|
||||
|
||||
There are seven ADDITIONAL modes. These are variants of the BASIC modes:
|
||||
|
||||
*Operator-pending* *Operator-pending-mode*
|
||||
@@ -592,10 +597,9 @@ Insert Normal mode Entered when CTRL-O given in Insert mode. This is
|
||||
If the 'showmode' option is on "-- (insert) --" is
|
||||
shown at the bottom of the window.
|
||||
|
||||
Terminal Normal mode Using Normal mode in a terminal window. Making
|
||||
changes is impossible. Use a insert command, such as
|
||||
"a" or "i", to return control to the job running in
|
||||
the terminal. Also called |Terminal-mode|.
|
||||
Terminal-Normal mode Using Normal mode in a terminal window. Making
|
||||
changes is impossible. Use an insert command, such as
|
||||
"a" or "i", to return to Terminal-Job mode.
|
||||
|
||||
Insert Visual mode Entered when starting a Visual selection from Insert
|
||||
mode, e.g., by using CTRL-O and then "v", "V" or
|
||||
@@ -671,6 +675,8 @@ Normal mode from any other mode. This can be used to make sure Vim is in
|
||||
Normal mode, without causing a beep like <Esc> would. However, this does not
|
||||
work in Ex mode. When used after a command that takes an argument, such as
|
||||
|f| or |m|, the timeout set with 'ttimeoutlen' applies.
|
||||
When focus is in a terminal window, CTRL-\ CTRL-N goes to Normal mode for only
|
||||
one command, see |t_CTRL-\_CTRL-N|.
|
||||
|
||||
*CTRL-\_CTRL-G* *i_CTRL-\_CTRL-G* *c_CTRL-\_CTRL-G* *v_CTRL-\_CTRL-G*
|
||||
The command CTRL-\ CTRL-G or <C-\><C-G> can be used to go to Insert mode when
|
||||
@@ -833,10 +839,12 @@ by Vim. {Vi: not ok}
|
||||
==============================================================================
|
||||
8. Definitions *definitions*
|
||||
|
||||
buffer Contains lines of text, usually read from a file.
|
||||
screen The whole area that Vim uses to work in. This can be
|
||||
a terminal emulator window. Also called "the Vim
|
||||
window".
|
||||
window A view on a buffer.
|
||||
window A view on a buffer. There can be multiple windows for
|
||||
one buffer.
|
||||
|
||||
A screen contains one or more windows, separated by status lines and with the
|
||||
command line at the bottom.
|
||||
|
||||
@@ -1415,6 +1415,8 @@ The valid escape sequences are
|
||||
<line1> The starting line of the command range.
|
||||
*<line2>*
|
||||
<line2> The final line of the command range.
|
||||
*<range>*
|
||||
<range> The number of items in the command range: 0, 1 or 2
|
||||
*<count>*
|
||||
<count> Any count supplied (as described for the '-range'
|
||||
and '-count' attributes).
|
||||
|
||||
@@ -832,6 +832,9 @@ Use the RPM or port for your system.
|
||||
|
||||
Currently, GUI Vim supports three styles, |OverTheSpot|, |OffTheSpot| and
|
||||
|Root|.
|
||||
When compiled with |+GUI_GTK| feature, GUI Vim supports two styles,
|
||||
|OnTheSpot| and |OverTheSpot|. You can select the style with the 'imstyle'
|
||||
option.
|
||||
|
||||
*. on-the-spot *OnTheSpot*
|
||||
Preedit Area and Status Area are performed by the client application in
|
||||
|
||||
+42
-17
@@ -1,4 +1,4 @@
|
||||
*options.txt* For Vim version 8.0. Last change: 2017 Jul 31
|
||||
*options.txt* For Vim version 8.0. Last change: 2017 Aug 27
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -417,12 +417,13 @@ On Unix systems the form "${HOME}" can be used too. The name between {} can
|
||||
contain non-id characters then. Note that if you want to use this for the
|
||||
"gf" command, you need to add the '{' and '}' characters to 'isfname'.
|
||||
|
||||
On MS-Windows, if $HOME is not defined as an environment variable, then
|
||||
at runtime Vim will set it to the expansion of $HOMEDRIVE$HOMEPATH.
|
||||
|
||||
NOTE: expanding environment variables and "~/" is only done with the ":set"
|
||||
command, not when assigning a value to an option with ":let".
|
||||
|
||||
*$HOME-windows*
|
||||
On MS-Windows, if $HOME is not defined as an environment variable, then
|
||||
at runtime Vim will set it to the expansion of $HOMEDRIVE$HOMEPATH.
|
||||
|
||||
|
||||
Note the maximum length of an expanded option is limited. How much depends on
|
||||
the system, mostly it is something like 256 or 1024 characters.
|
||||
@@ -894,6 +895,10 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
"screen.linux", "cygwin" or "putty", or $COLORFGBG suggests a dark
|
||||
background. Otherwise the default is "light".
|
||||
|
||||
The |:terminal| command and the |term_start()| function use the
|
||||
'background' value to decide whether the terminal window will start
|
||||
with a white or black background.
|
||||
|
||||
Normally this option would be set in the .vimrc file. Possibly
|
||||
depending on the terminal name. Example: >
|
||||
:if &term == "pcterm"
|
||||
@@ -4164,7 +4169,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
x:PmenuSbar,X:PmenuThumb,*:TabLine,
|
||||
#:TabLineSel,_:TabLineFill,!:CursorColumn,
|
||||
.:CursorLine,o:ColorColumn,q:QuickFixLine,
|
||||
$:StatusLineTerm")
|
||||
z:StatusLineTerm,Z:StatusLineTermNC")
|
||||
global
|
||||
{not in Vi}
|
||||
This option can be used to set highlighting mode for various
|
||||
@@ -4223,6 +4228,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
s standout (termcap entry "so" and "se")
|
||||
u underline (termcap entry "us" and "ue")
|
||||
c undercurl (termcap entry "Cs" and "Ce")
|
||||
t strikethrough (termcap entry "Ts" and "Te")
|
||||
n no highlighting
|
||||
- no highlighting
|
||||
: use a highlight group
|
||||
@@ -4475,6 +4481,23 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
<
|
||||
NOTE: This function is invoked very often. Keep it fast.
|
||||
|
||||
*'imstyle'* *'imst'*
|
||||
'imstyle' 'imst' number (default 1)
|
||||
global
|
||||
{not in Vi}
|
||||
{only available when compiled with |+xim| and
|
||||
|+GUI_GTK|}
|
||||
This option specifies the input style of Input Method.
|
||||
Set to zero if you want to use on-the-spot style.
|
||||
Set to one if you want to use over-the-spot style.
|
||||
See: |xim-input-style|
|
||||
|
||||
For a long time on-the-spot sytle had been used in GTK version of vim,
|
||||
however, it is known that it causes troubles when using mappings,
|
||||
|single-repeat|, etc. Therefore over-the-spot style becomes the
|
||||
default now. This should work fine for most people, however if you
|
||||
have any problem with it, try using on-the-spot style.
|
||||
|
||||
*'include'* *'inc'*
|
||||
'include' 'inc' string (default "^\s*#\s*include")
|
||||
global or local to buffer |global-local|
|
||||
@@ -5885,18 +5908,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
< Replace the ';' with a ':' or whatever separator is used. Note that
|
||||
this doesn't work when $INCL contains a comma or white space.
|
||||
|
||||
*'perldll'*
|
||||
'perldll' string (default depends on the build)
|
||||
global
|
||||
{not in Vi}
|
||||
{only available when compiled with the |+perl/dyn|
|
||||
feature}
|
||||
Specifies the name of the Perl shared library. The default is
|
||||
DYNAMIC_PERL_DLL, which was specified at compile time.
|
||||
Environment variables are expanded |:set_env|.
|
||||
This option cannot be set from a |modeline| or in the |sandbox|, for
|
||||
security reasons.
|
||||
|
||||
*'preserveindent'* *'pi'* *'nopreserveindent'* *'nopi'*
|
||||
'preserveindent' 'pi' boolean (default off)
|
||||
local to buffer
|
||||
@@ -9038,6 +9049,20 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
large number, it will cause errors when opening more than a few
|
||||
windows. A value of 0 to 12 is reasonable.
|
||||
|
||||
*'winptydll'*
|
||||
'winptydll' string (default "winpty32.dll" or "winpty64.dll")
|
||||
global
|
||||
{not in Vi}
|
||||
{only available when compiled with the |terminal|
|
||||
feature on MS-Windows}
|
||||
Specifies the name of the winpty shared library, used for the
|
||||
|:terminal| command. The default depends on whether was build as a
|
||||
32-bit or 64-bit executable. If not found, "winpty.dll" is tried as
|
||||
a fallback.
|
||||
Environment variables are expanded |:set_env|.
|
||||
This option cannot be set from a |modeline| or in the |sandbox|, for
|
||||
security reasons.
|
||||
|
||||
*'winwidth'* *'wiw'* *E592*
|
||||
'winwidth' 'wiw' number (default 20)
|
||||
global
|
||||
|
||||
@@ -44,6 +44,18 @@ From inside Vim an easy way to run a command and handle the output is with the
|
||||
The 'errorformat' option should be set to match the error messages from your
|
||||
compiler (see |errorformat| below).
|
||||
|
||||
*quickfix-ID*
|
||||
Each quickfix list has a unique identifier called the quickfix ID and this
|
||||
number will not change within a Vim session. The getqflist() function can be
|
||||
used to get the identifier assigned to a list.
|
||||
|
||||
*quickfix-ID*
|
||||
Each quickfix list has a unique identifier called the quickfix ID and this
|
||||
number will not change within a Vim session. The getqflist() function can be
|
||||
used to get the identifier assigned to a list. There is also a quickfix list
|
||||
number which may change whenever more than ten lists are added to a quickfix
|
||||
stack.
|
||||
|
||||
*location-list* *E776*
|
||||
A location list is a window-local quickfix list. You get one after commands
|
||||
like `:lvimgrep`, `:lgrep`, `:lhelpgrep`, `:lmake`, etc., which create a
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*quickref.txt* For Vim version 8.0. Last change: 2017 Aug 01
|
||||
*quickref.txt* For Vim version 8.0. Last change: 2017 Aug 19
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -984,6 +984,7 @@ Short explanation of each option: *option-list*
|
||||
'winfixwidth' 'wfw' keep window width when opening/closing windows
|
||||
'winminheight' 'wmh' minimum number of lines for any window
|
||||
'winminwidth' 'wmw' minimal number of columns for any window
|
||||
'winptydll' name of the winpty dynamic library
|
||||
'winwidth' 'wiw' minimal number of columns for current window
|
||||
'wrap' long lines wrap and continue on the next line
|
||||
'wrapmargin' 'wm' chars from the right where wrapping starts
|
||||
|
||||
+18
-4
@@ -1,4 +1,4 @@
|
||||
*syntax.txt* For Vim version 8.0. Last change: 2017 Jul 14
|
||||
*syntax.txt* For Vim version 8.0. Last change: 2017 Aug 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -2138,6 +2138,16 @@ set "msql_minlines" to the value you desire. Example: >
|
||||
:let msql_minlines = 200
|
||||
|
||||
|
||||
N1QL *n1ql.vim* *ft-n1ql-syntax*
|
||||
|
||||
N1QL is a SQL-like declarative language for manipulating JSON documents in
|
||||
Couchbase Server databases.
|
||||
|
||||
Vim syntax highlights N1QL statements, keywords, operators, types, comments,
|
||||
and special values. Vim ignores syntactical elements specific to SQL or its
|
||||
many dialects, like COLUMN or CHAR, that don't exist in N1QL.
|
||||
|
||||
|
||||
NCF *ncf.vim* *ft-ncf-syntax*
|
||||
|
||||
There is one option for NCF syntax highlighting.
|
||||
@@ -4689,23 +4699,26 @@ the same syntax file on all terminals, and use the optimal highlighting.
|
||||
|
||||
*bold* *underline* *undercurl*
|
||||
*inverse* *italic* *standout*
|
||||
*nocombine* *strikethrough*
|
||||
term={attr-list} *attr-list* *highlight-term* *E418*
|
||||
attr-list is a comma separated list (without spaces) of the
|
||||
following items (in any order):
|
||||
bold
|
||||
underline
|
||||
undercurl not always available
|
||||
strikethrough not always available
|
||||
reverse
|
||||
inverse same as reverse
|
||||
italic
|
||||
standout
|
||||
nocombine override attributes instead of combining them
|
||||
NONE no attributes used (used to reset it)
|
||||
|
||||
Note that "bold" can be used here and by using a bold font. They
|
||||
have the same effect.
|
||||
"undercurl" is a curly underline. When "undercurl" is not possible
|
||||
then "underline" is used. In general "undercurl" is only available in
|
||||
the GUI. The color is set with |highlight-guisp|.
|
||||
then "underline" is used. In general "undercurl" and "strikethrough"
|
||||
is only available in the GUI. The color is set with |highlight-guisp|.
|
||||
|
||||
start={term-list} *highlight-start* *E422*
|
||||
stop={term-list} *term-list* *highlight-stop*
|
||||
@@ -4870,7 +4883,8 @@ guifg={color-name} *highlight-guifg*
|
||||
guibg={color-name} *highlight-guibg*
|
||||
guisp={color-name} *highlight-guisp*
|
||||
These give the foreground (guifg), background (guibg) and special
|
||||
(guisp) color to use in the GUI. "guisp" is used for undercurl.
|
||||
(guisp) color to use in the GUI. "guisp" is used for undercurl and
|
||||
strikethrough.
|
||||
There are a few special names:
|
||||
NONE no color (transparent)
|
||||
bg use normal background color
|
||||
|
||||
+25
-1
@@ -764,7 +764,6 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
'path' options.txt /*'path'*
|
||||
'pdev' options.txt /*'pdev'*
|
||||
'penc' options.txt /*'penc'*
|
||||
'perldll' options.txt /*'perldll'*
|
||||
'pex' options.txt /*'pex'*
|
||||
'pexpr' options.txt /*'pexpr'*
|
||||
'pfn' options.txt /*'pfn'*
|
||||
@@ -955,6 +954,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
't_Co' term.txt /*'t_Co'*
|
||||
't_Cs' term.txt /*'t_Cs'*
|
||||
't_DL' term.txt /*'t_DL'*
|
||||
't_EC' term.txt /*'t_EC'*
|
||||
't_EI' term.txt /*'t_EI'*
|
||||
't_F1' term.txt /*'t_F1'*
|
||||
't_F2' term.txt /*'t_F2'*
|
||||
@@ -992,11 +992,15 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
't_PS' term.txt /*'t_PS'*
|
||||
't_RB' term.txt /*'t_RB'*
|
||||
't_RI' term.txt /*'t_RI'*
|
||||
't_RS' term.txt /*'t_RS'*
|
||||
't_RV' term.txt /*'t_RV'*
|
||||
't_SC' term.txt /*'t_SC'*
|
||||
't_SH' term.txt /*'t_SH'*
|
||||
't_SI' term.txt /*'t_SI'*
|
||||
't_SR' term.txt /*'t_SR'*
|
||||
't_Sb' term.txt /*'t_Sb'*
|
||||
't_Sf' term.txt /*'t_Sf'*
|
||||
't_VS' term.txt /*'t_VS'*
|
||||
't_WP' term.txt /*'t_WP'*
|
||||
't_WS' term.txt /*'t_WS'*
|
||||
't_ZH' term.txt /*'t_ZH'*
|
||||
@@ -1189,6 +1193,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
'winheight' options.txt /*'winheight'*
|
||||
'winminheight' options.txt /*'winminheight'*
|
||||
'winminwidth' options.txt /*'winminwidth'*
|
||||
'winptydll' options.txt /*'winptydll'*
|
||||
'winwidth' options.txt /*'winwidth'*
|
||||
'wiv' options.txt /*'wiv'*
|
||||
'wiw' options.txt /*'wiw'*
|
||||
@@ -1339,6 +1344,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
+tcl various.txt /*+tcl*
|
||||
+tcl/dyn various.txt /*+tcl\/dyn*
|
||||
+termguicolors various.txt /*+termguicolors*
|
||||
+terminal various.txt /*+terminal*
|
||||
+terminfo various.txt /*+terminfo*
|
||||
+termresponse various.txt /*+termresponse*
|
||||
+textobjects various.txt /*+textobjects*
|
||||
@@ -4590,6 +4596,8 @@ E943 message.txt /*E943*
|
||||
E944 pattern.txt /*E944*
|
||||
E945 pattern.txt /*E945*
|
||||
E946 terminal.txt /*E946*
|
||||
E947 terminal.txt /*E947*
|
||||
E948 terminal.txt /*E948*
|
||||
E95 message.txt /*E95*
|
||||
E96 diff.txt /*E96*
|
||||
E97 diff.txt /*E97*
|
||||
@@ -6194,6 +6202,7 @@ ft-mathematica-syntax syntax.txt /*ft-mathematica-syntax*
|
||||
ft-mma-syntax syntax.txt /*ft-mma-syntax*
|
||||
ft-moo-syntax syntax.txt /*ft-moo-syntax*
|
||||
ft-msql-syntax syntax.txt /*ft-msql-syntax*
|
||||
ft-n1ql-syntax syntax.txt /*ft-n1ql-syntax*
|
||||
ft-nasm-syntax syntax.txt /*ft-nasm-syntax*
|
||||
ft-ncf-syntax syntax.txt /*ft-ncf-syntax*
|
||||
ft-nroff-syntax syntax.txt /*ft-nroff-syntax*
|
||||
@@ -7474,6 +7483,7 @@ mzscheme-vim if_mzsch.txt /*mzscheme-vim*
|
||||
mzscheme-vimext if_mzsch.txt /*mzscheme-vimext*
|
||||
mzscheme-window if_mzsch.txt /*mzscheme-window*
|
||||
n pattern.txt /*n*
|
||||
n1ql.vim syntax.txt /*n1ql.vim*
|
||||
nasm.vim syntax.txt /*nasm.vim*
|
||||
navigation motion.txt /*navigation*
|
||||
nb-commands netbeans.txt /*nb-commands*
|
||||
@@ -7817,6 +7827,7 @@ no-type-checking eval.txt /*no-type-checking*
|
||||
no_buffers_menu gui.txt /*no_buffers_menu*
|
||||
no_mail_maps filetype.txt /*no_mail_maps*
|
||||
no_plugin_maps filetype.txt /*no_plugin_maps*
|
||||
nocombine syntax.txt /*nocombine*
|
||||
non-greedy pattern.txt /*non-greedy*
|
||||
non-zero-arg eval.txt /*non-zero-arg*
|
||||
none-variable eval.txt /*none-variable*
|
||||
@@ -8635,11 +8646,14 @@ t_AL term.txt /*t_AL*
|
||||
t_BD term.txt /*t_BD*
|
||||
t_BE term.txt /*t_BE*
|
||||
t_CS term.txt /*t_CS*
|
||||
t_CTRL-W_CTRL-C terminal.txt /*t_CTRL-W_CTRL-C*
|
||||
t_CTRL-\_CTRL-N terminal.txt /*t_CTRL-\\_CTRL-N*
|
||||
t_CV term.txt /*t_CV*
|
||||
t_Ce term.txt /*t_Ce*
|
||||
t_Co term.txt /*t_Co*
|
||||
t_Cs term.txt /*t_Cs*
|
||||
t_DL term.txt /*t_DL*
|
||||
t_EC term.txt /*t_EC*
|
||||
t_EI term.txt /*t_EI*
|
||||
t_F1 term.txt /*t_F1*
|
||||
t_F2 term.txt /*t_F2*
|
||||
@@ -8677,11 +8691,15 @@ t_PE term.txt /*t_PE*
|
||||
t_PS term.txt /*t_PS*
|
||||
t_RB term.txt /*t_RB*
|
||||
t_RI term.txt /*t_RI*
|
||||
t_RS term.txt /*t_RS*
|
||||
t_RV term.txt /*t_RV*
|
||||
t_SC term.txt /*t_SC*
|
||||
t_SH term.txt /*t_SH*
|
||||
t_SI term.txt /*t_SI*
|
||||
t_SR term.txt /*t_SR*
|
||||
t_Sb term.txt /*t_Sb*
|
||||
t_Sf term.txt /*t_Sf*
|
||||
t_VS term.txt /*t_VS*
|
||||
t_WP term.txt /*t_WP*
|
||||
t_WS term.txt /*t_WS*
|
||||
t_ZH term.txt /*t_ZH*
|
||||
@@ -8894,16 +8912,21 @@ temp-file-name eval.txt /*temp-file-name*
|
||||
tempfile change.txt /*tempfile*
|
||||
template autocmd.txt /*template*
|
||||
tempname() eval.txt /*tempname()*
|
||||
term++close terminal.txt /*term++close*
|
||||
term++open terminal.txt /*term++open*
|
||||
term-dependent-settings term.txt /*term-dependent-settings*
|
||||
term-list syntax.txt /*term-list*
|
||||
term.txt term.txt /*term.txt*
|
||||
term_getaltscreen() eval.txt /*term_getaltscreen()*
|
||||
term_getattr() eval.txt /*term_getattr()*
|
||||
term_getcursor() eval.txt /*term_getcursor()*
|
||||
term_getjob() eval.txt /*term_getjob()*
|
||||
term_getline() eval.txt /*term_getline()*
|
||||
term_getscrolled() eval.txt /*term_getscrolled()*
|
||||
term_getsize() eval.txt /*term_getsize()*
|
||||
term_getstatus() eval.txt /*term_getstatus()*
|
||||
term_gettitle() eval.txt /*term_gettitle()*
|
||||
term_gettty() eval.txt /*term_gettty()*
|
||||
term_list() eval.txt /*term_list()*
|
||||
term_scrape() eval.txt /*term_scrape()*
|
||||
term_sendkeys() eval.txt /*term_sendkeys()*
|
||||
@@ -8919,6 +8942,7 @@ termcap-title term.txt /*termcap-title*
|
||||
terminal terminal.txt /*terminal*
|
||||
terminal-colors os_unix.txt /*terminal-colors*
|
||||
terminal-debug terminal.txt /*terminal-debug*
|
||||
terminal-functions usr_41.txt /*terminal-functions*
|
||||
terminal-info term.txt /*terminal-info*
|
||||
terminal-key-codes term.txt /*terminal-key-codes*
|
||||
terminal-options term.txt /*terminal-options*
|
||||
|
||||
+25
-2
@@ -1,4 +1,4 @@
|
||||
*term.txt* For Vim version 8.0. Last change: 2017 Jul 21
|
||||
*term.txt* For Vim version 8.0. Last change: 2017 Aug 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -301,7 +301,7 @@ OUTPUT CODES *terminal-output-codes*
|
||||
t_vb visual bell *t_vb* *'t_vb'*
|
||||
t_ve cursor visible *t_ve* *'t_ve'*
|
||||
t_vi cursor invisible *t_vi* *'t_vi'*
|
||||
t_vs cursor very visible *t_vs* *'t_vs'*
|
||||
t_vs cursor very visible (blink) *t_vs* *'t_vs'*
|
||||
*t_xs* *'t_xs'*
|
||||
t_xs if non-empty, standout not erased by overwriting (hpterm)
|
||||
*t_xn* *'t_xn'*
|
||||
@@ -316,6 +316,7 @@ Added by Vim (there are no standard codes for these):
|
||||
t_WP set window position (Y, X) in pixels *t_WP* *'t_WP'*
|
||||
t_GP get window position (Y, X) in pixels *t_GP* *'t_GP'*
|
||||
t_WS set window size (height, width in cells) *t_WS* *'t_WS'*
|
||||
t_VS cursor normally visible (no blink) *t_VS* *'t_VS'*
|
||||
t_SI start insert mode (bar cursor shape) *t_SI* *'t_SI'*
|
||||
t_SR start replace mode (underline cursor shape) *t_SR* *'t_SR'*
|
||||
t_EI end insert or replace mode (block cursor shape) *t_EI* *'t_EI'*
|
||||
@@ -333,6 +334,28 @@ Added by Vim (there are no standard codes for these):
|
||||
|xterm-bracketed-paste|
|
||||
t_BD disable bracketed paste mode *t_BD* *'t_BD'*
|
||||
|xterm-bracketed-paste|
|
||||
t_SC set cursor color start *t_SC* *'t_SC'*
|
||||
t_EC set cursor color end *t_EC* *'t_EC'*
|
||||
t_SH set cursor shape *t_SH* *'t_SH'*
|
||||
t_RS request terminal cursor style *t_RS* *'t_RS'*
|
||||
|
||||
Some codes have a start, middle and end part. The start and end are defined
|
||||
by the termcap option, the middle part is text.
|
||||
set title text: t_ts {title text} t_fs
|
||||
set icon text: t_IS {icon text} t_IE
|
||||
set cursor color: t_SC {color name} t_EC
|
||||
|
||||
t_SH must take one argument:
|
||||
0, 1 or none blinking block cursor
|
||||
2 block cursor
|
||||
3 blinking underline cursor
|
||||
4 underline cursor
|
||||
5 blinking vertical bar cursor
|
||||
6 vertical bar cursor
|
||||
|
||||
t_RS is sent only if the response to t_RV has been received. It is not used
|
||||
on Mac OS when Terminal.app could be recognized from the termresponse.
|
||||
|
||||
|
||||
KEY CODES *terminal-key-codes*
|
||||
Note: Use the <> form if possible
|
||||
|
||||
+221
-48
@@ -1,4 +1,4 @@
|
||||
*terminal.txt* For Vim version 8.0. Last change: 2017 Aug 05
|
||||
*terminal.txt* For Vim version 8.0. Last change: 2017 Sep 10
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -19,6 +19,9 @@ If the result is "1" you have it.
|
||||
3. Debugging |terminal-debug|
|
||||
|
||||
{Vi does not have any of these commands}
|
||||
{only available when compiled with the |+terminal| feature}
|
||||
|
||||
The terminal feature requires the |+multi_byte|, |+job| and |+channel| features.
|
||||
|
||||
==============================================================================
|
||||
1. Basic use *terminal-use*
|
||||
@@ -27,16 +30,16 @@ This feature is for running a terminal emulator in a Vim window. A job can be
|
||||
started connected to the terminal emulator. For example, to run a shell: >
|
||||
:term bash
|
||||
|
||||
Or to run a debugger: >
|
||||
:term gdb vim
|
||||
Or to run build command: >
|
||||
:term make myprogram
|
||||
|
||||
The job runs asynchronously from Vim, the window will be updated to show
|
||||
output from the job, also while editing in any other window.
|
||||
output from the job, also while editing in another window.
|
||||
|
||||
|
||||
Typing ~
|
||||
|
||||
When the keyboard focus is in the terminal window, typed keys will be send to
|
||||
When the keyboard focus is in the terminal window, typed keys will be sent to
|
||||
the job. This uses a pty when possible. You can click outside of the
|
||||
terminal window to move keyboard focus elsewhere.
|
||||
|
||||
@@ -47,10 +50,12 @@ See |CTRL-W| for more commands.
|
||||
|
||||
Special in the terminal window: *CTRL-W_.* *CTRL-W_N*
|
||||
CTRL-W . send a CTRL-W to the job in the terminal
|
||||
CTRL-W N go to Terminal Normal mode, see |Terminal-mode|
|
||||
CTRL-W N go to Terminal-Normal mode, see |Terminal-mode|
|
||||
CTRL-\ CTRL-N go to Terminal-Normal mode, see |Terminal-mode|
|
||||
CTRL-W " {reg} paste register {reg} *CTRL-W_quote*
|
||||
Also works with the = register to insert the result of
|
||||
evaluating an expression.
|
||||
CTRL-W CTRL-C ends the job, see below |t_CTRL-W_CTRL-C|
|
||||
|
||||
See option 'termkey' for specifying another key instead of CTRL-W that
|
||||
will work like CTRL-W. However, typing 'termkey' twice sends 'termkey' to
|
||||
@@ -61,43 +66,111 @@ the job. For example:
|
||||
'termkey' . send a CTRL-W to the job in the terminal
|
||||
'termkey' N go to terminal Normal mode, see below
|
||||
'termkey' CTRL-N same as CTRL-W N
|
||||
'termkey' CTRL-C same as |t_CTRL-W_CTRL-C|
|
||||
*t_CTRL-\_CTRL-N*
|
||||
The special key combination CTRL-\ CTRL-N can be used to prefix one Normal
|
||||
mode command. This is especially useful for remote commands, when you don't
|
||||
know whether Vim currently has focus in a terminal window. Note that only one
|
||||
Normal mode command can be used.
|
||||
The special key combination CTRL-\ CTRL-N can be used to switch to Normal
|
||||
mode, just like this works in any other mode.
|
||||
*t_CTRL-W_CTRL-C*
|
||||
CTRL-W CTRL-C can be typed to forcefully end the job. On MS-Windows a
|
||||
CTRL-BREAK will also kill the job.
|
||||
|
||||
If you type CTRL-C the effect depends on what the pty has been configured to
|
||||
do. For simple commands this causes a SIGINT to be sent to the job, which
|
||||
would end it. Other commands may ignore the SIGINT or handle the CTRL-C
|
||||
themselves (like Vim does).
|
||||
|
||||
|
||||
Size ~
|
||||
Size and color ~
|
||||
|
||||
See option 'termsize' for controlling the size of the terminal window.
|
||||
(TODO: scrolling when the terminal is larger than the window)
|
||||
|
||||
The terminal uses the 'background' option to decide whether the terminal
|
||||
window will start with a white or black background. The job running in the
|
||||
terminal can change the colors.
|
||||
|
||||
|
||||
Syntax ~
|
||||
|
||||
:ter[minal] [command] *:ter* *:terminal*
|
||||
:[range]ter[minal] [options] [command] *:ter* *:terminal*
|
||||
Open a new terminal window.
|
||||
|
||||
If [command] is provided run it as a job and connect
|
||||
the input and output to the terminal.
|
||||
If [command] is not given the 'shell' option is used.
|
||||
if [command] is NONE no job is started, the pty of the
|
||||
terminal can be used by a command like gdb.
|
||||
|
||||
A new buffer will be created, using [command] or
|
||||
'shell' as the name, prefixed with a "!". If a buffer
|
||||
by this name already exists a number is added in
|
||||
parenthesis. E.g. if "gdb" exists the second terminal
|
||||
parentheses. E.g. if "gdb" exists the second terminal
|
||||
buffer will use "!gdb (1)".
|
||||
|
||||
When the buffer associated with the terminal is wiped out the job is killed,
|
||||
similar to calling `job_stop(job, "kill")`
|
||||
If [range] is given the specified lines are used as
|
||||
input for the job. It will not be possible to type
|
||||
keys in the terminal window. For MS-Windows see the
|
||||
++eof argument below.
|
||||
|
||||
By default the 'bufhidden' option of the buffer will be set to "hide".
|
||||
So long as the job is running: If the window is closed the buffer becomes
|
||||
hidden. The command will not be stopped. The `:buffer` command can be used
|
||||
to turn the current window into a terminal window. If there are unsaved
|
||||
changes this fails, use ! to force, as usual.
|
||||
*E947*
|
||||
Two comma separated numbers are used as "rows,cols".
|
||||
E.g. `:24,80gdb` opens a terminal with 24 rows and 80
|
||||
columns. However, if the terminal window spans the
|
||||
Vim window with, there is no vertical split, the Vim
|
||||
window width is used.
|
||||
*term++close* *term++open*
|
||||
Supported [options] are:
|
||||
++close The terminal window will close
|
||||
automatically when the job terminates.
|
||||
++open When the job terminates and no window
|
||||
shows it, a window will be opened.
|
||||
Note that this can be interruptive.
|
||||
++curwin Open the terminal in the current
|
||||
window, do not split the current
|
||||
window. Fails if the current buffer
|
||||
cannot be |abandon|ed.
|
||||
++hidden Open the terminal in a hidden buffer,
|
||||
no window will be used.
|
||||
++rows={height} Use {height} for the terminal window
|
||||
height.
|
||||
++cols={width} Use {width} for the terminal window
|
||||
width.
|
||||
++eof={text} when using [range]: text to send after
|
||||
the last line was written. Cannot
|
||||
contain white space. A CR is
|
||||
appended. For MS-Windows the default
|
||||
is to send CTRL-D.
|
||||
E.g. for a shell use "++eof=exit" and
|
||||
for Python "++eof=exit()". Special
|
||||
codes can be used like with `:map`,
|
||||
e.g. "<C-Z>" for CTRL-Z.
|
||||
|
||||
If you want to use more options use the |term_start()|
|
||||
function.
|
||||
|
||||
When the buffer associated with the terminal is unloaded or wiped out the job
|
||||
is killed, similar to calling `job_stop(job, "kill")`
|
||||
|
||||
So long as the job is running the window behaves like it contains a modified
|
||||
buffer. Trying to close the window with `CTRL-W :quit` fails. When using
|
||||
`CTRL-W :quit!` the job is ended. The text in the window is lost. The buffer
|
||||
still exists, but getting it in a window with `:buffer` will show an empty
|
||||
buffer.
|
||||
|
||||
Trying to close the window with `CTRL-W :close` also fails. Using
|
||||
`CTRL-W :close!` will close the window and make the buffer hidden.
|
||||
|
||||
You can use `CTRL-W :hide` to close the terminal window and make the buffer
|
||||
hidden, the job keeps running. The `:buffer` command can be used to turn the
|
||||
current window into a terminal window. If there are unsaved changes this
|
||||
fails, use ! to force, as usual.
|
||||
|
||||
To have a background job run without a window, and open the window when it's
|
||||
done, use options like this: >
|
||||
:term ++hidden ++open make
|
||||
Note that the window will open at an unexpected moment, this will interrupt
|
||||
what you are doing.
|
||||
|
||||
*E947* *E948*
|
||||
So long as the job is running, the buffer is considered modified and Vim
|
||||
cannot be quit easily, see |abandon|.
|
||||
|
||||
@@ -133,23 +206,41 @@ terminal. |term_setsize()| can be used only when in the first or second mode,
|
||||
not when 'termsize' is "rowsXcols".
|
||||
|
||||
|
||||
Terminal Normal mode ~
|
||||
Terminal-Job and Terminal-Normal mode ~
|
||||
*Terminal-mode*
|
||||
When the job is running the contents of the terminal is under control of the
|
||||
job. That includes the cursor position. The terminal contents can change at
|
||||
any time.
|
||||
job. That includes the cursor position. Typed keys are sent to the job.
|
||||
The terminal contents can change at any time. This is called Terminal-Job
|
||||
mode.
|
||||
|
||||
Use CTRL-W N (or 'termkey' N) to go to Terminal Normal mode. Now the contents
|
||||
of the terminal window is under control of Vim, the job output is suspended.
|
||||
Use CTRL-W N (or 'termkey' N) to switch to Terminal-Normal mode. Now the
|
||||
contents of the terminal window is under control of Vim, the job output is
|
||||
suspended. CTRL-\ CTRL-N does the same.
|
||||
*E946*
|
||||
In this mode you can move the cursor around with the usual Vim commands,
|
||||
Visually mark text, yank text, etc. But you cannot change the contents of the
|
||||
buffer. The commands that would start insert mode, such as 'i' and 'a',
|
||||
return control of the window to the job. Any pending output will now be
|
||||
displayed.
|
||||
In Terminal-Normal mode you can move the cursor around with the usual Vim
|
||||
commands, Visually mark text, yank text, etc. But you cannot change the
|
||||
contents of the buffer. The commands that would start insert mode, such as
|
||||
'i' and 'a', return to Terminal-Job mode. The window will be updated to show
|
||||
the contents of the terminal.
|
||||
|
||||
In Terminal mode the statusline and window title show "(Terminal)". If the
|
||||
job ends while in Terminal mode this changes to "(Terminal-finished)".
|
||||
In Terminal-Normal mode the statusline and window title show "(Terminal)". If
|
||||
the job ends while in Terminal-Normal mode this changes to
|
||||
"(Terminal-finished)".
|
||||
|
||||
It is not possible to enter Insert mode from Terminal-Job mode.
|
||||
|
||||
|
||||
Cursor style ~
|
||||
|
||||
By default the cursor in the terminal window uses a not blinking block. The
|
||||
normal xterm escape sequences can be used to change the blinking state and the
|
||||
shape. Once focus leaves the terminal window Vim will restore the original
|
||||
cursor.
|
||||
|
||||
An exception is when xterm is started with the "-bc" argument, or another way
|
||||
that causes the cursor to blink. This actually means that the blinking flag
|
||||
is inverted. Since Vim cannot detect this, the terminal window cursor
|
||||
blinking will also be inverted.
|
||||
|
||||
|
||||
Unix ~
|
||||
@@ -190,7 +281,10 @@ You can download them from the following page:
|
||||
|
||||
https://github.com/rprichard/winpty
|
||||
|
||||
Just put the files somewhere in your PATH.
|
||||
Just put the files somewhere in your PATH. You can set the 'winptydll' option
|
||||
to point to the right file, if needed. If you have both the 32-bit and 64-bit
|
||||
version, rename to winpty32.dll and winpty64.dll to match the way Vim was
|
||||
build.
|
||||
|
||||
==============================================================================
|
||||
2. Remote testing *terminal-testing*
|
||||
@@ -211,25 +305,104 @@ term_scrape() inspect terminal screen
|
||||
3. Debugging *terminal-debug*
|
||||
|
||||
The Terminal debugging plugin can be used to debug a program with gdb and view
|
||||
the source code in a Vim window. For example: >
|
||||
the source code in a Vim window. Since this is completely contained inside
|
||||
Vim this also works remotely over an ssh connection.
|
||||
|
||||
|
||||
Starting ~
|
||||
|
||||
Load the plugin with this command: >
|
||||
packadd termdebug
|
||||
< *:Termdebug*
|
||||
To start debugging use `:TermDebug` folowed by the command name, for example: >
|
||||
:TermDebug vim
|
||||
|
||||
This opens three windows:
|
||||
- A terminal window in which "gdb vim" is executed. Here you can directly
|
||||
interact with gdb.
|
||||
- A terminal window for the executed program. When "run" is used in gdb the
|
||||
program I/O will happen in this window, so that it does not interfere with
|
||||
controlling gdb.
|
||||
- A normal Vim window used to show the source code. When gdb jumps to a
|
||||
source file location this window will display the code, if possible. Values
|
||||
of variables can be inspected, breakpoints set and cleared, etc.
|
||||
This opens two windows:
|
||||
gdb window A terminal window in which "gdb vim" is executed. Here you
|
||||
can directly interact with gdb. The buffer name is "!gdb".
|
||||
program window A terminal window for the executed program. When "run" is
|
||||
used in gdb the program I/O will happen in this window, so
|
||||
that it does not interfere with controlling gdb. The buffer
|
||||
name is "gdb program".
|
||||
|
||||
This uses two terminal windows. To open the gdb window: >
|
||||
:term gdb [arguments]
|
||||
To open the terminal to run the tested program |term_start()| is used.
|
||||
The current window is used to show the source code. When gdb pauses the
|
||||
source file location will be displayed, if possible. A sign is used to
|
||||
highlight the current position (using highlight group debugPC).
|
||||
|
||||
If the buffer in the current window is modified, another window will be opened
|
||||
to display the current gdb position.
|
||||
|
||||
Focus the terminal of the executed program to interact with it. This works
|
||||
the same as any command running in a terminal window.
|
||||
|
||||
When the debugger ends, typically by typing "quit" in the gdb window, the two
|
||||
opened windows are closed.
|
||||
|
||||
|
||||
Stepping through code ~
|
||||
|
||||
Put focus on the gdb window to type commands there. Some common ones are:
|
||||
- CTRL-C interrupt the program
|
||||
- next execute the current line and stop at the next line
|
||||
- step execute the current line and stop at the next statement, entering
|
||||
functions
|
||||
- finish execute until leaving the current function
|
||||
- where show the stack
|
||||
- frame N go to the Nth stack frame
|
||||
- continue continue execution
|
||||
|
||||
In the window showing the source code some commands can used to control gdb:
|
||||
:Break set a breakpoint at the current line; a sign will be displayed
|
||||
:Delete delete a breakpoint at the current line
|
||||
:Step execute the gdb "step" command
|
||||
:Over execute the gdb "next" command (:Next is a Vim command)
|
||||
:Finish execute the gdb "finish" command
|
||||
:Continue execute the gdb "continue" command
|
||||
|
||||
|
||||
Inspecting variables ~
|
||||
|
||||
:Evaluate evaluate the expression under the cursor
|
||||
K same
|
||||
:Evaluate {expr} evaluate {expr}
|
||||
:'<,'>Evaluate evaluate the Visually selected text
|
||||
|
||||
This is similar to using "print" in the gdb window.
|
||||
|
||||
|
||||
Other commands ~
|
||||
|
||||
:Gdb jump to the gdb window
|
||||
:Program jump to the window with the running program
|
||||
|
||||
|
||||
Communication ~
|
||||
|
||||
There is another, hidden, buffer, which is used for Vim to communicate with
|
||||
gdb. The buffer name is "gdb communication". Do not delete this buffer, it
|
||||
will break the debugger.
|
||||
|
||||
|
||||
Customizing ~
|
||||
|
||||
To change the name of the gdb command, set the "termdebugger" variable before
|
||||
invoking `:Termdebug`: >
|
||||
let termdebugger = "mygdb"
|
||||
Only debuggers fully compatible with gdb will work. Vim uses the GDB/MI
|
||||
interface.
|
||||
|
||||
The color of the signs can be adjusted with these highlight groups:
|
||||
- debugPC the current position
|
||||
- debugBreakpoint a breakpoint
|
||||
|
||||
The defaults are, when 'background' is "light":
|
||||
hi debugPC term=reverse ctermbg=lightblue guibg=lightblue
|
||||
hi debugBreakpoint term=reverse ctermbg=red guibg=red
|
||||
|
||||
When 'background' is "dark":
|
||||
hi debugPC term=reverse ctermbg=darkblue guibg=darkblue
|
||||
hi debugBreakpoint term=reverse ctermbg=red guibg=red
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
||||
+83
-47
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 8.0. Last change: 2017 Aug 01
|
||||
*todo.txt* For Vim version 8.0. Last change: 2017 Aug 27
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -35,34 +35,32 @@ entered there will not be repeated below, unless there is extra information.
|
||||
*known-bugs*
|
||||
-------------------- Known bugs and current work -----------------------
|
||||
|
||||
Check out coverity reports.
|
||||
|
||||
No maintainer for Vietnamese translations.
|
||||
No maintainer for Simplified Chinese translations.
|
||||
|
||||
|
||||
Terminal emulator window:
|
||||
- Lots of stuff to implement, see src/terminal.c
|
||||
- Running a shell command from the GUI still has limitations. Look into how
|
||||
the terminal emulator of the Vim shell project can help:
|
||||
http://code.hootsuite.com/vimshell/
|
||||
- Add winpty.dll and winpty-agent.exe in the NSIS build.
|
||||
- Add debugger interface. Implementation for gdb by Xavier de Gaye. Should
|
||||
work like an IDE. Try to keep it generic. Now found here:
|
||||
http://clewn.sf.net.
|
||||
Can this replace Agide? http://www.a-a-p.org/images/debugfull.png
|
||||
- make showballoon() work in a terminal. Requires getting mouse-move
|
||||
events.
|
||||
- send 'balloonText' events for the cursor position (using CursorHold ?)
|
||||
in terminal mode.
|
||||
- Implement the right-click popup menu for the terminal. Can use the
|
||||
completion popup menu code and mouse dragging.
|
||||
- Look into the idevim plugin/script.
|
||||
- Related wishes for NetBeans commands:
|
||||
- make it possible to have 'defineAnnoType' also handle terminal colors.
|
||||
- send 'balloonText' events for the cursor position (using CursorHold ?)
|
||||
in terminal mode.
|
||||
|
||||
+channel:
|
||||
- Try out background make plugin:
|
||||
https://github.com/AndrewVos/vim-make-background
|
||||
- Problem with stderr on Windows? (Vincent Rischmann, 2016 Aug 31, #1026)
|
||||
- Add 'cwd' argument to start_job(): directory to change to in the child.
|
||||
check for valid directory before forking.
|
||||
Part of patch for environment, Yasuhiro Matsumoto, #1160
|
||||
- Writing raw mode to a buffer should still handle NL characters as line
|
||||
breaks. (Dmitry Zotikov, 2017 Aug 16)
|
||||
- When out_cb executes :sleep, the close_cb may be invoked. (Daniel Hahler,
|
||||
2016 Dec 11, #1320)
|
||||
- Implement |job-term| ?
|
||||
@@ -77,7 +75,7 @@ Terminal emulator window:
|
||||
Feb 9) How to do this on MS-Windows?
|
||||
- For connection to server, a "keep open" flag would be useful. Retry
|
||||
connecting in the main loop with zero timeout.
|
||||
- job_start(): run job in a newly opened terminal.
|
||||
- job_start(): run job in a newly opened terminal (not a terminal window).
|
||||
With xterm could use -S{pty}.
|
||||
Although user could use "xterm -e 'cmd arg'".
|
||||
|
||||
@@ -125,15 +123,44 @@ Regexp problems:
|
||||
Another one: echom matchstr(" sdfsfsf\n sfdsdfsdf",'[^\n]*')
|
||||
(2017 May 15, #1252)
|
||||
|
||||
test_gui fails with gnome2: cannot create .gnome2 dir
|
||||
use testdir/Xfakehome instead of does/not/exist?
|
||||
Patch to turn test80 into a new style test. (Yegappan Lakshmanan, 2017 Aug 20)
|
||||
|
||||
Patch for quickfix: parse lines for any quickfix list. (Yegappan Lakshmanan,
|
||||
2017 Jul 20)
|
||||
Include a few color schemes, based on popularity:
|
||||
http://www.vim.org/scripts/script_search_results.php?keywords=&script_type=color+scheme&order_by=rating&direction=descending&search=search
|
||||
http://vimawesome.com/?q=tag:color-scheme
|
||||
Use names that indicate their appearnce (Christian Brabandt, 2017 Aug 3)
|
||||
- monokai - Xia Crusoe (2017 Aug 4)
|
||||
- seoul256 - Christian Brabandt (2017 Aug 3)
|
||||
- gruvbox - Christian Brabandt (2017 Aug 3)
|
||||
- janah - Marco Hinz (2017 Aug 4)
|
||||
- apprentice - Romain Lafourcade (2017 Aug 6) remarks about help file #1964
|
||||
Suggested by Hiroki Kokubun:
|
||||
- [Iceberg](https://github.com/cocopon/iceberg.vim) (my one)
|
||||
- [hybrid](https://github.com/w0ng/vim-hybrid)
|
||||
|
||||
When starting with --clean packages under "start" are not loaded. Make this
|
||||
work: :packadd START {name} similar to :runtime START name
|
||||
|
||||
When using :packadd files under "later" are not used, which is inconsistent
|
||||
with packages under "start". (xtal8, #1994)
|
||||
|
||||
After 8.0.0962 pasting leaves the cursor in another position. (Ken Takata,
|
||||
2017 Aug 23, #2015) Also (zdm, 2017 Aug 23)
|
||||
|
||||
Patch to add quickfix list identifier. (Yegappan, 2017 Aug 15)
|
||||
|
||||
Mac Terminal.app: ctermbg=15 gives light grey instead of white.
|
||||
ctermbg=256 breaks clearing till end of the line. Both work fine in xterm.
|
||||
|
||||
Patch to avoid editing a file in the session file twice. (Christian Brabandt,
|
||||
2017 Aug 21) #1958
|
||||
|
||||
With foldmethod=syntax and nofoldenable comment highlighting isn't removed.
|
||||
(Marcin Szewczyk, 2017 Apr 26)
|
||||
|
||||
Using 'wildignore' also applies to literally entered file name. Also with
|
||||
:drop (remote commands).
|
||||
|
||||
ml_get error when using a Python. (Yggdroot, 2017 Jun 1, #1737)
|
||||
Lemonboy can reproduce (2017 Jun 5)
|
||||
|
||||
@@ -141,34 +168,55 @@ ml_get errors with buggy script. (Dominique, 2017 Apr 30)
|
||||
|
||||
Error in emsg with buggy script. (Dominique, 2017 Apr 30)
|
||||
|
||||
Patch for Murphi syntax. (Matthew Fernandez, 2017 Jul 24)
|
||||
Test runtime files.
|
||||
Start with filetype detection: testdir/test_filetype.vim
|
||||
|
||||
Better detection of strace file. (Steven Fernandez, 2017 Jul 12, #1837)
|
||||
Patch to support on-the-spot and over-the-spot input method. (Ken Takata, 2017
|
||||
Feb 14). Also see #1215.
|
||||
|
||||
Bug with conceal mode: 3rd element returned by synconcealed() differs for
|
||||
every call. (Dominique Pelle, 2017 Jun 18)
|
||||
Patch to ignore case when 'diffopt' has "icase" for finding the difference
|
||||
inside a line. (Rick Howe, 2017 Aug 21, 22 with test)
|
||||
|
||||
Patch to support strikethrough next to bold and italic. (Christian Brabandt,
|
||||
2013 Jul 30) Update from Ken Takata, 2013 Oct 12.
|
||||
Update mentioned by Christian, 2016 Apr 25.
|
||||
Update from Ken Takata, 2017 Aug 23.
|
||||
|
||||
Patch to add setbufline(). (email from Yasuhiro Matsumoto, patch by Ozaki
|
||||
Kiichi, 2016 Feb 28)
|
||||
Update Mar 8: https://gist.github.com/mattn/23c1f50999084992ca98
|
||||
Update Mar 13: https://gist.github.com/mattn/23c1f50999084992ca98
|
||||
Update Aug 2017: #1953
|
||||
|
||||
Patch to fix indenting for raw C++ string. (Christian Brabandt, 2017 Aug 24,
|
||||
#2019)
|
||||
|
||||
Add options_default() / options_restore() to set several options to Vim
|
||||
defaults for a plugin. Comments from Zyx, 2017 May 10.
|
||||
Perhaps use a vimcontext / endvimcontext command block.
|
||||
|
||||
Signs drawn on top of messages. (worp, #1907)
|
||||
|
||||
Folds open when job writes to another buffer. (Jonathan Fudger, 2017 Jul 31)
|
||||
Already fixed?
|
||||
Patch to fix bogus characters inserted in visual-block append. (Christian
|
||||
Brabandt, 2017 Aug 23)
|
||||
|
||||
Illegal memory access, requires ASAN to see. (Dominique Pelle, 2015 Jul 28)
|
||||
Still happens (2017 Jul 9)
|
||||
|
||||
When bracketed paste is used, pasting at the ":append" prompt does not get the
|
||||
line breaks. (Ken Takata, 2017 Aug 22)
|
||||
|
||||
This example in the help does not work (Andy Wokula, 2017 Aug 20):
|
||||
augroup mine | au! BufRead | augroup END
|
||||
|
||||
Memory leak in test_arabic.
|
||||
|
||||
Include Haiku port? (Adrien Destugues, Siarzhuk Zharski, 2013 Oct 24)
|
||||
It can replace the BeOS code, which is likely not used anymore.
|
||||
Now on github: #1856. Is now up-to-date?
|
||||
Got permission to include this under the Vim license.
|
||||
|
||||
Refactored HTML indent file. (Michael Lee, #1821)
|
||||
|
||||
Using uninitialzed value in test_crypt.
|
||||
Using uninitialized value in test_crypt.
|
||||
|
||||
Test_writefile_fails_conversion failure on Solaris because if different iconv
|
||||
behavior. Skip when "uname" returns "SunOS"? (Pavel Heimlich, #1872)
|
||||
@@ -185,6 +233,8 @@ Alternatives for ~:
|
||||
@ list@get() harder to read
|
||||
-> list->get() two characters, used for lambda
|
||||
|
||||
The ++ options for the :edit command are also useful on the Vim command line.
|
||||
|
||||
X11: Putting more than about 262040 characters of text on the clipboard and
|
||||
pasting it in another Vim doesn't work. (Dominique Pelle, 2008 Aug 21-23)
|
||||
clip_x11_request_selection_cb() is called with zero value and length.
|
||||
@@ -195,6 +245,10 @@ Kazunobu Kuriyama is working on a proper fix. (2017 Jul 25)
|
||||
|
||||
Problem with three-piece comment. (Michael Lee, 2017 May 11, #1696)
|
||||
|
||||
Creating a partial with an autoload function is confused about the "self"
|
||||
attribute of the function. For an unknown function assume "self" and make
|
||||
that optiona? (Bjorn Linse, 2017 Aug 5)
|
||||
|
||||
Completion mixes results from the current buffer with tags and other files.
|
||||
Happens when typing CTRL-N while still search for results. E.g., type "b_" in
|
||||
terminal.c and then CTRL-N twice.
|
||||
@@ -278,12 +332,7 @@ Still need maplist() to find the mappings. What can we use to identify a
|
||||
mapping? Something unique would be better than the LHS.
|
||||
Perhaps simpler: actually delete the mappings. Use maplist() to list matching
|
||||
mappings (with a lhs prefix, like maparg()), mapdelete() to delete,
|
||||
maprestore() to restore (using the output of maplist().
|
||||
|
||||
Patch to add setbufline(). (email from Yasuhiro Matsumoto, patch by Ozaki
|
||||
Kiichi, 2016 Feb 28)
|
||||
Update Mar 8: https://gist.github.com/mattn/23c1f50999084992ca98
|
||||
Update Mar 13: https://gist.github.com/mattn/23c1f50999084992ca98
|
||||
maprestore() to restore (using the output of maplist()).
|
||||
|
||||
Add an argument to :mkvimrc (or add aother command) to skip mappings from
|
||||
plugins (source is a Vim script). No need to put these in a .vimrc, they will
|
||||
@@ -360,9 +409,6 @@ Implement optional arguments for functions.
|
||||
call Foo(12, all = 0)
|
||||
call Foo(12, 15, 0)
|
||||
|
||||
Patch to support on-the-spot and over-the-spot input method. (Ken Takata, 2017
|
||||
Feb 14).
|
||||
|
||||
Change the Farsi code to work with UTF-8. Possibly combined with the Arabic
|
||||
support, or similar.
|
||||
Invalid read error in Farsi mode. (Dominique Pelle, 2009 Aug 2)
|
||||
@@ -377,11 +423,9 @@ Patch to add random number generator. (Hong Xu, 2010 Nov 8, update Nov 10)
|
||||
Alternative from Christian Brabandt. (2010 Sep 19)
|
||||
New one from Yasuhiro Matsumoto, #1277.
|
||||
|
||||
Patch for restoring wide characters in the console buffer.
|
||||
(Ken Takata, 2016 Jun 7)
|
||||
|
||||
Patch to fix escaping of job arguments. (Yasuhiro Matsumoto, 2016 Oct 5)
|
||||
Update Oct 14: https://gist.github.com/mattn/d47e7d3bfe5ade4be86062b565a4bfca
|
||||
Update Aug 2017: #1954
|
||||
|
||||
Characters deleted on completion. (Adrià Farrés, 2017 Apr 20, #1645)
|
||||
Remarks from Christian Brabandt (Apr 21)
|
||||
@@ -404,7 +448,7 @@ MS-Windows. Perhaps in \# the \ is seen as a path separator. (Axel Bender,
|
||||
2017 Feb 9) Can we expand wildcards first and send the path literally to the
|
||||
receiving Vim? Or make an exception for #, it's not useful remotely.
|
||||
|
||||
":sbr" docs state it respect 'switchbuf', but "vsplit" does not cause a
|
||||
":sbr" docs state it respects 'switchbuf', but "vsplit" does not cause a
|
||||
vertical split. (Haldean Brown, 2017 Mar 1)
|
||||
|
||||
Use ADDR_OTHER instead of ADDR_LINES for many more commands.
|
||||
@@ -604,11 +648,6 @@ Reject the value? #710.
|
||||
Patch to fix increment/decrement not working properly when 'virtualedit' is
|
||||
set. (Hirohito Higashi, 2016 Aug 1, #923)
|
||||
|
||||
Patch to support strikethrough next to bold and italic. (Christian Brabandt,
|
||||
2013 Jul 30) Update from Ken Takata, 2013 Oct 12.
|
||||
Update mentioned by Christian, 2016 Apr 25.
|
||||
Update from Ken Takata, 2016 Jul 17.
|
||||
|
||||
When doing "vi buf.md" a BufNew autocommand for *.md is not triggered.
|
||||
Because of using the initial buffer? (Dun Peal, 2016 May 12)
|
||||
|
||||
@@ -1376,9 +1415,6 @@ Windows keys not set properly on Windows 7? (cncyber, 2010 Aug 26)
|
||||
When using a Vim server, a # in the path causes an error message.
|
||||
(Jeff Lanzarotta, 2011 Feb 17)
|
||||
|
||||
Setting $HOME on MS-Windows is not very well documented. Suggestion by Ben
|
||||
Fritz (2011 Oct 27).
|
||||
|
||||
When there is a ">" in a line that "gq" wraps to the start of the next line,
|
||||
then the following line will pick it up as a leader. Should get the leader
|
||||
from the first line, not a wrapped line. (Matt Ackeret, 2012 Feb 27)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_07.txt* For Vim version 8.0. Last change: 2006 Apr 24
|
||||
*usr_07.txt* For Vim version 8.0. Last change: 2017 Aug 11
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -355,7 +355,7 @@ a sentence to the f register (f for First): >
|
||||
"fyas
|
||||
|
||||
The "yas" command yanks a sentence like before. It's the "f that tells Vim
|
||||
the text should be place in the f register. This must come just before the
|
||||
the text should be placed in the f register. This must come just before the
|
||||
yank command.
|
||||
Now yank three whole lines to the l register (l for line): >
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_08.txt* For Vim version 8.0. Last change: 2014 Jul 06
|
||||
*usr_08.txt* For Vim version 8.0. Last change: 2017 Aug 11
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -45,7 +45,7 @@ top one:
|
||||
+----------------------------------+
|
||||
|
||||
What you see here is two windows on the same file. The line with "====" is
|
||||
that status line. It displays information about the window above it. (In
|
||||
the status line. It displays information about the window above it. (In
|
||||
practice the status line will be in reverse video.)
|
||||
The two windows allow you to view two parts of the same file. For example,
|
||||
you could make the top window show the variable declarations of a program, and
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_09.txt* For Vim version 8.0. Last change: 2006 Apr 24
|
||||
*usr_09.txt* For Vim version 8.0. Last change: 2017 Aug 11
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -60,7 +60,7 @@ THE WINDOW TITLE
|
||||
At the very top is the window title. This is drawn by your window system.
|
||||
Vim will set the title to show the name of the current file. First comes the
|
||||
name of the file. Then some special characters and the directory of the file
|
||||
in parens. These special character can be present:
|
||||
in parens. These special characters can be present:
|
||||
|
||||
- The file cannot be modified (e.g., a help file)
|
||||
+ The file contains changes
|
||||
@@ -206,7 +206,7 @@ the "real clipboard" are called clipboard, you'll have to get used to that.
|
||||
To put text on the real clipboard, select a few different words in one of
|
||||
the gVims you have running. Then use the Edit/Copy menu entry. Now the text
|
||||
has been copied to the real clipboard. You can't see this, unless you have
|
||||
some application that shows the clipboard contents (e.g., KDE's klipper).
|
||||
some application that shows the clipboard contents (e.g., KDE's Klipper).
|
||||
Now select the other gVim, position the cursor somewhere and use the
|
||||
Edit/Paste menu. You will see the text from the real clipboard is inserted.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_12.txt* For Vim version 8.0. Last change: 2007 May 11
|
||||
*usr_12.txt* For Vim version 8.0. Last change: 2017 Aug 11
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -290,7 +290,7 @@ command: >
|
||||
The line range "%" is used, thus this works on the whole file. The pattern
|
||||
that the ":substitute" command matches with is "\s\+$". This finds white
|
||||
space characters (\s), 1 or more of them (\+), before the end-of-line ($).
|
||||
Later will be explained how you write patterns like this |usr_27.txt|.
|
||||
Later will be explained how you write patterns like this, see |usr_27.txt|.
|
||||
The "to" part of the substitute command is empty: "//". Thus it replaces
|
||||
with nothing, effectively deleting the matched white space.
|
||||
|
||||
|
||||
+18
-1
@@ -1,4 +1,4 @@
|
||||
*usr_41.txt* For Vim version 8.0. Last change: 2017 Jul 19
|
||||
*usr_41.txt* For Vim version 8.0. Last change: 2017 Aug 22
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -966,6 +966,23 @@ Jobs: *job-functions*
|
||||
job_info() get information about a job
|
||||
job_setoptions() set options for a job
|
||||
|
||||
Terminal window: *terminal-functions*
|
||||
term_start() open a terminal window and run a job
|
||||
term_list() get the list of terminal buffers
|
||||
term_sendkeys() send keystrokes to a terminal
|
||||
term_wait() wait for screen to be updated
|
||||
term_getjob() get the job associated with a terminal
|
||||
term_scrape() get row of a terminal screen
|
||||
term_getline() get a line of text from a terminal
|
||||
term_getattr() get the value of attribute {what}
|
||||
term_getcursor() get the cursor position of a terminal
|
||||
term_getscrolled() get the scroll count of a terminal
|
||||
term_getaltscreen() get the alternate screen flag
|
||||
term_getsize() get the size of a terminal
|
||||
term_getstatus() get the status of a terminal
|
||||
term_gettitle() get the title of a terminal
|
||||
term_gettty() get the tty name of a terminal
|
||||
|
||||
Timers: *timer-functions*
|
||||
timer_start() create a timer
|
||||
timer_pause() pause or unpause a timer
|
||||
|
||||
@@ -429,6 +429,7 @@ N *+tag_old_static* old method for static tags |tag-old-static|
|
||||
m *+tag_any_white* any white space allowed in tags file |tag-any-white|
|
||||
m *+tcl* Tcl interface |tcl|
|
||||
m *+tcl/dyn* Tcl interface |tcl-dynamic| |/dyn|
|
||||
m *+terminal* Support for terminal window |terminal|
|
||||
*+terminfo* uses |terminfo| instead of termcap
|
||||
N *+termresponse* support for |t_RV| and |v:termresponse|
|
||||
B *+termguicolors* 24-bit color in xterm-compatible terminals support
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
.TH VIM 1 "2006 Apr 11"
|
||||
.SH NAME
|
||||
vim \- Vi IMproved, a programmers text editor
|
||||
vim \- Vi IMproved, a programmer's text editor
|
||||
.SH SYNOPSIS
|
||||
.br
|
||||
.B vim
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ VIM(1) General Commands Manual VIM(1)
|
||||
|
||||
|
||||
NAME
|
||||
vim - Vi IMproved, a programmers text editor
|
||||
vim - Vi IMproved, a programmer's text editor
|
||||
|
||||
SYNOPSIS
|
||||
vim [options] [file ..]
|
||||
|
||||
@@ -314,8 +314,8 @@ Visual-block Insert *v_b_I*
|
||||
With a blockwise selection, I{string}<ESC> will insert {string} at the start
|
||||
of block on every line of the block, provided that the line extends into the
|
||||
block. Thus lines that are short will remain unmodified. TABs are split to
|
||||
retain visual columns.
|
||||
See |v_b_I_example|.
|
||||
retain visual columns. Works only for adding text to a line, not for
|
||||
deletions. See |v_b_I_example|.
|
||||
|
||||
Visual-block Append *v_b_A*
|
||||
With a blockwise selection, A{string}<ESC> will append {string} to the end of
|
||||
@@ -331,6 +331,7 @@ See |v_b_A_example|.
|
||||
Note: "I" and "A" behave differently for lines that don't extend into the
|
||||
selected block. This was done intentionally, so that you can do it the way
|
||||
you want.
|
||||
Works only for adding text to a line, not for deletions.
|
||||
|
||||
Visual-block change *v_b_c*
|
||||
All selected text in the block will be replaced by the same text string. When
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*windows.txt* For Vim version 8.0. Last change: 2017 Jul 23
|
||||
*windows.txt* For Vim version 8.0. Last change: 2017 Aug 21
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -344,8 +344,9 @@ CTRL-W CTRL-C *CTRL-W_CTRL-C*
|
||||
*:hide*
|
||||
:hid[e]
|
||||
:{count}hid[e]
|
||||
Quit the current window, unless it is the last window on the
|
||||
screen. For {count} see |:quit| command.
|
||||
Without {count}: Quit the current window, unless it is the
|
||||
last window on the screen.
|
||||
If {count} is given quit the {count} window.
|
||||
|
||||
The buffer becomes hidden (unless there is another window
|
||||
editing it or 'bufhidden' is "unload", "delete" or "wipe").
|
||||
@@ -1031,6 +1032,8 @@ list of buffers. |unlisted-buffer|
|
||||
displayed in a window |hidden-buffer|
|
||||
- a buffer with 'modifiable' off
|
||||
= a readonly buffer
|
||||
R a terminal buffer with a running job
|
||||
F a terminal buffer with a finished job
|
||||
+ a modified buffer
|
||||
x a buffer with read errors
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim support file to detect file types
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2017 Jul 11
|
||||
" Last Change: 2017 Aug 11
|
||||
|
||||
" Listen very carefully, I will say this only once
|
||||
if exists("did_load_filetypes")
|
||||
@@ -1027,7 +1027,7 @@ au BufNewFile,BufRead *.java,*.jav setf java
|
||||
au BufNewFile,BufRead *.jj,*.jjt setf javacc
|
||||
|
||||
" JavaScript, ECMAScript
|
||||
au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx setf javascript
|
||||
au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx,*.mjs setf javascript
|
||||
|
||||
" Java Server Pages
|
||||
au BufNewFile,BufRead *.jsp setf jsp
|
||||
@@ -1342,6 +1342,9 @@ au BufNewFile,BufRead *.mush setf mush
|
||||
" Mutt setup file (also for Muttng)
|
||||
au BufNewFile,BufRead Mutt{ng,}rc setf muttrc
|
||||
|
||||
" N1QL
|
||||
au BufRead,BufNewfile *.n1ql,*.nql setf n1ql
|
||||
|
||||
" Nano
|
||||
au BufNewFile,BufRead */etc/nanorc,*.nanorc setf nanorc
|
||||
|
||||
@@ -2267,6 +2270,8 @@ func! s:FTtex()
|
||||
elseif format == 'plaintex'
|
||||
let format = 'plain'
|
||||
endif
|
||||
elseif expand('%') =~ 'tex/context/.*/.*.tex'
|
||||
let format = 'context'
|
||||
else
|
||||
" Default value, may be changed later:
|
||||
let format = exists("g:tex_flavor") ? g:tex_flavor : 'plain'
|
||||
@@ -2308,7 +2313,7 @@ func! s:FTtex()
|
||||
endfunc
|
||||
|
||||
" ConTeXt
|
||||
au BufNewFile,BufRead tex/context/*/*.tex,*.mkii,*.mkiv,*.mkvi setf context
|
||||
au BufNewFile,BufRead *.mkii,*.mkiv,*.mkvi setf context
|
||||
|
||||
" Texinfo
|
||||
au BufNewFile,BufRead *.texinfo,*.texi,*.txi setf texinfo
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: Verilog HDL
|
||||
" Maintainer: Chih-Tsun Huang <cthuang@larc.ee.nthu.edu.tw>
|
||||
" Last Change: Wed Sep 3 15:24:49 CST 2008
|
||||
" URL: http://larc.ee.nthu.edu.tw/~cthuang/vim/ftplugin/verilog.vim
|
||||
" Maintainer: Chih-Tsun Huang <cthuang@cs.nthu.edu.tw>
|
||||
" Last Change: 2017 Aug 25 by Chih-Tsun Huang
|
||||
" URL: http://www.cs.nthu.edu.tw/~cthuang/vim/ftplugin/verilog.vim
|
||||
"
|
||||
" Credits:
|
||||
" Suggestions for improvement, bug reports by
|
||||
" Shao <shaominghai2005@163.com>
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
@@ -45,11 +49,16 @@ if exists("loaded_matchit")
|
||||
\ '\<begin\>:\<end\>,' .
|
||||
\ '\<case\>\|\<casex\>\|\<casez\>:\<endcase\>,' .
|
||||
\ '\<module\>:\<endmodule\>,' .
|
||||
\ '\<if\>:\<else\>,' .
|
||||
\ '\<if\>:`\@<!\<else\>,' .
|
||||
\ '\<function\>:\<endfunction\>,' .
|
||||
\ '`ifdef\>:`else\>:`endif\>,' .
|
||||
\ '`ifn\?def\>:`elsif\>:`else\>:`endif\>,' .
|
||||
\ '\<task\>:\<endtask\>,' .
|
||||
\ '\<specify\>:\<endspecify\>'
|
||||
\ '\<specify\>:\<endspecify\>,' .
|
||||
\ '\<config\>:\<endconfig\>,' .
|
||||
\ '\<generate\>:\<endgenerate\>,' .
|
||||
\ '\<fork\>:\<join\>,' .
|
||||
\ '\<primitive\>:\<endprimitive\>,' .
|
||||
\ '\<table\>:\<endtable\>'
|
||||
endif
|
||||
|
||||
" Reset 'cpoptions' back to the user's setting
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
" Maintainer: Christian Brabandt <cb@256bit.org>
|
||||
" Previous Maintainer: Peter Aronoff <telemachus@arpinum.org>
|
||||
" Original Author: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2017-05-02
|
||||
" Latest Revision: 2017-08-08
|
||||
" License: Vim (see :h license)
|
||||
" Repository: https://github.com/chrisbra/vim-sh-indent
|
||||
" Changelog:
|
||||
" 20170808: - better indent of line continuation
|
||||
" 20170502: - get rid of buffer-shiftwidth function
|
||||
" 20160912: - preserve indentation of here-doc blocks
|
||||
" 20160627: - detect heredocs correctly
|
||||
@@ -117,7 +118,8 @@ function! GetShIndent()
|
||||
endfunction
|
||||
|
||||
function! s:is_continuation_line(line)
|
||||
return a:line =~ '\%(\%(^\|[^\\]\)\\\|&&\|||\)$'
|
||||
return a:line =~ '\%(\%(^\|[^\\]\)\\\|&&\|||\||\)' .
|
||||
\ '\s*\({\s*\)\=\(#.*\)\=$'
|
||||
endfunction
|
||||
|
||||
function! s:find_continued_lnum(lnum)
|
||||
|
||||
+17
-13
@@ -1,6 +1,6 @@
|
||||
" Language: Verilog HDL
|
||||
" Maintainer: Chih-Tsun Huang <cthuang@cs.nthu.edu.tw>
|
||||
" Last Change: 2017 Feb 24 by Chih-Tsun Huang
|
||||
" Last Change: 2017 Aug 25 by Chih-Tsun Huang
|
||||
" URL: http://www.cs.nthu.edu.tw/~cthuang/vim/indent/verilog.vim
|
||||
"
|
||||
" Credits:
|
||||
@@ -25,7 +25,8 @@ let b:did_indent = 1
|
||||
setlocal indentexpr=GetVerilogIndent()
|
||||
setlocal indentkeys=!^F,o,O,0),=begin,=end,=join,=endcase
|
||||
setlocal indentkeys+==endmodule,=endfunction,=endtask,=endspecify
|
||||
setlocal indentkeys+==`else,=`endif
|
||||
setlocal indentkeys+==endconfig,=endgenerate,=endprimitive,=endtable
|
||||
setlocal indentkeys+==`else,=`elsif,=`endif
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetVerilogIndent")
|
||||
@@ -84,7 +85,9 @@ function GetVerilogIndent()
|
||||
endif
|
||||
|
||||
" Indent after if/else/for/case/always/initial/specify/fork blocks
|
||||
elseif last_line =~ '`\@<!\<\(if\|else\)\>' ||
|
||||
" Note: We exclude '`if' or '`else' and consider 'end else'
|
||||
" 'end if' is redundant here
|
||||
elseif last_line =~ '^\s*\(end\)\=\s*`\@<!\<\(if\|else\)\>' ||
|
||||
\ last_line =~ '^\s*\<\(for\|case\%[[zx]]\)\>' ||
|
||||
\ last_line =~ '^\s*\<\(always\|initial\)\>' ||
|
||||
\ last_line =~ '^\s*\<\(specify\|fork\)\>'
|
||||
@@ -93,8 +96,8 @@ function GetVerilogIndent()
|
||||
let ind = ind + offset
|
||||
if vverb | echo vverb_str "Indent after a block statement." | endif
|
||||
endif
|
||||
" Indent after function/task blocks
|
||||
elseif last_line =~ '^\s*\<\(function\|task\)\>'
|
||||
" Indent after function/task/config/generate/primitive/table blocks
|
||||
elseif last_line =~ '^\s*\<\(function\|task\|config\|generate\|primitive\|table\)\>'
|
||||
if last_line !~ '\<end\>\s*' . vlog_comment . '*$' ||
|
||||
\ last_line =~ '\(//\|/\*\).*\(;\|\<end\>\)\s*' . vlog_comment . '*$'
|
||||
let ind = ind + offset
|
||||
@@ -161,11 +164,11 @@ function GetVerilogIndent()
|
||||
let ind = ind - offset
|
||||
if vverb | echo vverb_str "De-indent after a close statement." | endif
|
||||
|
||||
" `ifdef and `else
|
||||
elseif last_line =~ '^\s*`\<\(ifdef\|else\)\>'
|
||||
" `ifdef or `ifndef or `elsif or `else
|
||||
elseif last_line =~ '^\s*`\<\(ifn\?def\|elsif\|else\)\>'
|
||||
let ind = ind + offset
|
||||
if vverb
|
||||
echo vverb_str "Indent after a `ifdef or `else statement."
|
||||
echo vverb_str "Indent after a `ifdef or `ifndef or `elsif or `else statement."
|
||||
endif
|
||||
|
||||
endif
|
||||
@@ -175,7 +178,8 @@ function GetVerilogIndent()
|
||||
" De-indent on the end of the block
|
||||
" join/end/endcase/endfunction/endtask/endspecify
|
||||
if curr_line =~ '^\s*\<\(join\|end\|endcase\)\>' ||
|
||||
\ curr_line =~ '^\s*\<\(endfunction\|endtask\|endspecify\)\>'
|
||||
\ curr_line =~ '^\s*\<\(endfunction\|endtask\|endspecify\)\>' ||
|
||||
\ curr_line =~ '^\s*\<\(endconfig\|endgenerate\|endprimitive\|endtable\)\>'
|
||||
let ind = ind - offset
|
||||
if vverb | echo vverb_str "De-indent the end of a block." | endif
|
||||
elseif curr_line =~ '^\s*\<endmodule\>'
|
||||
@@ -186,7 +190,7 @@ function GetVerilogIndent()
|
||||
|
||||
" De-indent on a stand-alone 'begin'
|
||||
elseif curr_line =~ '^\s*\<begin\>'
|
||||
if last_line !~ '^\s*\<\(function\|task\|specify\|module\)\>' &&
|
||||
if last_line !~ '^\s*\<\(function\|task\|specify\|module\|config\|generate\|primitive\|table\)\>' &&
|
||||
\ last_line !~ '^\s*\()*\s*;\|)\+\)\s*' . vlog_comment . '*$' &&
|
||||
\ ( last_line =~
|
||||
\ '\<\(`\@<!if\|`\@<!else\|for\|case\%[[zx]]\|always\|initial\)\>' ||
|
||||
@@ -208,10 +212,10 @@ function GetVerilogIndent()
|
||||
echo vverb_str "De-indent the end of a multiple statement."
|
||||
endif
|
||||
|
||||
" De-indent `else and `endif
|
||||
elseif curr_line =~ '^\s*`\<\(else\|endif\)\>'
|
||||
" De-indent `elsif or `else or `endif
|
||||
elseif curr_line =~ '^\s*`\<\(elsif\|else\|endif\)\>'
|
||||
let ind = ind - offset
|
||||
if vverb | echo vverb_str "De-indent `else and `endif statement." | endif
|
||||
if vverb | echo vverb_str "De-indent `elsif or `else or `endif statement." | endif
|
||||
|
||||
endif
|
||||
|
||||
|
||||
+13
-12
@@ -1,20 +1,17 @@
|
||||
" These commands create the option window.
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2017 Aug 01
|
||||
" Last Change: 2017 Aug 19
|
||||
|
||||
" If there already is an option window, jump to that one.
|
||||
if bufwinnr("option-window") > 0
|
||||
let s:thiswin = winnr()
|
||||
while 1
|
||||
if @% == "option-window"
|
||||
let buf = bufnr('option-window')
|
||||
if buf >= 0
|
||||
let winids = win_findbuf(buf)
|
||||
if len(winids) > 0
|
||||
if win_gotoid(winids[0]) == 1
|
||||
finish
|
||||
endif
|
||||
wincmd w
|
||||
if s:thiswin == winnr()
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
endif
|
||||
endif
|
||||
|
||||
" Make sure the '<' flag is not included in 'cpoptions', otherwise <CR> would
|
||||
@@ -141,8 +138,8 @@ while exists("b:current_syntax") && b:current_syntax == "help"
|
||||
endif
|
||||
endwhile
|
||||
|
||||
" Open the window
|
||||
new option-window
|
||||
" Open the window. $OPTWIN_CMD is set to "tab" for ":tab options".
|
||||
exe $OPTWIN_CMD . ' new option-window'
|
||||
setlocal ts=15 tw=0 noro buftype=nofile
|
||||
|
||||
" Insert help and a "set" command for each option.
|
||||
@@ -513,6 +510,10 @@ if has("terminal")
|
||||
call append("$", "termkey\tkey that precedes Vim commands in a terminal window")
|
||||
call append("$", "\t(local to window)")
|
||||
call <SID>OptionL("tk")
|
||||
if exists("&winptydll")
|
||||
call append("$", "winptydll\tname of the winpty dynamic library")
|
||||
call <SID>OptionG("winptydll", &winptydll)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,293 @@
|
||||
" Debugger plugin using gdb.
|
||||
"
|
||||
" WORK IN PROGRESS - much doesn't work yet
|
||||
"
|
||||
" Open two visible terminal windows:
|
||||
" 1. run a pty, as with ":term NONE"
|
||||
" 2. run gdb, passing the pty
|
||||
" The current window is used to view source code and follows gdb.
|
||||
"
|
||||
" A third terminal window is hidden, it is used for communication with gdb.
|
||||
"
|
||||
" The communication with gdb uses GDB/MI. See:
|
||||
" https://sourceware.org/gdb/current/onlinedocs/gdb/GDB_002fMI.html
|
||||
"
|
||||
" Author: Bram Moolenaar
|
||||
" Copyright: Vim license applies, see ":help license"
|
||||
|
||||
" The command that starts debugging, e.g. ":Termdebug vim".
|
||||
" To end type "quit" in the gdb window.
|
||||
command -nargs=* -complete=file Termdebug call s:StartDebug(<q-args>)
|
||||
|
||||
" Name of the gdb command, defaults to "gdb".
|
||||
if !exists('termdebugger')
|
||||
let termdebugger = 'gdb'
|
||||
endif
|
||||
|
||||
" Sign used to highlight the line where the program has stopped.
|
||||
" There can be only one.
|
||||
sign define debugPC linehl=debugPC
|
||||
let s:pc_id = 12
|
||||
let s:break_id = 13
|
||||
|
||||
" Sign used to indicate a breakpoint.
|
||||
" Can be used multiple times.
|
||||
sign define debugBreakpoint text=>> texthl=debugBreakpoint
|
||||
|
||||
if &background == 'light'
|
||||
hi default debugPC term=reverse ctermbg=lightblue guibg=lightblue
|
||||
else
|
||||
hi default debugPC term=reverse ctermbg=darkblue guibg=darkblue
|
||||
endif
|
||||
hi default debugBreakpoint term=reverse ctermbg=red guibg=red
|
||||
|
||||
func s:StartDebug(cmd)
|
||||
let s:startwin = win_getid(winnr())
|
||||
let s:startsigncolumn = &signcolumn
|
||||
|
||||
" Open a terminal window without a job, to run the debugged program
|
||||
let s:ptybuf = term_start('NONE', {
|
||||
\ 'term_name': 'gdb program',
|
||||
\ })
|
||||
if s:ptybuf == 0
|
||||
echoerr 'Failed to open the program terminal window'
|
||||
return
|
||||
endif
|
||||
let pty = job_info(term_getjob(s:ptybuf))['tty_out']
|
||||
let s:ptywin = win_getid(winnr())
|
||||
|
||||
" Create a hidden terminal window to communicate with gdb
|
||||
let s:commbuf = term_start('NONE', {
|
||||
\ 'term_name': 'gdb communication',
|
||||
\ 'out_cb': function('s:CommOutput'),
|
||||
\ 'hidden': 1,
|
||||
\ })
|
||||
if s:commbuf == 0
|
||||
echoerr 'Failed to open the communication terminal window'
|
||||
exe 'bwipe! ' . s:ptybuf
|
||||
return
|
||||
endif
|
||||
let commpty = job_info(term_getjob(s:commbuf))['tty_out']
|
||||
|
||||
" Open a terminal window to run the debugger.
|
||||
let cmd = [g:termdebugger, '-tty', pty, a:cmd]
|
||||
echomsg 'executing "' . join(cmd) . '"'
|
||||
let gdbbuf = term_start(cmd, {
|
||||
\ 'exit_cb': function('s:EndDebug'),
|
||||
\ 'term_finish': 'close',
|
||||
\ })
|
||||
if gdbbuf == 0
|
||||
echoerr 'Failed to open the gdb terminal window'
|
||||
exe 'bwipe! ' . s:ptybuf
|
||||
exe 'bwipe! ' . s:commbuf
|
||||
return
|
||||
endif
|
||||
let s:gdbwin = win_getid(winnr())
|
||||
|
||||
" Connect gdb to the communication pty, using the GDB/MI interface
|
||||
call term_sendkeys(gdbbuf, 'new-ui mi ' . commpty . "\r")
|
||||
|
||||
" Install debugger commands in the text window.
|
||||
call win_gotoid(s:startwin)
|
||||
call s:InstallCommands()
|
||||
call win_gotoid(s:gdbwin)
|
||||
|
||||
let s:breakpoints = {}
|
||||
endfunc
|
||||
|
||||
func s:EndDebug(job, status)
|
||||
exe 'bwipe! ' . s:ptybuf
|
||||
exe 'bwipe! ' . s:commbuf
|
||||
|
||||
let curwinid = win_getid(winnr())
|
||||
|
||||
call win_gotoid(s:startwin)
|
||||
let &signcolumn = s:startsigncolumn
|
||||
call s:DeleteCommands()
|
||||
|
||||
call win_gotoid(curwinid)
|
||||
endfunc
|
||||
|
||||
" Handle a message received from gdb on the GDB/MI interface.
|
||||
func s:CommOutput(chan, msg)
|
||||
let msgs = split(a:msg, "\r")
|
||||
|
||||
for msg in msgs
|
||||
" remove prefixed NL
|
||||
if msg[0] == "\n"
|
||||
let msg = msg[1:]
|
||||
endif
|
||||
if msg != ''
|
||||
if msg =~ '^\*\(stopped\|running\)'
|
||||
call s:HandleCursor(msg)
|
||||
elseif msg =~ '^\^done,bkpt=' || msg =~ '^=breakpoint-created,'
|
||||
call s:HandleNewBreakpoint(msg)
|
||||
elseif msg =~ '^=breakpoint-deleted,'
|
||||
call s:HandleBreakpointDelete(msg)
|
||||
elseif msg =~ '^\^done,value='
|
||||
call s:HandleEvaluate(msg)
|
||||
elseif msg =~ '^\^error,msg='
|
||||
call s:HandleError(msg)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
" Install commands in the current window to control the debugger.
|
||||
func s:InstallCommands()
|
||||
command Break call s:SetBreakpoint()
|
||||
command Delete call s:DeleteBreakpoint()
|
||||
command Step call s:SendCommand('-exec-step')
|
||||
command Over call s:SendCommand('-exec-next')
|
||||
command Finish call s:SendCommand('-exec-finish')
|
||||
command Continue call s:SendCommand('-exec-continue')
|
||||
command -range -nargs=* Evaluate call s:Evaluate(<range>, <q-args>)
|
||||
command Gdb call win_gotoid(s:gdbwin)
|
||||
command Program call win_gotoid(s:ptywin)
|
||||
|
||||
" TODO: can the K mapping be restored?
|
||||
nnoremap K :Evaluate<CR>
|
||||
endfunc
|
||||
|
||||
" Delete installed debugger commands in the current window.
|
||||
func s:DeleteCommands()
|
||||
delcommand Break
|
||||
delcommand Delete
|
||||
delcommand Step
|
||||
delcommand Over
|
||||
delcommand Finish
|
||||
delcommand Continue
|
||||
delcommand Evaluate
|
||||
delcommand Gdb
|
||||
delcommand Program
|
||||
|
||||
nunmap K
|
||||
sign undefine debugPC
|
||||
sign undefine debugBreakpoint
|
||||
exe 'sign unplace ' . s:pc_id
|
||||
for key in keys(s:breakpoints)
|
||||
exe 'sign unplace ' . (s:break_id + key)
|
||||
endfor
|
||||
unlet s:breakpoints
|
||||
endfunc
|
||||
|
||||
" :Break - Set a breakpoint at the cursor position.
|
||||
func s:SetBreakpoint()
|
||||
call term_sendkeys(s:commbuf, '-break-insert --source '
|
||||
\ . fnameescape(expand('%:p')) . ' --line ' . line('.') . "\r")
|
||||
endfunc
|
||||
|
||||
" :Delete - Delete a breakpoint at the cursor position.
|
||||
func s:DeleteBreakpoint()
|
||||
let fname = fnameescape(expand('%:p'))
|
||||
let lnum = line('.')
|
||||
for [key, val] in items(s:breakpoints)
|
||||
if val['fname'] == fname && val['lnum'] == lnum
|
||||
call term_sendkeys(s:commbuf, '-break-delete ' . key . "\r")
|
||||
" Assume this always wors, the reply is simply "^done".
|
||||
exe 'sign unplace ' . (s:break_id + key)
|
||||
unlet s:breakpoints[key]
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
" :Next, :Continue, etc - send a command to gdb
|
||||
func s:SendCommand(cmd)
|
||||
call term_sendkeys(s:commbuf, a:cmd . "\r")
|
||||
endfunc
|
||||
|
||||
" :Evaluate - evaluate what is under the cursor
|
||||
func s:Evaluate(range, arg)
|
||||
if a:arg != ''
|
||||
let expr = a:arg
|
||||
elseif a:range == 2
|
||||
let pos = getcurpos()
|
||||
let reg = getreg('v', 1, 1)
|
||||
let regt = getregtype('v')
|
||||
normal! gv"vy
|
||||
let expr = @v
|
||||
call setpos('.', pos)
|
||||
call setreg('v', reg, regt)
|
||||
else
|
||||
let expr = expand('<cexpr>')
|
||||
endif
|
||||
call term_sendkeys(s:commbuf, '-data-evaluate-expression "' . expr . "\"\r")
|
||||
let s:evalexpr = expr
|
||||
endfunc
|
||||
|
||||
" Handle the result of data-evaluate-expression
|
||||
func s:HandleEvaluate(msg)
|
||||
echomsg '"' . s:evalexpr . '": ' . substitute(a:msg, '.*value="\(.*\)"', '\1', '')
|
||||
endfunc
|
||||
|
||||
" Handle an error.
|
||||
func s:HandleError(msg)
|
||||
echoerr substitute(a:msg, '.*msg="\(.*\)"', '\1', '')
|
||||
endfunc
|
||||
|
||||
" Handle stopping and running message from gdb.
|
||||
" Will update the sign that shows the current position.
|
||||
func s:HandleCursor(msg)
|
||||
let wid = win_getid(winnr())
|
||||
|
||||
if win_gotoid(s:startwin)
|
||||
if a:msg =~ '^\*stopped'
|
||||
let fname = substitute(a:msg, '.*fullname="\([^"]*\)".*', '\1', '')
|
||||
let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '')
|
||||
if lnum =~ '^[0-9]*$'
|
||||
if expand('%:h') != fname
|
||||
if &modified
|
||||
" TODO: find existing window
|
||||
exe 'split ' . fnameescape(fname)
|
||||
let s:startwin = win_getid(winnr())
|
||||
else
|
||||
exe 'edit ' . fnameescape(fname)
|
||||
endif
|
||||
endif
|
||||
exe lnum
|
||||
exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . fnameescape(fname)
|
||||
setlocal signcolumn=yes
|
||||
endif
|
||||
else
|
||||
exe 'sign unplace ' . s:pc_id
|
||||
endif
|
||||
|
||||
call win_gotoid(wid)
|
||||
endif
|
||||
endfunc
|
||||
|
||||
" Handle setting a breakpoint
|
||||
" Will update the sign that shows the breakpoint
|
||||
func s:HandleNewBreakpoint(msg)
|
||||
let nr = substitute(a:msg, '.*number="\([0-9]\)*\".*', '\1', '') + 0
|
||||
if nr == 0
|
||||
return
|
||||
endif
|
||||
|
||||
if has_key(s:breakpoints, nr)
|
||||
let entry = s:breakpoints[nr]
|
||||
else
|
||||
let entry = {}
|
||||
let s:breakpoints[nr] = entry
|
||||
endif
|
||||
|
||||
let fname = substitute(a:msg, '.*fullname="\([^"]*\)".*', '\1', '')
|
||||
let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '')
|
||||
|
||||
exe 'sign place ' . (s:break_id + nr) . ' line=' . lnum . ' name=debugBreakpoint file=' . fnameescape(fname)
|
||||
|
||||
let entry['fname'] = fname
|
||||
let entry['lnum'] = lnum
|
||||
endfunc
|
||||
|
||||
" Handle deleting a breakpoint
|
||||
" Will remove the sign that shows the breakpoint
|
||||
func s:HandleBreakpointDelete(msg)
|
||||
let nr = substitute(a:msg, '.*id="\([0-9]*\)\".*', '\1', '') + 0
|
||||
if nr == 0
|
||||
return
|
||||
endif
|
||||
exe 'sign unplace ' . (s:break_id + nr)
|
||||
unlet s:breakpoints[nr]
|
||||
endfunc
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
" Vim support file to detect file types in scripts
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last change: 2017 Jun 11
|
||||
" Last change: 2017 Aug 27
|
||||
|
||||
" This file is called by an autocommand for every file that has just been
|
||||
" loaded into a buffer. It checks if the type of file can be recognized by
|
||||
@@ -306,7 +306,7 @@ else
|
||||
set ft=virata
|
||||
|
||||
" Strace
|
||||
elseif s:line1 =~# '^\(\[pid \d\+\] \)\=[0-9:.]* *execve(' || s:line1 =~# '^__libc_start_main'
|
||||
elseif s:line1 =~# '[0-9:.]* *execve(' || s:line1 =~# '^__libc_start_main'
|
||||
set ft=strace
|
||||
|
||||
" VSE JCL
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
|
||||
" Former Maintainers: Gerfried Fuchs <alfie@ist.org>
|
||||
" Wichert Akkerman <wakkerma@debian.org>
|
||||
" Last Change: 2016 Aug 30
|
||||
" Last Change: 2017 Aug 18
|
||||
" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debcontrol.vim
|
||||
|
||||
" Standard syntax initialization
|
||||
@@ -21,8 +21,8 @@ syn case match
|
||||
syn match debcontrolElse "^.*$"
|
||||
|
||||
" Common seperators
|
||||
syn match debControlComma ", *"
|
||||
syn match debControlSpace " "
|
||||
syn match debControlComma ",[ \t]*"
|
||||
syn match debControlSpace "[ \t]"
|
||||
|
||||
let s:kernels = '\%(linux\|hurd\|kfreebsd\|knetbsd\|kopensolaris\|netbsd\)'
|
||||
let s:archs = '\%(alpha\|amd64\|armeb\|armel\|armhf\|arm64\|avr32\|hppa\|i386'
|
||||
@@ -38,7 +38,7 @@ unlet s:kernels s:archs s:pairs
|
||||
syn match debcontrolMultiArch contained "\%(no\|foreign\|allowed\|same\)"
|
||||
syn match debcontrolName contained "[a-z0-9][a-z0-9+.-]\+"
|
||||
syn match debcontrolPriority contained "\(extra\|important\|optional\|required\|standard\)"
|
||||
syn match debcontrolSection contained "\v((contrib|non-free|non-US/main|non-US/contrib|non-US/non-free|restricted|universe|multiverse)/)?(admin|cli-mono|comm|database|debian-installer|debug|devel|doc|editors|education|electronics|embedded|fonts|games|gnome|gnustep|gnu-r|graphics|hamradio|haskell|httpd|interpreters|introspection|java|javascript|kde|kernel|libs|libdevel|lisp|localization|mail|math|metapackages|misc|net|news|ocaml|oldlibs|otherosfs|perl|php|python|ruby|rust|science|shells|sound|text|tex|utils|vcs|video|web|x11|xfce|zope)"
|
||||
syn match debcontrolSection contained "\v((contrib|non-free|non-US/main|non-US/contrib|non-US/non-free|restricted|universe|multiverse)/)?(admin|cli-mono|comm|database|debian-installer|debug|devel|doc|editors|education|electronics|embedded|fonts|games|gnome|gnustep|gnu-r|graphics|hamradio|haskell|httpd|interpreters|introspection|java%(script)=|kde|kernel|libs|libdevel|lisp|localization|mail|math|metapackages|misc|net|news|ocaml|oldlibs|otherosfs|perl|php|python|ruby|rust|science|shells|sound|text|tex|utils|vcs|video|web|x11|xfce|zope)"
|
||||
syn match debcontrolPackageType contained "u\?deb"
|
||||
syn match debcontrolVariable contained "\${.\{-}}"
|
||||
syn match debcontrolDmUpload contained "\cyes"
|
||||
@@ -60,7 +60,7 @@ syn match debcontrolComment "^#.*$" contains=@Spell
|
||||
syn case ignore
|
||||
|
||||
" List of all legal keys
|
||||
syn match debcontrolKey contained "^\%(Source\|Package\|Section\|Priority\|\%(XSBC-Original-\)\=Maintainer\|Uploaders\|Build-\%(Conflicts\|Depends\)\%(-Indep\)\=\|Standards-Version\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Enhances\|Breaks\|Essential\|Architecture\|Multi-Arch\|Description\|Bugs\|Origin\|X[SB]-Python-Version\|Homepage\|\(XS-\)\=Vcs-\(Browser\|Arch\|Bzr\|Cvs\|Darcs\|Git\|Hg\|Mtn\|Svn\)\|\%(XC-\)\=Package-Type\): *"
|
||||
syn match debcontrolKey contained "^\%(Source\|Package\|Section\|Priority\|\%(XSBC-Original-\)\=Maintainer\|Uploaders\|Build-\%(Conflicts\|Depends\)\%(-Arch\|-Indep\)\=\|Standards-Version\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Enhances\|Breaks\|Essential\|Architecture\|Multi-Arch\|Description\|Bugs\|Origin\|X[SB]-Python-Version\|Homepage\|\(XS-\)\=Vcs-\(Browser\|Arch\|Bzr\|Cvs\|Darcs\|Git\|Hg\|Mtn\|Svn\)\|\%(XC-\)\=Package-Type\|\%(XS-\)\=Testsuite\): *"
|
||||
|
||||
syn match debcontrolDeprecatedKey contained "^\%(\%(XS-\)\=DM-Upload-Allowed\): *"
|
||||
|
||||
@@ -79,9 +79,9 @@ syn region debcontrolStrictField start="^\%(XS-\)\=Vcs-Git" end="$" contains=deb
|
||||
syn region debcontrolStrictField start="^\%(XS-\)\=DM-Upload-Allowed" end="$" contains=debcontrolDeprecatedKey,debcontrolDmUpload oneline
|
||||
|
||||
" Catch-all for the other legal fields
|
||||
syn region debcontrolField start="^\%(\%(XSBC-Original-\)\=Maintainer\|Standards-Version\|Essential\|Bugs\|Origin\|X[SB]-Python-Version\|\%(XS-\)\=Vcs-Mtn\):" end="$" contains=debcontrolKey,debcontrolVariable,debcontrolEmail oneline
|
||||
syn region debcontrolMultiField start="^\%(Build-\%(Conflicts\|Depends\)\%(-Indep\)\=\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Enhances\|Breaks\|Uploaders\|Description\):" skip="^ " end="^$"me=s-1 end="^[^ #]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable,debcontrolComment
|
||||
syn region debcontrolMultiFieldSpell start="^\%(Description\):" skip="^ " end="^$"me=s-1 end="^[^ #]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable,debcontrolComment,@Spell
|
||||
syn region debcontrolField start="^\%(\%(XSBC-Original-\)\=Maintainer\|Standards-Version\|Essential\|Bugs\|Origin\|X[SB]-Python-Version\|\%(XS-\)\=Vcs-Mtn\|\%(XS-\)\=Testsuite\):" end="$" contains=debcontrolKey,debcontrolVariable,debcontrolEmail oneline
|
||||
syn region debcontrolMultiField start="^\%(Build-\%(Conflicts\|Depends\)\%(-Arch\|-Indep\)\=\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Enhances\|Breaks\|Uploaders\|Description\):" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable,debcontrolComment
|
||||
syn region debcontrolMultiFieldSpell start="^\%(Description\):" skip="^[ \t]" end="^$"me=s-1 end="^[^ \t#]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable,debcontrolComment,@Spell
|
||||
|
||||
" Associate our matches and regions with pretty colours
|
||||
hi def link debcontrolKey Keyword
|
||||
|
||||
+19
-19
@@ -1,7 +1,7 @@
|
||||
" Vim syntax file
|
||||
" Language: Murphi model checking language
|
||||
" Maintainer: Matthew Fernandez <matthew.fernandez@gmail.com>
|
||||
" Last Change: 2017 May 3
|
||||
" Last Change: 2017 Aug 27
|
||||
" Version: 2
|
||||
" Remark: Originally authored by Diego Ongaro <ongaro@cs.stanford.edu>
|
||||
|
||||
@@ -105,23 +105,23 @@ syn region murphiComment start="--" end="$" contains=murphiTodo
|
||||
syn region murphiComment start="/\*" end="\*/" contains=murphiTodo
|
||||
|
||||
" Link the rules to some groups.
|
||||
highlight link murphiComment Comment
|
||||
highlight link murphiString String
|
||||
highlight link murphiNumber Number
|
||||
highlight link murphiBoolean Boolean
|
||||
highlight link murphiIdentifier Identifier
|
||||
highlight link murphiFunction Function
|
||||
highlight link murphiStatement Statement
|
||||
highlight link murphiConditional Conditional
|
||||
highlight link murphiRepeat Repeat
|
||||
highlight link murphiLabel Label
|
||||
highlight link murphiOperator Operator
|
||||
highlight link murphiKeyword Keyword
|
||||
highlight link murphiType Type
|
||||
highlight link murphiStructure Structure
|
||||
highlight link murphiSpecial Special
|
||||
highlight link murphiDelimiter Delimiter
|
||||
highlight link murphiError Error
|
||||
highlight link murphiTodo Todo
|
||||
hi def link murphiComment Comment
|
||||
hi def link murphiString String
|
||||
hi def link murphiNumber Number
|
||||
hi def link murphiBoolean Boolean
|
||||
hi def link murphiIdentifier Identifier
|
||||
hi def link murphiFunction Function
|
||||
hi def link murphiStatement Statement
|
||||
hi def link murphiConditional Conditional
|
||||
hi def link murphiRepeat Repeat
|
||||
hi def link murphiLabel Label
|
||||
hi def link murphiOperator Operator
|
||||
hi def link murphiKeyword Keyword
|
||||
hi def link murphiType Type
|
||||
hi def link murphiStructure Structure
|
||||
hi def link murphiSpecial Special
|
||||
hi def link murphiDelimiter Delimiter
|
||||
hi def link murphiError Error
|
||||
hi def link murphiTodo Todo
|
||||
|
||||
let b:current_syntax = "murphi"
|
||||
|
||||
@@ -0,0 +1,434 @@
|
||||
" Vim syntax file
|
||||
" Language: N1QL / Couchbase Server
|
||||
" Maintainer: Eugene Ciurana <n1ql AT cime.net>
|
||||
" Version: 1.0
|
||||
" Source: https://github.com/pr3d4t0r/n1ql-vim-syntax
|
||||
"
|
||||
" License: Vim is Charityware. n1ql.vim syntax is Charityware.
|
||||
" (c) Copyright 2017 by Eugene Ciurana / pr3d4t0r. Licensed
|
||||
" under the standard VIM LICENSE - Vim command :help uganda.txt
|
||||
" for details.
|
||||
"
|
||||
" Questions, comments: <n1ql AT cime.net>
|
||||
" https://ciurana.eu/pgp, https://keybase.io/pr3d4t0r
|
||||
"
|
||||
" vim: set fileencoding=utf-8:
|
||||
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
syn case ignore
|
||||
|
||||
syn keyword n1qlSpecial DATASTORES
|
||||
syn keyword n1qlSpecial DUAL
|
||||
syn keyword n1qlSpecial FALSE
|
||||
syn keyword n1qlSpecial INDEXES
|
||||
syn keyword n1qlSpecial KEYSPACES
|
||||
syn keyword n1qlSpecial MISSING
|
||||
syn keyword n1qlSpecial NAMESPACES
|
||||
syn keyword n1qlSpecial NULL
|
||||
syn keyword n1qlSpecial TRUE
|
||||
|
||||
|
||||
"
|
||||
" *** keywords ***
|
||||
"
|
||||
syn keyword n1qlKeyword ALL
|
||||
syn keyword n1qlKeyword ANY
|
||||
syn keyword n1qlKeyword ASC
|
||||
syn keyword n1qlKeyword BEGIN
|
||||
syn keyword n1qlKeyword BETWEEN
|
||||
syn keyword n1qlKeyword BREAK
|
||||
syn keyword n1qlKeyword BUCKET
|
||||
syn keyword n1qlKeyword CALL
|
||||
syn keyword n1qlKeyword CASE
|
||||
syn keyword n1qlKeyword CAST
|
||||
syn keyword n1qlKeyword CLUSTER
|
||||
syn keyword n1qlKeyword COLLATE
|
||||
syn keyword n1qlKeyword COLLECTION
|
||||
syn keyword n1qlKeyword CONNECT
|
||||
syn keyword n1qlKeyword CONTINUE
|
||||
syn keyword n1qlKeyword CORRELATE
|
||||
syn keyword n1qlKeyword COVER
|
||||
syn keyword n1qlKeyword DATABASE
|
||||
syn keyword n1qlKeyword DATASET
|
||||
syn keyword n1qlKeyword DATASTORE
|
||||
syn keyword n1qlKeyword DECLARE
|
||||
syn keyword n1qlKeyword DECREMENT
|
||||
syn keyword n1qlKeyword DERIVED
|
||||
syn keyword n1qlKeyword DESC
|
||||
syn keyword n1qlKeyword DESCRIBE
|
||||
syn keyword n1qlKeyword DO
|
||||
syn keyword n1qlKeyword EACH
|
||||
syn keyword n1qlKeyword ELEMENT
|
||||
syn keyword n1qlKeyword ELSE
|
||||
syn keyword n1qlKeyword END
|
||||
syn keyword n1qlKeyword EVERY
|
||||
syn keyword n1qlKeyword EXCLUDE
|
||||
syn keyword n1qlKeyword EXISTS
|
||||
syn keyword n1qlKeyword FETCH
|
||||
syn keyword n1qlKeyword FIRST
|
||||
syn keyword n1qlKeyword FLATTEN
|
||||
syn keyword n1qlKeyword FOR
|
||||
syn keyword n1qlKeyword FORCE
|
||||
syn keyword n1qlKeyword FROM
|
||||
syn keyword n1qlKeyword FUNCTION
|
||||
syn keyword n1qlKeyword GROUP
|
||||
syn keyword n1qlKeyword GSI
|
||||
syn keyword n1qlKeyword HAVING
|
||||
syn keyword n1qlKeyword IF
|
||||
syn keyword n1qlKeyword IGNORE
|
||||
syn keyword n1qlKeyword INCLUDE
|
||||
syn keyword n1qlKeyword INCREMENT
|
||||
syn keyword n1qlKeyword INDEX
|
||||
syn keyword n1qlKeyword INITIAL
|
||||
syn keyword n1qlKeyword INLINE
|
||||
syn keyword n1qlKeyword INNER
|
||||
syn keyword n1qlKeyword INTO
|
||||
syn keyword n1qlKeyword KEY
|
||||
syn keyword n1qlKeyword KEYS
|
||||
syn keyword n1qlKeyword KEYSPACE
|
||||
syn keyword n1qlKeyword KNOWN
|
||||
syn keyword n1qlKeyword LAST
|
||||
syn keyword n1qlKeyword LET
|
||||
syn keyword n1qlKeyword LETTING
|
||||
syn keyword n1qlKeyword LIMIT
|
||||
syn keyword n1qlKeyword LOOP
|
||||
syn keyword n1qlKeyword LSM
|
||||
syn keyword n1qlKeyword MAP
|
||||
syn keyword n1qlKeyword MAPPING
|
||||
syn keyword n1qlKeyword MATCHED
|
||||
syn keyword n1qlKeyword MATERIALIZED
|
||||
syn keyword n1qlKeyword MERGE
|
||||
syn keyword n1qlKeyword NAMESPACE
|
||||
syn keyword n1qlKeyword NEST
|
||||
syn keyword n1qlKeyword OPTION
|
||||
syn keyword n1qlKeyword ORDER
|
||||
syn keyword n1qlKeyword OUTER
|
||||
syn keyword n1qlKeyword OVER
|
||||
syn keyword n1qlKeyword PARSE
|
||||
syn keyword n1qlKeyword PARTITION
|
||||
syn keyword n1qlKeyword PASSWORD
|
||||
syn keyword n1qlKeyword PATH
|
||||
syn keyword n1qlKeyword POOL
|
||||
syn keyword n1qlKeyword PRIMARY
|
||||
syn keyword n1qlKeyword PRIVATE
|
||||
syn keyword n1qlKeyword PRIVILEGE
|
||||
syn keyword n1qlKeyword PROCEDURE
|
||||
syn keyword n1qlKeyword PUBLIC
|
||||
syn keyword n1qlKeyword REALM
|
||||
syn keyword n1qlKeyword REDUCE
|
||||
syn keyword n1qlKeyword RETURN
|
||||
syn keyword n1qlKeyword RETURNING
|
||||
syn keyword n1qlKeyword ROLE
|
||||
syn keyword n1qlKeyword SATISFIES
|
||||
syn keyword n1qlKeyword SCHEMA
|
||||
syn keyword n1qlKeyword SELF
|
||||
syn keyword n1qlKeyword SEMI
|
||||
syn keyword n1qlKeyword SHOW
|
||||
syn keyword n1qlKeyword START
|
||||
syn keyword n1qlKeyword STATISTICS
|
||||
syn keyword n1qlKeyword SYSTEM
|
||||
syn keyword n1qlKeyword THEN
|
||||
syn keyword n1qlKeyword TRANSACTION
|
||||
syn keyword n1qlKeyword TRIGGER
|
||||
syn keyword n1qlKeyword UNDER
|
||||
syn keyword n1qlKeyword UNKNOWN
|
||||
syn keyword n1qlKeyword UNSET
|
||||
syn keyword n1qlKeyword USE
|
||||
syn keyword n1qlKeyword USER
|
||||
syn keyword n1qlKeyword USING
|
||||
syn keyword n1qlKeyword VALIDATE
|
||||
syn keyword n1qlKeyword VALUE
|
||||
syn keyword n1qlKeyword VALUED
|
||||
syn keyword n1qlKeyword VALUES
|
||||
syn keyword n1qlKeyword VIEW
|
||||
syn keyword n1qlKeyword WHEN
|
||||
syn keyword n1qlKeyword WHERE
|
||||
syn keyword n1qlKeyword WHILE
|
||||
syn keyword n1qlKeyword WITHIN
|
||||
syn keyword n1qlKeyword WORK
|
||||
|
||||
|
||||
"
|
||||
" *** functions ***
|
||||
"
|
||||
syn keyword n1qlOperator ABS
|
||||
syn keyword n1qlOperator ACOS
|
||||
syn keyword n1qlOperator ARRAY_AGG
|
||||
syn keyword n1qlOperator ARRAY_APPEND
|
||||
syn keyword n1qlOperator ARRAY_AVG
|
||||
syn keyword n1qlOperator ARRAY_CONCAT
|
||||
syn keyword n1qlOperator ARRAY_CONTAINS
|
||||
syn keyword n1qlOperator ARRAY_COUNT
|
||||
syn keyword n1qlOperator ARRAY_DISTINCT
|
||||
syn keyword n1qlOperator ARRAY_FLATTEN
|
||||
syn keyword n1qlOperator ARRAY_IFNULL
|
||||
syn keyword n1qlOperator ARRAY_INSERT
|
||||
syn keyword n1qlOperator ARRAY_INTERSECT
|
||||
syn keyword n1qlOperator ARRAY_LENGTH
|
||||
syn keyword n1qlOperator ARRAY_MAX
|
||||
syn keyword n1qlOperator ARRAY_MIN
|
||||
syn keyword n1qlOperator ARRAY_POSITION
|
||||
syn keyword n1qlOperator ARRAY_PREPEND
|
||||
syn keyword n1qlOperator ARRAY_PUT
|
||||
syn keyword n1qlOperator ARRAY_RANGE
|
||||
syn keyword n1qlOperator ARRAY_REMOVE
|
||||
syn keyword n1qlOperator ARRAY_REPEAT
|
||||
syn keyword n1qlOperator ARRAY_REPLACE
|
||||
syn keyword n1qlOperator ARRAY_REVERSE
|
||||
syn keyword n1qlOperator ARRAY_SORT
|
||||
syn keyword n1qlOperator ARRAY_START
|
||||
syn keyword n1qlOperator ARRAY_SUM
|
||||
syn keyword n1qlOperator ARRAY_SYMDIFF
|
||||
syn keyword n1qlOperator ARRAY_UNION
|
||||
syn keyword n1qlOperator ASIN
|
||||
syn keyword n1qlOperator ATAN
|
||||
syn keyword n1qlOperator ATAN2
|
||||
syn keyword n1qlOperator AVG
|
||||
syn keyword n1qlOperator BASE64
|
||||
syn keyword n1qlOperator BASE64_DECODE
|
||||
syn keyword n1qlOperator BASE64_ENCODE
|
||||
syn keyword n1qlOperator CEIL
|
||||
syn keyword n1qlOperator CLOCK_LOCAL
|
||||
syn keyword n1qlOperator CLOCK_STR
|
||||
syn keyword n1qlOperator CLOCK_TZ
|
||||
syn keyword n1qlOperator CLOCK_UTC
|
||||
syn keyword n1qlOperator CLOCL_MILLIS
|
||||
syn keyword n1qlOperator CONTAINS
|
||||
syn keyword n1qlOperator COS
|
||||
syn keyword n1qlOperator COUNT
|
||||
syn keyword n1qlOperator DATE_ADD_MILLIS
|
||||
syn keyword n1qlOperator DATE_ADD_STR
|
||||
syn keyword n1qlOperator DATE_DIFF_MILLIS
|
||||
syn keyword n1qlOperator DATE_DIFF_STR
|
||||
syn keyword n1qlOperator DATE_FORMAT_STR
|
||||
syn keyword n1qlOperator DATE_PART_MILLIS
|
||||
syn keyword n1qlOperator DATE_PART_STR
|
||||
syn keyword n1qlOperator DATE_RANGE_MILLIS
|
||||
syn keyword n1qlOperator DATE_RANGE_STR
|
||||
syn keyword n1qlOperator DATE_TRUC_STR
|
||||
syn keyword n1qlOperator DATE_TRUNC_MILLIS
|
||||
syn keyword n1qlOperator DECODE_JSON
|
||||
syn keyword n1qlOperator DEGREES
|
||||
syn keyword n1qlOperator DURATION_TO_STR
|
||||
syn keyword n1qlOperator E
|
||||
syn keyword n1qlOperator ENCODED_SIZE
|
||||
syn keyword n1qlOperator ENCODE_JSON
|
||||
syn keyword n1qlOperator EXP
|
||||
syn keyword n1qlOperator FLOOR
|
||||
syn keyword n1qlOperator GREATEST
|
||||
syn keyword n1qlOperator IFINF
|
||||
syn keyword n1qlOperator IFMISSING
|
||||
syn keyword n1qlOperator IFMISSINGORNULL
|
||||
syn keyword n1qlOperator IFNAN
|
||||
syn keyword n1qlOperator IFNANORINF
|
||||
syn keyword n1qlOperator IFNULL
|
||||
syn keyword n1qlOperator INITCAP
|
||||
syn keyword n1qlOperator ISARRAY
|
||||
syn keyword n1qlOperator ISATOM
|
||||
syn keyword n1qlOperator ISBOOLEAN
|
||||
syn keyword n1qlOperator ISNUMBER
|
||||
syn keyword n1qlOperator ISOBJECT
|
||||
syn keyword n1qlOperator ISSTRING
|
||||
syn keyword n1qlOperator LEAST
|
||||
syn keyword n1qlOperator LENGTH
|
||||
syn keyword n1qlOperator LN
|
||||
syn keyword n1qlOperator LOG
|
||||
syn keyword n1qlOperator LOWER
|
||||
syn keyword n1qlOperator LTRIM
|
||||
syn keyword n1qlOperator MAX
|
||||
syn keyword n1qlOperator META
|
||||
syn keyword n1qlOperator MILLIS
|
||||
syn keyword n1qlOperator MILLIS_TO_LOCAL
|
||||
syn keyword n1qlOperator MILLIS_TO_STR
|
||||
syn keyword n1qlOperator MILLIS_TO_TZ
|
||||
syn keyword n1qlOperator MILLIS_TO_UTC
|
||||
syn keyword n1qlOperator MILLIS_TO_ZONE_NAME
|
||||
syn keyword n1qlOperator MIN
|
||||
syn keyword n1qlOperator MISSINGIF
|
||||
syn keyword n1qlOperator NANIF
|
||||
syn keyword n1qlOperator NEGINFIF
|
||||
syn keyword n1qlOperator NOW_LOCAL
|
||||
syn keyword n1qlOperator NOW_MILLIS
|
||||
syn keyword n1qlOperator NOW_STR
|
||||
syn keyword n1qlOperator NOW_TZ
|
||||
syn keyword n1qlOperator NOW_UTC
|
||||
syn keyword n1qlOperator NULLIF
|
||||
syn keyword n1qlOperator OBJECT_ADD
|
||||
syn keyword n1qlOperator OBJECT_CONCAT
|
||||
syn keyword n1qlOperator OBJECT_INNER_PAIRS
|
||||
syn keyword n1qlOperator OBJECT_INNER_VALUES
|
||||
syn keyword n1qlOperator OBJECT_LENGTH
|
||||
syn keyword n1qlOperator OBJECT_NAMES
|
||||
syn keyword n1qlOperator OBJECT_PAIRS
|
||||
syn keyword n1qlOperator OBJECT_PUT
|
||||
syn keyword n1qlOperator OBJECT_REMOVE
|
||||
syn keyword n1qlOperator OBJECT_RENAME
|
||||
syn keyword n1qlOperator OBJECT_REPLACE
|
||||
syn keyword n1qlOperator OBJECT_UNWRAP
|
||||
syn keyword n1qlOperator OBJECT_VALUES
|
||||
syn keyword n1qlOperator PI
|
||||
syn keyword n1qlOperator POLY_LENGTH
|
||||
syn keyword n1qlOperator POSINIF
|
||||
syn keyword n1qlOperator POSITION
|
||||
syn keyword n1qlOperator POWER
|
||||
syn keyword n1qlOperator RADIANS
|
||||
syn keyword n1qlOperator RANDOM
|
||||
syn keyword n1qlOperator REGEXP_CONTAINS
|
||||
syn keyword n1qlOperator REGEXP_LIKE
|
||||
syn keyword n1qlOperator REGEXP_POSITION
|
||||
syn keyword n1qlOperator REGEXP_REPLACE
|
||||
syn keyword n1qlOperator REPEAT
|
||||
syn keyword n1qlOperator REPLACE
|
||||
syn keyword n1qlOperator REVERSE
|
||||
syn keyword n1qlOperator ROUND
|
||||
syn keyword n1qlOperator RTRIM
|
||||
syn keyword n1qlOperator SIGN
|
||||
syn keyword n1qlOperator SIN
|
||||
syn keyword n1qlOperator SPLIT
|
||||
syn keyword n1qlOperator SQRT
|
||||
syn keyword n1qlOperator STR_TO_DURATION
|
||||
syn keyword n1qlOperator STR_TO_MILLIS
|
||||
syn keyword n1qlOperator STR_TO_TZ
|
||||
syn keyword n1qlOperator STR_TO_UTC
|
||||
syn keyword n1qlOperator STR_TO_ZONE_NAME
|
||||
syn keyword n1qlOperator SUBSTR
|
||||
syn keyword n1qlOperator SUFFIXES
|
||||
syn keyword n1qlOperator SUM
|
||||
syn keyword n1qlOperator TAN
|
||||
syn keyword n1qlOperator TITLE
|
||||
syn keyword n1qlOperator TOARRAY
|
||||
syn keyword n1qlOperator TOATOM
|
||||
syn keyword n1qlOperator TOBOOLEAN
|
||||
syn keyword n1qlOperator TOKENS
|
||||
syn keyword n1qlOperator TONUMBER
|
||||
syn keyword n1qlOperator TOOBJECT
|
||||
syn keyword n1qlOperator TOSTRING
|
||||
syn keyword n1qlOperator TRIM
|
||||
syn keyword n1qlOperator TRUNC
|
||||
syn keyword n1qlOperator TYPE
|
||||
syn keyword n1qlOperator UPPER
|
||||
syn keyword n1qlOperator UUID
|
||||
syn keyword n1qlOperator WEEKDAY_MILLIS
|
||||
syn keyword n1qlOperator WEEKDAY_STR
|
||||
|
||||
|
||||
"
|
||||
" *** operators ***
|
||||
"
|
||||
syn keyword n1qlOperator AND
|
||||
syn keyword n1qlOperator AS
|
||||
syn keyword n1qlOperator BY
|
||||
syn keyword n1qlOperator DISTINCT
|
||||
syn keyword n1qlOperator EXCEPT
|
||||
syn keyword n1qlOperator ILIKE
|
||||
syn keyword n1qlOperator IN
|
||||
syn keyword n1qlOperator INTERSECT
|
||||
syn keyword n1qlOperator IS
|
||||
syn keyword n1qlOperator JOIN
|
||||
syn keyword n1qlOperator LEFT
|
||||
syn keyword n1qlOperator LIKE
|
||||
syn keyword n1qlOperator MINUS
|
||||
syn keyword n1qlOperator NEST
|
||||
syn keyword n1qlOperator NESTING
|
||||
syn keyword n1qlOperator NOT
|
||||
syn keyword n1qlOperator OFFSET
|
||||
syn keyword n1qlOperator ON
|
||||
syn keyword n1qlOperator OR
|
||||
syn keyword n1qlOperator OUT
|
||||
syn keyword n1qlOperator RIGHT
|
||||
syn keyword n1qlOperator SOME
|
||||
syn keyword n1qlOperator TO
|
||||
syn keyword n1qlOperator UNION
|
||||
syn keyword n1qlOperator UNIQUE
|
||||
syn keyword n1qlOperator UNNEST
|
||||
syn keyword n1qlOperator VIA
|
||||
syn keyword n1qlOperator WITH
|
||||
syn keyword n1qlOperator XOR
|
||||
|
||||
|
||||
"
|
||||
" *** statements ***
|
||||
"
|
||||
syn keyword n1qlStatement ALTER
|
||||
syn keyword n1qlStatement ANALYZE
|
||||
syn keyword n1qlStatement BUILD
|
||||
syn keyword n1qlStatement COMMIT
|
||||
syn keyword n1qlStatement CREATE
|
||||
syn keyword n1qlStatement DELETE
|
||||
syn keyword n1qlStatement DROP
|
||||
syn keyword n1qlStatement EXECUTE
|
||||
syn keyword n1qlStatement EXPLAIN
|
||||
syn keyword n1qlStatement GRANT
|
||||
syn keyword n1qlStatement INFER
|
||||
syn keyword n1qlStatement INSERT
|
||||
syn keyword n1qlStatement MERGE
|
||||
syn keyword n1qlStatement PREPARE
|
||||
syn keyword n1qlStatement RENAME
|
||||
syn keyword n1qlStatement REVOKE
|
||||
syn keyword n1qlStatement ROLLBACK
|
||||
syn keyword n1qlStatement SELECT
|
||||
syn keyword n1qlStatement SET
|
||||
syn keyword n1qlStatement TRUNCATE
|
||||
syn keyword n1qlStatement UPDATE
|
||||
syn keyword n1qlStatement UPSERT
|
||||
|
||||
|
||||
"
|
||||
" *** types ***
|
||||
"
|
||||
syn keyword n1qlType ARRAY
|
||||
syn keyword n1qlType BINARY
|
||||
syn keyword n1qlType BOOLEAN
|
||||
syn keyword n1qlType NUMBER
|
||||
syn keyword n1qlType OBJECT
|
||||
syn keyword n1qlType RAW
|
||||
syn keyword n1qlType STRING
|
||||
|
||||
|
||||
"
|
||||
" *** strings and characters ***
|
||||
"
|
||||
syn region n1qlString start=+"+ skip=+\\\\\|\\"+ end=+"+
|
||||
syn region n1qlString start=+'+ skip=+\\\\\|\\'+ end=+'+
|
||||
syn region n1qlBucketSpec start=+`+ skip=+\\\\\|\\'+ end=+`+
|
||||
|
||||
|
||||
"
|
||||
" *** numbers ***
|
||||
"
|
||||
syn match n1qlNumber "-\=\<\d*\.\=[0-9_]\>"
|
||||
|
||||
|
||||
"
|
||||
" *** comments ***
|
||||
"
|
||||
syn region n1qlComment start="/\*" end="\*/" contains=n1qlTODO
|
||||
syn match n1qlComment "--.*$" contains=n1qlTODO
|
||||
syn sync ccomment n1qlComment
|
||||
|
||||
|
||||
"
|
||||
" *** TODO ***
|
||||
"
|
||||
syn keyword n1qlTODO contained TODO FIXME XXX DEBUG NOTE
|
||||
|
||||
|
||||
"
|
||||
" *** enable ***
|
||||
"
|
||||
hi def link n1qlBucketSpec Underlined
|
||||
hi def link n1qlComment Comment
|
||||
hi def link n1qlKeyword Macro
|
||||
hi def link n1qlOperator Function
|
||||
hi def link n1qlSpecial Special
|
||||
hi def link n1qlStatement Statement
|
||||
hi def link n1qlString String
|
||||
hi def link n1qlTODO Todo
|
||||
hi def link n1qlType Type
|
||||
|
||||
let b:current_syntax = "n1ql"
|
||||
@@ -3,7 +3,7 @@
|
||||
" Maintainer: Zhen-Huan Hu <wildkeny@gmail.com>
|
||||
" Original Maintainer: James Kidd <james.kidd@covance.com>
|
||||
" Version: 3.0.0
|
||||
" Last Change: Mar 10, 2017
|
||||
" Last Change: Aug 26, 2017
|
||||
"
|
||||
" 2017 Mar 7
|
||||
"
|
||||
@@ -120,7 +120,7 @@ syn match sasDataStepStatement '\v%(^|;)\s*\zs%(dcl|declare)>' display contained
|
||||
syn match sasDataStepStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty
|
||||
syn match sasDataStepStatement '\v%(^|;)\s*\zs%(format|informat|input|put)>' display contained contains=sasDataStepStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty
|
||||
syn match sasDataStepStatement '\v%(^|;)\s*\zs%(cards|datalines|lines)4=\s*;' display contained contains=sasDataStepStatementKeyword nextgroup=sasDataLine skipwhite skipnl skipempty
|
||||
syn region sasDataLine start='^' end='^;'me=s-1 contained
|
||||
syn region sasDataLine start='^' end='^\s*;'me=s-1 contained
|
||||
syn region sasDataStep matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsdata>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,@sasDataStepSyntax
|
||||
syn cluster sasDataStepSyntax contains=sasDataStepFunction,sasDataStepHashOperator,sasDataStepHashAttribute,sasDataStepHashMethod,sasDataStepControl,sasDataStepStatement
|
||||
|
||||
|
||||
@@ -560,7 +560,7 @@ syn match vimHiBang contained "!" skipwhite nextgroup=@vimHighlightCluster
|
||||
|
||||
syn match vimHiGroup contained "\i\+"
|
||||
syn case ignore
|
||||
syn keyword vimHiAttrib contained none bold inverse italic reverse standout underline undercurl
|
||||
syn keyword vimHiAttrib contained none bold inverse italic reverse standout underline undercurl nocombine
|
||||
syn keyword vimFgBgAttrib contained none bg background fg foreground
|
||||
syn case match
|
||||
syn match vimHiAttribList contained "\i\+" contains=vimHiAttrib
|
||||
|
||||
@@ -790,10 +790,10 @@
|
||||
1. Переместите курсор вниз, к первой строке помеченной --->, и в начало
|
||||
первого слова xxx.
|
||||
|
||||
2. Теперь нажмите R и введите число указанный ниже во второй строке чтобы
|
||||
2. Теперь нажмите R и введите число, указанное ниже во второй строке, чтобы
|
||||
заменить xxx.
|
||||
|
||||
3. Нажмите <ESC> для выхода из режима замены. Заметьте что остаток строки
|
||||
3. Нажмите <ESC> для выхода из режима замены. Заметьте, что остаток строки
|
||||
не был изменён.
|
||||
|
||||
4. Повторите эти шаги для замены оставшихся xxx.
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
---> 現在您應該已經學會如何移動到下一講吧。
|
||||
|
||||
3. 現在請使用下行鍵,將光標移動到第二講。
|
||||
3. 現在請使用下行鍵,將光標移動到第一講第二節。
|
||||
|
||||
提示︰如果您不敢確定您所按下的字母,請按下<ESC>鍵回到正常(Normal)模式。
|
||||
然後再次從鍵盤輸入您想要的命令。
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
---> 現在您應該已經學會如何移動到下一講吧。
|
||||
|
||||
3. 現在請使用下行鍵,將光標移動到第二講。
|
||||
3. 現在請使用下行鍵,將光標移動到第一講第二節。
|
||||
|
||||
提示︰如果您不敢確定您所按下的字母,請按下<ESC>鍵回到正常(Normal)模式。
|
||||
然後再次從鍵盤輸入您想要的命令。
|
||||
|
||||
@@ -1255,7 +1255,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>136</string>
|
||||
<string>137</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#define DRAW_UNDERC 0x08 /* draw undercurl text */
|
||||
#define DRAW_ITALIC 0x10 /* draw italic text */
|
||||
#define DRAW_CURSOR 0x20
|
||||
#define DRAW_WIDE 0x40 /* draw wide text */
|
||||
#define DRAW_WIDE 0x80 /* draw wide text */
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
|
||||
#define kCTFontOrientationDefault kCTFontDefaultOrientation
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
#define DRAW_UNDERC 0x08 /* draw undercurl text */
|
||||
#define DRAW_ITALIC 0x10 /* draw italic text */
|
||||
#define DRAW_CURSOR 0x20
|
||||
#define DRAW_WIDE 0x40 /* draw wide text */
|
||||
#define DRAW_WIDE 0x80 /* draw wide text */
|
||||
|
||||
|
||||
static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|
||||
|
||||
+20
-2
@@ -76,6 +76,10 @@ endif
|
||||
# Set to yes to enable terminal support.
|
||||
TERMINAL=no
|
||||
|
||||
ifndef CTAGS
|
||||
# this assumes ctags is Exuberant ctags
|
||||
CTAGS = ctags -I INIT+ --fields=+S
|
||||
endif
|
||||
|
||||
# Link against the shared version of libstdc++ by default. Set
|
||||
# STATIC_STDCPLUS to "yes" to link against static version instead.
|
||||
@@ -340,6 +344,7 @@ endif
|
||||
# TCL_VER=[TCL version, eg 83, 84] (default is 86)
|
||||
# TCL_VER_LONG=[Tcl version, eg 8.3] (default is 8.6)
|
||||
# You must set TCL_VER_LONG when you set TCL_VER.
|
||||
# TCL_DLL=[TCL dll name, eg tcl86.dll] (default is tcl86.dll)
|
||||
ifdef TCL
|
||||
ifndef DYNAMIC_TCL
|
||||
DYNAMIC_TCL=yes
|
||||
@@ -350,6 +355,9 @@ endif
|
||||
ifndef TCL_VER_LONG
|
||||
TCL_VER_LONG = 8.6
|
||||
endif
|
||||
ifndef TCL_DLL
|
||||
TCL_DLL = tcl$(TCL_VER).dll
|
||||
endif
|
||||
TCLINC += -I$(TCL)/include
|
||||
endif
|
||||
|
||||
@@ -526,7 +534,7 @@ endif
|
||||
ifdef TCL
|
||||
CFLAGS += -DFEAT_TCL $(TCLINC)
|
||||
ifeq (yes, $(DYNAMIC_TCL))
|
||||
CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
|
||||
CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -881,6 +889,12 @@ xxd/xxd.exe: xxd/xxd.c
|
||||
GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
|
||||
$(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX='$(CXX)' STATIC_STDCPLUS=$(STATIC_STDCPLUS)
|
||||
|
||||
tags: notags
|
||||
$(CTAGS) *.c *.cpp *.h if_perl.xs
|
||||
|
||||
notags:
|
||||
-$(DEL) tags
|
||||
|
||||
clean:
|
||||
-$(DEL) $(OUTDIR)$(DIRSLASH)*.o
|
||||
-$(DEL) $(OUTDIR)$(DIRSLASH)*.res
|
||||
@@ -971,7 +985,11 @@ $(OUTDIR)/terminal.o: terminal.c $(INCL) $(TERM_DEPS)
|
||||
$(CC) -c $(CFLAGS) terminal.c -o $(OUTDIR)/terminal.o
|
||||
|
||||
|
||||
CCCTERM = $(CC) -c $(CFLAGS) -Ilibvterm/include -DINLINE="" -DVSNPRINTF=vim_vsnprintf
|
||||
CCCTERM = $(CC) -c $(CFLAGS) -Ilibvterm/include -DINLINE="" \
|
||||
-DVSNPRINTF=vim_vsnprintf \
|
||||
-DIS_COMBINING_FUNCTION=utf_iscomposing_uint \
|
||||
-DWCWIDTH_FUNCTION=utf_uint2cells
|
||||
|
||||
$(OUTDIR)/term_encoding.o: libvterm/src/encoding.c $(TERM_DEPS)
|
||||
$(CCCTERM) libvterm/src/encoding.c -o $@
|
||||
|
||||
|
||||
+12
-3
@@ -84,6 +84,7 @@
|
||||
# TCL_VER=[Tcl version, e.g. 80, 83] (default is 86)
|
||||
# TCL_VER_LONG=[Tcl version, eg 8.3] (default is 8.6)
|
||||
# You must set TCL_VER_LONG when you set TCL_VER.
|
||||
# TCL_DLL=[Tcl dll name, e.g. tcl86.dll] (default is tcl86.dll)
|
||||
#
|
||||
# Cscope support: CSCOPE=yes
|
||||
#
|
||||
@@ -343,7 +344,8 @@ FEATURES = HUGE
|
||||
!endif
|
||||
|
||||
!ifndef CTAGS
|
||||
CTAGS = ctags
|
||||
# this assumes ctags is Exuberant ctags
|
||||
CTAGS = ctags -I INIT+ --fields=+S
|
||||
!endif
|
||||
|
||||
!ifndef CSCOPE
|
||||
@@ -832,7 +834,9 @@ TCL_VER_LONG = 8.6
|
||||
!message Tcl requested (version $(TCL_VER)) - root dir is "$(TCL)"
|
||||
!if "$(DYNAMIC_TCL)" == "yes"
|
||||
!message Tcl DLL will be loaded dynamically
|
||||
!ifndef TCL_DLL
|
||||
TCL_DLL = tcl$(TCL_VER).dll
|
||||
!endif
|
||||
CFLAGS = $(CFLAGS) -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" \
|
||||
-DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
|
||||
TCL_OBJ = $(OUTDIR)\if_tcl.obj
|
||||
@@ -1217,7 +1221,7 @@ GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
|
||||
|
||||
|
||||
tags: notags
|
||||
$(CTAGS) *.c *.cpp *.h if_perl.xs proto\*.pro
|
||||
$(CTAGS) *.c *.cpp *.h if_perl.xs
|
||||
|
||||
notags:
|
||||
- if exist tags del tags
|
||||
@@ -1474,7 +1478,12 @@ $(OUTDIR)/dimm_i.obj: $(OUTDIR) dimm_i.c $(INCL)
|
||||
$(OUTDIR)/glbl_ime.obj: $(OUTDIR) glbl_ime.cpp dimm.h $(INCL)
|
||||
|
||||
|
||||
CCCTERM = $(CC) $(CFLAGS) -Ilibvterm/include -DINLINE="" -DVSNPRINTF=vim_vsnprintf -D_CRT_SECURE_NO_WARNINGS
|
||||
CCCTERM = $(CC) $(CFLAGS) -Ilibvterm/include -DINLINE="" \
|
||||
-DVSNPRINTF=vim_vsnprintf \
|
||||
-DIS_COMBINING_FUNCTION=utf_iscomposing_uint \
|
||||
-DWCWIDTH_FUNCTION=utf_uint2cells \
|
||||
-D_CRT_SECURE_NO_WARNINGS
|
||||
|
||||
$(OUTDIR)/term_encoding.obj: $(OUTDIR) libvterm/src/encoding.c $(TERM_DEPS)
|
||||
$(CCCTERM) -Fo$@ libvterm/src/encoding.c
|
||||
|
||||
|
||||
+17
-9
@@ -2117,17 +2117,17 @@ test1 \
|
||||
test_listchars \
|
||||
test_search_mbyte \
|
||||
test_wordcount \
|
||||
test3 test4 test5 test6 test7 test8 test9 \
|
||||
test11 test12 test14 test15 test17 test18 test19 \
|
||||
test20 test21 test22 test25 test27 test28 test29 \
|
||||
test3 test4 test5 test7 test8 \
|
||||
test11 test12 test14 test15 test17 test19 \
|
||||
test20 test25 test28 test29 \
|
||||
test30 test31 test32 test33 test34 test36 test37 test38 test39 \
|
||||
test40 test41 test42 test43 test44 test45 test48 test49 \
|
||||
test50 test51 test52 test53 test54 test55 test56 test57 test59 \
|
||||
test50 test52 test53 test54 test55 test56 test57 test59 \
|
||||
test60 test64 test66 test68 test69 \
|
||||
test70 test72 test73 test74 test77 test78 test79 \
|
||||
test80 test83 test84 test85 test86 test87 test88 \
|
||||
test91 test94 test95 test98 test99 \
|
||||
test100 test101 test103 test104 test107 test108:
|
||||
test70 test72 test73 test77 test78 test79 \
|
||||
test83 test85 test86 test87 test88 \
|
||||
test94 test95 test99 \
|
||||
test108:
|
||||
cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
|
||||
|
||||
# Run individual NEW style test, assuming that Vim was already compiled.
|
||||
@@ -2139,6 +2139,7 @@ test_arglist \
|
||||
test_autocmd \
|
||||
test_backspace_opt \
|
||||
test_breakindent \
|
||||
test_bufline \
|
||||
test_bufwintabinfo \
|
||||
test_cd \
|
||||
test_cdo \
|
||||
@@ -2281,6 +2282,7 @@ test_arglist \
|
||||
test_taglist \
|
||||
test_tcl \
|
||||
test_terminal \
|
||||
test_terminal_fail \
|
||||
test_textobjects \
|
||||
test_timers \
|
||||
test_true_false \
|
||||
@@ -2291,9 +2293,11 @@ test_arglist \
|
||||
test_utf8_comparisons \
|
||||
test_viminfo \
|
||||
test_vimscript \
|
||||
test_virtualedit \
|
||||
test_visual \
|
||||
test_window_cmd \
|
||||
test_window_id \
|
||||
test_windows_home \
|
||||
test_writefile \
|
||||
test_alot_latin \
|
||||
test_alot_utf8 \
|
||||
@@ -3321,7 +3325,11 @@ objects/channel.o: channel.c
|
||||
Makefile:
|
||||
@echo The name of the makefile MUST be "Makefile" (with capital M)!!!!
|
||||
|
||||
CCCTERM = $(CCC) -Ilibvterm/include -DINLINE="" -DVSNPRINTF=vim_vsnprintf
|
||||
CCCTERM = $(CCC_NF) -Ilibvterm/include $(ALL_CFLAGS) -DINLINE="" \
|
||||
-DVSNPRINTF=vim_vsnprintf \
|
||||
-DIS_COMBINING_FUNCTION=utf_iscomposing_uint \
|
||||
-DWCWIDTH_FUNCTION=utf_uint2cells
|
||||
|
||||
objects/term_encoding.o: libvterm/src/encoding.c $(TERM_DEPS)
|
||||
$(CCCTERM) -o $@ libvterm/src/encoding.c
|
||||
|
||||
|
||||
Vendored
+17
-3
@@ -7557,20 +7557,34 @@ $as_echo_n "checking --enable-terminal argument... " >&6; }
|
||||
# Check whether --enable-terminal was given.
|
||||
if test "${enable_terminal+set}" = set; then :
|
||||
enableval=$enable_terminal; enable_terminal="yes"
|
||||
else
|
||||
enable_terminal="auto"
|
||||
fi
|
||||
|
||||
if test "$enable_terminal" = "yes"; then
|
||||
if test "$enable_terminal" = "yes" || test "$enable_terminal" = "auto" -a "x$features" = "xhuge" ; then
|
||||
if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot use terminal emulator with tiny or small features" >&5
|
||||
$as_echo "cannot use terminal emulator with tiny or small features" >&6; }
|
||||
enable_terminal="no"
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
if test "$enable_terminal" = "auto"; then
|
||||
enable_terminal="yes"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: defaulting to yes" >&5
|
||||
$as_echo "defaulting to yes" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
fi
|
||||
fi
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
if test "$enable_terminal" = "auto"; then
|
||||
enable_terminal="no"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: defaulting to no" >&5
|
||||
$as_echo "defaulting to no" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
fi
|
||||
if test "$enable_terminal" = "yes"; then
|
||||
$as_echo "#define FEAT_TERMINAL 1" >>confdefs.h
|
||||
|
||||
+65
-14
@@ -473,8 +473,8 @@ close_buffer(
|
||||
{
|
||||
if (term_job_running(buf->b_term))
|
||||
{
|
||||
if (wipe_buf)
|
||||
/* Wiping out a terminal buffer kills the job. */
|
||||
if (wipe_buf || unload_buf)
|
||||
/* Wiping out or unloading a terminal buffer kills the job. */
|
||||
free_terminal(buf);
|
||||
else
|
||||
{
|
||||
@@ -1652,7 +1652,7 @@ do_buffer(
|
||||
if (bufIsChanged(curbuf))
|
||||
#endif
|
||||
{
|
||||
EMSG(_(e_nowrtmsg));
|
||||
no_write_message();
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -1901,6 +1901,28 @@ do_autochdir(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
no_write_message(void)
|
||||
{
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (term_job_running(curbuf->b_term))
|
||||
EMSG(_("E948: Job still running (add ! to end the job)"));
|
||||
else
|
||||
#endif
|
||||
EMSG(_("E37: No write since last change (add ! to override)"));
|
||||
}
|
||||
|
||||
void
|
||||
no_write_message_nobang(void)
|
||||
{
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (term_job_running(curbuf->b_term))
|
||||
EMSG(_("E948: Job still running"));
|
||||
else
|
||||
#endif
|
||||
EMSG(_("E37: No write since last change"));
|
||||
}
|
||||
|
||||
/*
|
||||
* functions for dealing with the buffer list
|
||||
*/
|
||||
@@ -3038,6 +3060,8 @@ buflist_list(exarg_T *eap)
|
||||
buf_T *buf;
|
||||
int len;
|
||||
int i;
|
||||
int ro_char;
|
||||
int changed_char;
|
||||
|
||||
for (buf = firstbuf; buf != NULL && !got_int; buf = buf->b_next)
|
||||
{
|
||||
@@ -3064,6 +3088,21 @@ buflist_list(exarg_T *eap)
|
||||
if (message_filtered(NameBuff))
|
||||
continue;
|
||||
|
||||
changed_char = (buf->b_flags & BF_READERR) ? 'x'
|
||||
: (bufIsChanged(buf) ? '+' : ' ');
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (term_job_running(buf->b_term))
|
||||
{
|
||||
ro_char = 'R';
|
||||
changed_char = ' '; /* bufIsChanged() returns TRUE to avoid
|
||||
* closing, but it's not actually changed. */
|
||||
}
|
||||
else if (buf->b_term != NULL)
|
||||
ro_char = 'F';
|
||||
else
|
||||
#endif
|
||||
ro_char = !buf->b_p_ma ? '-' : (buf->b_p_ro ? '=' : ' ');
|
||||
|
||||
msg_putchar('\n');
|
||||
len = vim_snprintf((char *)IObuff, IOSIZE - 20, "%3d%c%c%c%c%c \"%s\"",
|
||||
buf->b_fnum,
|
||||
@@ -3072,9 +3111,8 @@ buflist_list(exarg_T *eap)
|
||||
(curwin->w_alt_fnum == buf->b_fnum ? '#' : ' '),
|
||||
buf->b_ml.ml_mfp == NULL ? ' ' :
|
||||
(buf->b_nwindows == 0 ? 'h' : 'a'),
|
||||
!buf->b_p_ma ? '-' : (buf->b_p_ro ? '=' : ' '),
|
||||
(buf->b_flags & BF_READERR) ? 'x'
|
||||
: (bufIsChanged(buf) ? '+' : ' '),
|
||||
ro_char,
|
||||
changed_char,
|
||||
NameBuff);
|
||||
if (len > IOSIZE - 20)
|
||||
len = IOSIZE - 20;
|
||||
@@ -3887,8 +3925,8 @@ build_stl_str_hl(
|
||||
char_u *t;
|
||||
int byteval;
|
||||
#ifdef FEAT_EVAL
|
||||
win_T *o_curwin;
|
||||
buf_T *o_curbuf;
|
||||
win_T *save_curwin;
|
||||
buf_T *save_curbuf;
|
||||
#endif
|
||||
int empty_line;
|
||||
colnr_T virtcol;
|
||||
@@ -3930,6 +3968,9 @@ build_stl_str_hl(
|
||||
char_u tmp[TMPLEN];
|
||||
char_u *usefmt = fmt;
|
||||
struct stl_hlrec *sp;
|
||||
int save_must_redraw = must_redraw;
|
||||
int save_redr_type = curwin->w_redr_type;
|
||||
int save_highlight_shcnaged = need_highlight_changed;
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
/*
|
||||
@@ -4239,15 +4280,15 @@ build_stl_str_hl(
|
||||
vim_snprintf((char *)tmp, sizeof(tmp), "%d", curbuf->b_fnum);
|
||||
set_internal_string_var((char_u *)"actual_curbuf", tmp);
|
||||
|
||||
o_curbuf = curbuf;
|
||||
o_curwin = curwin;
|
||||
save_curbuf = curbuf;
|
||||
save_curwin = curwin;
|
||||
curwin = wp;
|
||||
curbuf = wp->w_buffer;
|
||||
|
||||
str = eval_to_string_safe(p, &t, use_sandbox);
|
||||
|
||||
curwin = o_curwin;
|
||||
curbuf = o_curbuf;
|
||||
curwin = save_curwin;
|
||||
curbuf = save_curbuf;
|
||||
do_unlet((char_u *)"g:actual_curbuf", TRUE);
|
||||
|
||||
if (str != NULL && *str != 0)
|
||||
@@ -4702,6 +4743,13 @@ build_stl_str_hl(
|
||||
sp->userhl = 0;
|
||||
}
|
||||
|
||||
/* We do not want redrawing a stausline, ruler, title, etc. to trigger
|
||||
* another redraw, it may cause an endless loop. This happens when a
|
||||
* statusline changes a highlight group. */
|
||||
must_redraw = save_must_redraw;
|
||||
curwin->w_redr_type = save_redr_type;
|
||||
need_highlight_changed = save_highlight_shcnaged;
|
||||
|
||||
return width;
|
||||
}
|
||||
#endif /* FEAT_STL_OPT */
|
||||
@@ -5668,6 +5716,9 @@ write_viminfo_bufferlist(FILE *fp)
|
||||
|| !buf->b_p_bl
|
||||
#ifdef FEAT_QUICKFIX
|
||||
|| bt_quickfix(buf)
|
||||
#endif
|
||||
#ifdef FEAT_TERMINAL
|
||||
|| bt_terminal(buf)
|
||||
#endif
|
||||
|| removable(buf->b_ffname))
|
||||
continue;
|
||||
@@ -5794,8 +5845,8 @@ buf_spname(buf_T *buf)
|
||||
if (buf->b_term != NULL)
|
||||
return term_get_status_text(buf->b_term);
|
||||
#endif
|
||||
if (buf->b_sfname != NULL)
|
||||
return buf->b_sfname;
|
||||
if (buf->b_fname != NULL)
|
||||
return buf->b_fname;
|
||||
return (char_u *)_("[Scratch]");
|
||||
}
|
||||
|
||||
|
||||
+524
-112
@@ -508,6 +508,10 @@ channel_gui_register_one(channel_T *channel, ch_part_T part)
|
||||
if (!CH_HAS_GUI)
|
||||
return;
|
||||
|
||||
/* gets stuck in handling events for a not connected channel */
|
||||
if (channel->ch_keep_open)
|
||||
return;
|
||||
|
||||
# ifdef FEAT_GUI_X11
|
||||
/* Tell notifier we are interested in being called
|
||||
* when there is input on the editor connection socket. */
|
||||
@@ -561,9 +565,12 @@ channel_gui_register(channel_T *channel)
|
||||
{
|
||||
if (channel->CH_SOCK_FD != INVALID_FD)
|
||||
channel_gui_register_one(channel, PART_SOCK);
|
||||
if (channel->CH_OUT_FD != INVALID_FD)
|
||||
if (channel->CH_OUT_FD != INVALID_FD
|
||||
&& channel->CH_OUT_FD != channel->CH_SOCK_FD)
|
||||
channel_gui_register_one(channel, PART_OUT);
|
||||
if (channel->CH_ERR_FD != INVALID_FD)
|
||||
if (channel->CH_ERR_FD != INVALID_FD
|
||||
&& channel->CH_ERR_FD != channel->CH_SOCK_FD
|
||||
&& channel->CH_ERR_FD != channel->CH_OUT_FD)
|
||||
channel_gui_register_one(channel, PART_ERR);
|
||||
}
|
||||
|
||||
@@ -948,7 +955,7 @@ channel_open_func(typval_T *argvars)
|
||||
opt.jo_mode = MODE_JSON;
|
||||
opt.jo_timeout = 2000;
|
||||
if (get_job_options(&argvars[1], &opt,
|
||||
JO_MODE_ALL + JO_CB_ALL + JO_WAITTIME + JO_TIMEOUT_ALL) == FAIL)
|
||||
JO_MODE_ALL + JO_CB_ALL + JO_WAITTIME + JO_TIMEOUT_ALL, 0) == FAIL)
|
||||
goto theend;
|
||||
if (opt.jo_timeout < 0)
|
||||
{
|
||||
@@ -983,7 +990,13 @@ ch_close_part(channel_T *channel, ch_part_T part)
|
||||
if ((part == PART_IN || channel->CH_IN_FD != *fd)
|
||||
&& (part == PART_OUT || channel->CH_OUT_FD != *fd)
|
||||
&& (part == PART_ERR || channel->CH_ERR_FD != *fd))
|
||||
{
|
||||
#ifdef WIN32
|
||||
if (channel->ch_named_pipe)
|
||||
DisconnectNamedPipe((HANDLE)fd);
|
||||
#endif
|
||||
fd_close(*fd);
|
||||
}
|
||||
}
|
||||
*fd = INVALID_FD;
|
||||
|
||||
@@ -1314,11 +1327,16 @@ write_buf_line(buf_T *buf, linenr_T lnum, channel_T *channel)
|
||||
return;
|
||||
memcpy((char *)p, (char *)line, len);
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
if (p[i] == NL)
|
||||
p[i] = NUL;
|
||||
if (channel->ch_write_text_mode)
|
||||
p[len] = CAR;
|
||||
else
|
||||
{
|
||||
for (i = 0; i < len; ++i)
|
||||
if (p[i] == NL)
|
||||
p[i] = NUL;
|
||||
|
||||
p[len] = NL;
|
||||
p[len] = NL;
|
||||
}
|
||||
p[len + 1] = NUL;
|
||||
channel_send(channel, PART_IN, p, len + 1, "write_buf_line");
|
||||
vim_free(p);
|
||||
@@ -1394,7 +1412,7 @@ can_write_buf_line(channel_T *channel)
|
||||
}
|
||||
|
||||
/*
|
||||
* Write any lines to the input channel.
|
||||
* Write any buffer lines to the input channel.
|
||||
*/
|
||||
static void
|
||||
channel_write_in(channel_T *channel)
|
||||
@@ -1431,6 +1449,12 @@ channel_write_in(channel_T *channel)
|
||||
in_part->ch_buf_top = lnum;
|
||||
if (lnum > buf->b_ml.ml_line_count || lnum > in_part->ch_buf_bot)
|
||||
{
|
||||
#if defined(FEAT_TERMINAL)
|
||||
/* Send CTRL-D or "eof_chars" to close stdin on MS-Windows. */
|
||||
if (channel->ch_job != NULL)
|
||||
term_send_eof(channel);
|
||||
#endif
|
||||
|
||||
/* Writing is done, no longer need the buffer. */
|
||||
in_part->ch_bufref.br_buf = NULL;
|
||||
ch_log(channel, "Finished writing all lines to channel");
|
||||
@@ -1466,6 +1490,25 @@ channel_buffer_free(buf_T *buf)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Write any lines waiting to be written to "channel".
|
||||
*/
|
||||
static void
|
||||
channel_write_input(channel_T *channel)
|
||||
{
|
||||
chanpart_T *in_part = &channel->ch_part[PART_IN];
|
||||
|
||||
if (in_part->ch_writeque.wq_next != NULL)
|
||||
channel_send(channel, PART_IN, (char_u *)"", 0, "channel_write_input");
|
||||
else if (in_part->ch_bufref.br_buf != NULL)
|
||||
{
|
||||
if (in_part->ch_buf_append)
|
||||
channel_write_new_lines(in_part->ch_bufref.br_buf);
|
||||
else
|
||||
channel_write_in(channel);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Write any lines waiting to be written to a channel.
|
||||
*/
|
||||
@@ -1475,17 +1518,7 @@ channel_write_any_lines(void)
|
||||
channel_T *channel;
|
||||
|
||||
for (channel = first_channel; channel != NULL; channel = channel->ch_next)
|
||||
{
|
||||
chanpart_T *in_part = &channel->ch_part[PART_IN];
|
||||
|
||||
if (in_part->ch_bufref.br_buf != NULL)
|
||||
{
|
||||
if (in_part->ch_buf_append)
|
||||
channel_write_new_lines(in_part->ch_bufref.br_buf);
|
||||
else
|
||||
channel_write_in(channel);
|
||||
}
|
||||
}
|
||||
channel_write_input(channel);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2892,7 +2925,7 @@ channel_close(channel_T *channel, int invoke_close_cb)
|
||||
if (channel_need_redraw)
|
||||
{
|
||||
channel_need_redraw = FALSE;
|
||||
redraw_after_callback();
|
||||
redraw_after_callback(TRUE);
|
||||
}
|
||||
|
||||
if (!channel->ch_drop_never)
|
||||
@@ -2918,14 +2951,27 @@ channel_close_in(channel_T *channel)
|
||||
ch_close_part(channel, PART_IN);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_from_writeque(writeq_T *wq, writeq_T *entry)
|
||||
{
|
||||
ga_clear(&entry->wq_ga);
|
||||
wq->wq_next = entry->wq_next;
|
||||
if (wq->wq_next == NULL)
|
||||
wq->wq_prev = NULL;
|
||||
else
|
||||
wq->wq_next->wq_prev = NULL;
|
||||
vim_free(entry);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear the read buffer on "channel"/"part".
|
||||
*/
|
||||
static void
|
||||
channel_clear_one(channel_T *channel, ch_part_T part)
|
||||
{
|
||||
jsonq_T *json_head = &channel->ch_part[part].ch_json_head;
|
||||
cbq_T *cb_head = &channel->ch_part[part].ch_cb_head;
|
||||
chanpart_T *ch_part = &channel->ch_part[part];
|
||||
jsonq_T *json_head = &ch_part->ch_json_head;
|
||||
cbq_T *cb_head = &ch_part->ch_cb_head;
|
||||
|
||||
while (channel_peek(channel, part) != NULL)
|
||||
vim_free(channel_get(channel, part));
|
||||
@@ -2945,10 +2991,13 @@ channel_clear_one(channel_T *channel, ch_part_T part)
|
||||
remove_json_node(json_head, json_head->jq_next);
|
||||
}
|
||||
|
||||
free_callback(channel->ch_part[part].ch_callback,
|
||||
channel->ch_part[part].ch_partial);
|
||||
channel->ch_part[part].ch_callback = NULL;
|
||||
channel->ch_part[part].ch_partial = NULL;
|
||||
free_callback(ch_part->ch_callback, ch_part->ch_partial);
|
||||
ch_part->ch_callback = NULL;
|
||||
ch_part->ch_partial = NULL;
|
||||
|
||||
while (ch_part->ch_writeque.wq_next != NULL)
|
||||
remove_from_writeque(&ch_part->ch_writeque,
|
||||
ch_part->ch_writeque.wq_next);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2963,7 +3012,7 @@ channel_clear(channel_T *channel)
|
||||
channel_clear_one(channel, PART_SOCK);
|
||||
channel_clear_one(channel, PART_OUT);
|
||||
channel_clear_one(channel, PART_ERR);
|
||||
/* there is no callback or queue for PART_IN */
|
||||
channel_clear_one(channel, PART_IN);
|
||||
free_callback(channel->ch_callback, channel->ch_partial);
|
||||
channel->ch_callback = NULL;
|
||||
channel->ch_partial = NULL;
|
||||
@@ -3005,7 +3054,9 @@ channel_fill_wfds(int maxfd_arg, fd_set *wfds)
|
||||
{
|
||||
chanpart_T *in_part = &ch->ch_part[PART_IN];
|
||||
|
||||
if (in_part->ch_fd != INVALID_FD && in_part->ch_bufref.br_buf != NULL)
|
||||
if (in_part->ch_fd != INVALID_FD
|
||||
&& (in_part->ch_bufref.br_buf != NULL
|
||||
|| in_part->ch_writeque.wq_next != NULL))
|
||||
{
|
||||
FD_SET((int)in_part->ch_fd, wfds);
|
||||
if ((int)in_part->ch_fd >= maxfd)
|
||||
@@ -3028,7 +3079,9 @@ channel_fill_poll_write(int nfd_in, struct pollfd *fds)
|
||||
{
|
||||
chanpart_T *in_part = &ch->ch_part[PART_IN];
|
||||
|
||||
if (in_part->ch_fd != INVALID_FD && in_part->ch_bufref.br_buf != NULL)
|
||||
if (in_part->ch_fd != INVALID_FD
|
||||
&& (in_part->ch_bufref.br_buf != NULL
|
||||
|| in_part->ch_writeque.wq_next != NULL))
|
||||
{
|
||||
in_part->ch_poll_idx = nfd;
|
||||
fds[nfd].fd = in_part->ch_fd;
|
||||
@@ -3076,7 +3129,20 @@ channel_wait(channel_T *channel, sock_T fd, int timeout)
|
||||
if (r && nread > 0)
|
||||
return CW_READY;
|
||||
if (r == 0)
|
||||
return CW_ERROR;
|
||||
{
|
||||
DWORD err = GetLastError();
|
||||
|
||||
if (err != ERROR_BAD_PIPE && err != ERROR_BROKEN_PIPE)
|
||||
return CW_ERROR;
|
||||
|
||||
if (channel->ch_named_pipe)
|
||||
{
|
||||
DisconnectNamedPipe((HANDLE)fd);
|
||||
ConnectNamedPipe((HANDLE)fd, NULL);
|
||||
}
|
||||
else
|
||||
return CW_ERROR;
|
||||
}
|
||||
|
||||
/* perhaps write some buffer lines */
|
||||
channel_write_any_lines();
|
||||
@@ -3259,11 +3325,13 @@ channel_read(channel_T *channel, ch_part_T part, char *func)
|
||||
|
||||
/* Reading a disconnection (readlen == 0), or an error. */
|
||||
if (readlen <= 0)
|
||||
ch_close_part_on_error(channel, part, (len < 0), func);
|
||||
|
||||
{
|
||||
if (!channel->ch_keep_open)
|
||||
ch_close_part_on_error(channel, part, (len < 0), func);
|
||||
}
|
||||
#if defined(CH_HAS_GUI) && defined(FEAT_GUI_GTK)
|
||||
/* signal the main loop that there is something to read */
|
||||
if (CH_HAS_GUI && gtk_main_level() > 0)
|
||||
else if (CH_HAS_GUI && gtk_main_level() > 0)
|
||||
/* signal the main loop that there is something to read */
|
||||
gtk_main_quit();
|
||||
#endif
|
||||
}
|
||||
@@ -3454,7 +3522,7 @@ common_channel_read(typval_T *argvars, typval_T *rettv, int raw)
|
||||
rettv->vval.v_string = NULL;
|
||||
|
||||
clear_job_options(&opt);
|
||||
if (get_job_options(&argvars[1], &opt, JO_TIMEOUT + JO_PART + JO_ID)
|
||||
if (get_job_options(&argvars[1], &opt, JO_TIMEOUT + JO_PART + JO_ID, 0)
|
||||
== FAIL)
|
||||
goto theend;
|
||||
|
||||
@@ -3521,13 +3589,14 @@ channel_fd2channel(sock_T fd, ch_part_T *partp)
|
||||
}
|
||||
# endif
|
||||
|
||||
# if defined(WIN32) || defined(PROTO)
|
||||
# if defined(WIN32) || defined(FEAT_GUI) || defined(PROTO)
|
||||
/*
|
||||
* Check the channels for anything that is ready to be read.
|
||||
* The data is put in the read queue.
|
||||
* if "only_keep_open" is TRUE only check channels where ch_keep_open is set.
|
||||
*/
|
||||
void
|
||||
channel_handle_events(void)
|
||||
channel_handle_events(int only_keep_open)
|
||||
{
|
||||
channel_T *channel;
|
||||
ch_part_T part;
|
||||
@@ -3535,6 +3604,9 @@ channel_handle_events(void)
|
||||
|
||||
for (channel = first_channel; channel != NULL; channel = channel->ch_next)
|
||||
{
|
||||
if (only_keep_open && !channel->ch_keep_open)
|
||||
continue;
|
||||
|
||||
/* check the socket and pipes */
|
||||
for (part = PART_SOCK; part < PART_IN; ++part)
|
||||
{
|
||||
@@ -3554,6 +3626,45 @@ channel_handle_events(void)
|
||||
}
|
||||
# endif
|
||||
|
||||
# if defined(FEAT_GUI) || defined(PROTO)
|
||||
/*
|
||||
* Return TRUE when there is any channel with a keep_open flag.
|
||||
*/
|
||||
int
|
||||
channel_any_keep_open()
|
||||
{
|
||||
channel_T *channel;
|
||||
|
||||
for (channel = first_channel; channel != NULL; channel = channel->ch_next)
|
||||
if (channel->ch_keep_open)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Set "channel"/"part" to non-blocking.
|
||||
* Only works for sockets and pipes.
|
||||
*/
|
||||
void
|
||||
channel_set_nonblock(channel_T *channel, ch_part_T part)
|
||||
{
|
||||
chanpart_T *ch_part = &channel->ch_part[part];
|
||||
int fd = ch_part->ch_fd;
|
||||
|
||||
if (fd != INVALID_FD)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
u_long val = 1;
|
||||
|
||||
ioctlsocket(fd, FIONBIO, &val);
|
||||
#else
|
||||
(void)fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||
#endif
|
||||
ch_part->ch_nonblocking = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Write "buf" (NUL terminated string) to "channel"/"part".
|
||||
* When "fun" is not NULL an error message might be given.
|
||||
@@ -3563,14 +3674,16 @@ channel_handle_events(void)
|
||||
channel_send(
|
||||
channel_T *channel,
|
||||
ch_part_T part,
|
||||
char_u *buf,
|
||||
int len,
|
||||
char_u *buf_arg,
|
||||
int len_arg,
|
||||
char *fun)
|
||||
{
|
||||
int res;
|
||||
sock_T fd;
|
||||
chanpart_T *ch_part = &channel->ch_part[part];
|
||||
int did_use_queue = FALSE;
|
||||
|
||||
fd = channel->ch_part[part].ch_fd;
|
||||
fd = ch_part->ch_fd;
|
||||
if (fd == INVALID_FD)
|
||||
{
|
||||
if (!channel->ch_error && fun != NULL)
|
||||
@@ -3586,29 +3699,149 @@ channel_send(
|
||||
{
|
||||
ch_log_lead("SEND ", channel);
|
||||
fprintf(log_fd, "'");
|
||||
ignored = (int)fwrite(buf, len, 1, log_fd);
|
||||
ignored = (int)fwrite(buf_arg, len_arg, 1, log_fd);
|
||||
fprintf(log_fd, "'\n");
|
||||
fflush(log_fd);
|
||||
did_log_msg = TRUE;
|
||||
}
|
||||
|
||||
if (part == PART_SOCK)
|
||||
res = sock_write(fd, (char *)buf, len);
|
||||
else
|
||||
res = fd_write(fd, (char *)buf, len);
|
||||
if (res != len)
|
||||
for (;;)
|
||||
{
|
||||
if (!channel->ch_error && fun != NULL)
|
||||
{
|
||||
ch_error(channel, "%s(): write failed", fun);
|
||||
EMSG2(_("E631: %s(): write failed"), fun);
|
||||
}
|
||||
channel->ch_error = TRUE;
|
||||
return FAIL;
|
||||
}
|
||||
writeq_T *wq = &ch_part->ch_writeque;
|
||||
char_u *buf;
|
||||
int len;
|
||||
|
||||
channel->ch_error = FALSE;
|
||||
return OK;
|
||||
if (wq->wq_next != NULL)
|
||||
{
|
||||
/* first write what was queued */
|
||||
buf = wq->wq_next->wq_ga.ga_data;
|
||||
len = wq->wq_next->wq_ga.ga_len;
|
||||
did_use_queue = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (len_arg == 0)
|
||||
/* nothing to write, called from channel_select_check() */
|
||||
return OK;
|
||||
buf = buf_arg;
|
||||
len = len_arg;
|
||||
}
|
||||
|
||||
if (part == PART_SOCK)
|
||||
res = sock_write(fd, (char *)buf, len);
|
||||
else
|
||||
{
|
||||
res = fd_write(fd, (char *)buf, len);
|
||||
#ifdef WIN32
|
||||
if (channel->ch_named_pipe && res < 0)
|
||||
{
|
||||
DisconnectNamedPipe((HANDLE)fd);
|
||||
ConnectNamedPipe((HANDLE)fd, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
if (res < 0 && (errno == EWOULDBLOCK
|
||||
#ifdef EAGAIN
|
||||
|| errno == EAGAIN
|
||||
#endif
|
||||
))
|
||||
res = 0; /* nothing got written */
|
||||
|
||||
if (res >= 0 && ch_part->ch_nonblocking)
|
||||
{
|
||||
writeq_T *entry = wq->wq_next;
|
||||
|
||||
if (did_use_queue)
|
||||
ch_log(channel, "Sent %d bytes now", res);
|
||||
if (res == len)
|
||||
{
|
||||
/* Wrote all the buf[len] bytes. */
|
||||
if (entry != NULL)
|
||||
{
|
||||
/* Remove the entry from the write queue. */
|
||||
remove_from_writeque(wq, entry);
|
||||
continue;
|
||||
}
|
||||
if (did_use_queue)
|
||||
ch_log(channel, "Write queue empty");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Wrote only buf[res] bytes, can't write more now. */
|
||||
if (entry != NULL)
|
||||
{
|
||||
if (res > 0)
|
||||
{
|
||||
/* Remove the bytes that were written. */
|
||||
mch_memmove(entry->wq_ga.ga_data,
|
||||
(char *)entry->wq_ga.ga_data + res,
|
||||
len - res);
|
||||
entry->wq_ga.ga_len -= res;
|
||||
}
|
||||
buf = buf_arg;
|
||||
len = len_arg;
|
||||
}
|
||||
else
|
||||
{
|
||||
buf += res;
|
||||
len -= res;
|
||||
}
|
||||
ch_log(channel, "Adding %d bytes to the write queue", len);
|
||||
|
||||
/* Append the not written bytes of the argument to the write
|
||||
* buffer. Limit entries to 4000 bytes. */
|
||||
if (wq->wq_prev != NULL
|
||||
&& wq->wq_prev->wq_ga.ga_len + len < 4000)
|
||||
{
|
||||
writeq_T *last = wq->wq_prev;
|
||||
|
||||
/* append to the last entry */
|
||||
if (ga_grow(&last->wq_ga, len) == OK)
|
||||
{
|
||||
mch_memmove((char *)last->wq_ga.ga_data
|
||||
+ last->wq_ga.ga_len,
|
||||
buf, len);
|
||||
last->wq_ga.ga_len += len;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
writeq_T *last = (writeq_T *)alloc((int)sizeof(writeq_T));
|
||||
|
||||
if (last != NULL)
|
||||
{
|
||||
last->wq_prev = wq->wq_prev;
|
||||
last->wq_next = NULL;
|
||||
if (wq->wq_prev == NULL)
|
||||
wq->wq_next = last;
|
||||
else
|
||||
wq->wq_prev->wq_next = last;
|
||||
wq->wq_prev = last;
|
||||
ga_init2(&last->wq_ga, 1, 1000);
|
||||
if (ga_grow(&last->wq_ga, len) == OK)
|
||||
{
|
||||
mch_memmove(last->wq_ga.ga_data, buf, len);
|
||||
last->wq_ga.ga_len = len;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (res != len)
|
||||
{
|
||||
if (!channel->ch_error && fun != NULL)
|
||||
{
|
||||
ch_error(channel, "%s(): write failed", fun);
|
||||
EMSG2(_("E631: %s(): write failed"), fun);
|
||||
}
|
||||
channel->ch_error = TRUE;
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
channel->ch_error = FALSE;
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3637,7 +3870,7 @@ send_common(
|
||||
part_send = channel_part_send(channel);
|
||||
*part_read = channel_part_read(channel);
|
||||
|
||||
if (get_job_options(&argvars[2], opt, JO_CALLBACK + JO_TIMEOUT) == FAIL)
|
||||
if (get_job_options(&argvars[2], opt, JO_CALLBACK + JO_TIMEOUT, 0) == FAIL)
|
||||
return NULL;
|
||||
|
||||
/* Set the callback. An empty callback means no callback and not reading
|
||||
@@ -3820,13 +4053,7 @@ channel_poll_check(int ret_in, void *fds_in)
|
||||
idx = in_part->ch_poll_idx;
|
||||
if (ret > 0 && idx != -1 && (fds[idx].revents & POLLOUT))
|
||||
{
|
||||
if (in_part->ch_buf_append)
|
||||
{
|
||||
if (in_part->ch_bufref.br_buf != NULL)
|
||||
channel_write_new_lines(in_part->ch_bufref.br_buf);
|
||||
}
|
||||
else
|
||||
channel_write_in(channel);
|
||||
channel_write_input(channel);
|
||||
--ret;
|
||||
}
|
||||
}
|
||||
@@ -3890,6 +4117,7 @@ channel_select_check(int ret_in, void *rfds_in, void *wfds_in)
|
||||
if (ret > 0 && fd != INVALID_FD && FD_ISSET(fd, rfds))
|
||||
{
|
||||
channel_read(channel, part, "channel_select_check");
|
||||
FD_CLR(fd, rfds);
|
||||
--ret;
|
||||
}
|
||||
}
|
||||
@@ -3898,13 +4126,8 @@ channel_select_check(int ret_in, void *rfds_in, void *wfds_in)
|
||||
if (ret > 0 && in_part->ch_fd != INVALID_FD
|
||||
&& FD_ISSET(in_part->ch_fd, wfds))
|
||||
{
|
||||
if (in_part->ch_buf_append)
|
||||
{
|
||||
if (in_part->ch_bufref.br_buf != NULL)
|
||||
channel_write_new_lines(in_part->ch_bufref.br_buf);
|
||||
}
|
||||
else
|
||||
channel_write_in(channel);
|
||||
channel_write_input(channel);
|
||||
FD_CLR(in_part->ch_fd, wfds);
|
||||
--ret;
|
||||
}
|
||||
}
|
||||
@@ -4001,7 +4224,7 @@ channel_parse_messages(void)
|
||||
if (channel_need_redraw)
|
||||
{
|
||||
channel_need_redraw = FALSE;
|
||||
redraw_after_callback();
|
||||
redraw_after_callback(TRUE);
|
||||
}
|
||||
|
||||
--safe_to_invoke_callback;
|
||||
@@ -4178,6 +4401,8 @@ free_job_options(jobopt_T *opt)
|
||||
partial_unref(opt->jo_exit_partial);
|
||||
else if (opt->jo_exit_cb != NULL)
|
||||
func_unref(opt->jo_exit_cb);
|
||||
if (opt->jo_env != NULL)
|
||||
dict_unref(opt->jo_env);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4192,11 +4417,11 @@ part_from_char(int c)
|
||||
/*
|
||||
* Get the option entries from the dict in "tv", parse them and put the result
|
||||
* in "opt".
|
||||
* Only accept options in "supported".
|
||||
* Only accept JO_ options in "supported" and JO2_ options in "supported2".
|
||||
* If an option value is invalid return FAIL.
|
||||
*/
|
||||
int
|
||||
get_job_options(typval_T *tv, jobopt_T *opt, int supported)
|
||||
get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
|
||||
{
|
||||
typval_T *item;
|
||||
char_u *val;
|
||||
@@ -4434,7 +4659,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
|
||||
#ifdef FEAT_TERMINAL
|
||||
else if (STRCMP(hi->hi_key, "term_name") == 0)
|
||||
{
|
||||
if (!(supported & JO2_TERM_NAME))
|
||||
if (!(supported2 & JO2_TERM_NAME))
|
||||
break;
|
||||
opt->jo_set2 |= JO2_TERM_NAME;
|
||||
opt->jo_term_name = get_tv_string_chk(item);
|
||||
@@ -4444,7 +4669,111 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
else if (STRCMP(hi->hi_key, "term_finish") == 0)
|
||||
{
|
||||
if (!(supported2 & JO2_TERM_FINISH))
|
||||
break;
|
||||
val = get_tv_string(item);
|
||||
if (STRCMP(val, "open") != 0 && STRCMP(val, "close") != 0)
|
||||
{
|
||||
EMSG2(_(e_invarg2), val);
|
||||
return FAIL;
|
||||
}
|
||||
opt->jo_set2 |= JO2_TERM_FINISH;
|
||||
opt->jo_term_finish = *val;
|
||||
}
|
||||
else if (STRCMP(hi->hi_key, "term_opencmd") == 0)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
if (!(supported2 & JO2_TERM_OPENCMD))
|
||||
break;
|
||||
opt->jo_set2 |= JO2_TERM_OPENCMD;
|
||||
p = opt->jo_term_opencmd = get_tv_string_chk(item);
|
||||
if (p != NULL)
|
||||
{
|
||||
/* Must have %d and no other %. */
|
||||
p = vim_strchr(p, '%');
|
||||
if (p != NULL && (p[1] != 'd'
|
||||
|| vim_strchr(p + 2, '%') != NULL))
|
||||
p = NULL;
|
||||
}
|
||||
if (p == NULL)
|
||||
{
|
||||
EMSG2(_(e_invarg2), "term_opencmd");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
else if (STRCMP(hi->hi_key, "eof_chars") == 0)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
if (!(supported2 & JO2_EOF_CHARS))
|
||||
break;
|
||||
opt->jo_set2 |= JO2_EOF_CHARS;
|
||||
p = opt->jo_eof_chars = get_tv_string_chk(item);
|
||||
if (p == NULL)
|
||||
{
|
||||
EMSG2(_(e_invarg2), "term_opencmd");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
else if (STRCMP(hi->hi_key, "term_rows") == 0)
|
||||
{
|
||||
if (!(supported2 & JO2_TERM_ROWS))
|
||||
break;
|
||||
opt->jo_set |= JO2_TERM_ROWS;
|
||||
opt->jo_term_rows = get_tv_number(item);
|
||||
}
|
||||
else if (STRCMP(hi->hi_key, "term_cols") == 0)
|
||||
{
|
||||
if (!(supported2 & JO2_TERM_COLS))
|
||||
break;
|
||||
opt->jo_set |= JO2_TERM_COLS;
|
||||
opt->jo_term_cols = get_tv_number(item);
|
||||
}
|
||||
else if (STRCMP(hi->hi_key, "vertical") == 0)
|
||||
{
|
||||
if (!(supported2 & JO2_VERTICAL))
|
||||
break;
|
||||
opt->jo_set |= JO2_VERTICAL;
|
||||
opt->jo_vertical = get_tv_number(item);
|
||||
}
|
||||
else if (STRCMP(hi->hi_key, "curwin") == 0)
|
||||
{
|
||||
if (!(supported2 & JO2_CURWIN))
|
||||
break;
|
||||
opt->jo_set |= JO2_CURWIN;
|
||||
opt->jo_curwin = get_tv_number(item);
|
||||
}
|
||||
else if (STRCMP(hi->hi_key, "hidden") == 0)
|
||||
{
|
||||
if (!(supported2 & JO2_HIDDEN))
|
||||
break;
|
||||
opt->jo_set |= JO2_HIDDEN;
|
||||
opt->jo_hidden = get_tv_number(item);
|
||||
}
|
||||
#endif
|
||||
else if (STRCMP(hi->hi_key, "env") == 0)
|
||||
{
|
||||
if (!(supported2 & JO2_ENV))
|
||||
break;
|
||||
opt->jo_set |= JO2_ENV;
|
||||
opt->jo_env = item->vval.v_dict;
|
||||
++item->vval.v_dict->dv_refcount;
|
||||
}
|
||||
else if (STRCMP(hi->hi_key, "cwd") == 0)
|
||||
{
|
||||
if (!(supported2 & JO2_CWD))
|
||||
break;
|
||||
opt->jo_cwd = get_tv_string_buf_chk(item, opt->jo_cwd_buf);
|
||||
if (opt->jo_cwd == NULL || !mch_isdir(opt->jo_cwd))
|
||||
{
|
||||
EMSG2(_(e_invarg2), "cwd");
|
||||
return FAIL;
|
||||
}
|
||||
opt->jo_set |= JO2_CWD;
|
||||
}
|
||||
else if (STRCMP(hi->hi_key, "waittime") == 0)
|
||||
{
|
||||
if (!(supported & JO_WAITTIME))
|
||||
@@ -4587,7 +4916,8 @@ job_free_contents(job_T *job)
|
||||
}
|
||||
mch_clear_job(job);
|
||||
|
||||
vim_free(job->jv_tty_name);
|
||||
vim_free(job->jv_tty_in);
|
||||
vim_free(job->jv_tty_out);
|
||||
vim_free(job->jv_stoponexit);
|
||||
free_callback(job->jv_exit_cb, job->jv_exit_partial);
|
||||
}
|
||||
@@ -4653,6 +4983,111 @@ job_still_useful(job_T *job)
|
||||
return job_need_end_check(job) || job_channel_still_useful(job);
|
||||
}
|
||||
|
||||
#if !defined(USE_ARGV) || defined(PROTO)
|
||||
/*
|
||||
* Escape one argument for an external command.
|
||||
* Returns the escaped string in allocated memory. NULL when out of memory.
|
||||
*/
|
||||
static char_u *
|
||||
win32_escape_arg(char_u *arg)
|
||||
{
|
||||
int slen, dlen;
|
||||
int escaping = 0;
|
||||
int i;
|
||||
char_u *s, *d;
|
||||
char_u *escaped_arg;
|
||||
int has_spaces = FALSE;
|
||||
|
||||
/* First count the number of extra bytes required. */
|
||||
slen = (int)STRLEN(arg);
|
||||
dlen = slen;
|
||||
for (s = arg; *s != NUL; MB_PTR_ADV(s))
|
||||
{
|
||||
if (*s == '"' || *s == '\\')
|
||||
++dlen;
|
||||
if (*s == ' ' || *s == '\t')
|
||||
has_spaces = TRUE;
|
||||
}
|
||||
|
||||
if (has_spaces)
|
||||
dlen += 2;
|
||||
|
||||
if (dlen == slen)
|
||||
return vim_strsave(arg);
|
||||
|
||||
/* Allocate memory for the result and fill it. */
|
||||
escaped_arg = alloc(dlen + 1);
|
||||
if (escaped_arg == NULL)
|
||||
return NULL;
|
||||
memset(escaped_arg, 0, dlen+1);
|
||||
|
||||
d = escaped_arg;
|
||||
|
||||
if (has_spaces)
|
||||
*d++ = '"';
|
||||
|
||||
for (s = arg; *s != NUL;)
|
||||
{
|
||||
switch (*s)
|
||||
{
|
||||
case '"':
|
||||
for (i = 0; i < escaping; i++)
|
||||
*d++ = '\\';
|
||||
escaping = 0;
|
||||
*d++ = '\\';
|
||||
*d++ = *s++;
|
||||
break;
|
||||
case '\\':
|
||||
escaping++;
|
||||
*d++ = *s++;
|
||||
break;
|
||||
default:
|
||||
escaping = 0;
|
||||
MB_COPY_CHAR(s, d);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* add terminating quote and finish with a NUL */
|
||||
if (has_spaces)
|
||||
{
|
||||
for (i = 0; i < escaping; i++)
|
||||
*d++ = '\\';
|
||||
*d++ = '"';
|
||||
}
|
||||
*d = NUL;
|
||||
|
||||
return escaped_arg;
|
||||
}
|
||||
|
||||
/*
|
||||
* Build a command line from a list, taking care of escaping.
|
||||
* The result is put in gap->ga_data.
|
||||
* Returns FAIL when out of memory.
|
||||
*/
|
||||
int
|
||||
win32_build_cmd(list_T *l, garray_T *gap)
|
||||
{
|
||||
listitem_T *li;
|
||||
char_u *s;
|
||||
|
||||
for (li = l->lv_first; li != NULL; li = li->li_next)
|
||||
{
|
||||
s = get_tv_string_chk(&li->li_tv);
|
||||
if (s == NULL)
|
||||
return FAIL;
|
||||
s = win32_escape_arg(s);
|
||||
if (s == NULL)
|
||||
return FAIL;
|
||||
ga_concat(gap, s);
|
||||
vim_free(s);
|
||||
if (li->li_next != NULL)
|
||||
ga_append(gap, ' ');
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NOTE: Must call job_cleanup() only once right after the status of "job"
|
||||
* changed to JOB_ENDED (i.e. after job_status() returned "dead" first or
|
||||
@@ -4856,7 +5291,7 @@ job_stop_on_exit(void)
|
||||
|
||||
for (job = first_job; job != NULL; job = job->jv_next)
|
||||
if (job->jv_status == JOB_STARTED && job->jv_stoponexit != NULL)
|
||||
mch_stop_job(job, job->jv_stoponexit);
|
||||
mch_signal_job(job, job->jv_stoponexit);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4904,7 +5339,7 @@ job_check_ended(void)
|
||||
if (channel_need_redraw)
|
||||
{
|
||||
channel_need_redraw = FALSE;
|
||||
redraw_after_callback();
|
||||
redraw_after_callback(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4945,8 +5380,9 @@ job_start(typval_T *argvars, jobopt_T *opt_arg)
|
||||
clear_job_options(&opt);
|
||||
opt.jo_mode = MODE_NL;
|
||||
if (get_job_options(&argvars[1], &opt,
|
||||
JO_MODE_ALL + JO_CB_ALL + JO_TIMEOUT_ALL + JO_STOPONEXIT
|
||||
+ JO_EXIT_CB + JO_OUT_IO + JO_BLOCK_WRITE) == FAIL)
|
||||
JO_MODE_ALL + JO_CB_ALL + JO_TIMEOUT_ALL + JO_STOPONEXIT
|
||||
+ JO_EXIT_CB + JO_OUT_IO + JO_BLOCK_WRITE,
|
||||
JO2_ENV + JO2_CWD) == FAIL)
|
||||
goto theend;
|
||||
}
|
||||
|
||||
@@ -5025,51 +5461,25 @@ job_start(typval_T *argvars, jobopt_T *opt_arg)
|
||||
else
|
||||
{
|
||||
list_T *l = argvars[0].vval.v_list;
|
||||
#ifdef USE_ARGV
|
||||
listitem_T *li;
|
||||
char_u *s;
|
||||
|
||||
#ifdef USE_ARGV
|
||||
/* Pass argv[] to mch_call_shell(). */
|
||||
argv = (char **)alloc(sizeof(char *) * (l->lv_len + 1));
|
||||
if (argv == NULL)
|
||||
goto theend;
|
||||
#endif
|
||||
for (li = l->lv_first; li != NULL; li = li->li_next)
|
||||
{
|
||||
s = get_tv_string_chk(&li->li_tv);
|
||||
if (s == NULL)
|
||||
goto theend;
|
||||
#ifdef USE_ARGV
|
||||
argv[argc++] = (char *)s;
|
||||
#else
|
||||
/* Only escape when needed, double quotes are not always allowed. */
|
||||
if (li != l->lv_first && vim_strpbrk(s, (char_u *)" \t\"") != NULL)
|
||||
{
|
||||
# ifdef WIN32
|
||||
int old_ssl = p_ssl;
|
||||
|
||||
/* This is using CreateProcess, not cmd.exe. Always use
|
||||
* double quote and backslashes. */
|
||||
p_ssl = 0;
|
||||
# endif
|
||||
s = vim_strsave_shellescape(s, FALSE, TRUE);
|
||||
# ifdef WIN32
|
||||
p_ssl = old_ssl;
|
||||
# endif
|
||||
if (s == NULL)
|
||||
goto theend;
|
||||
ga_concat(&ga, s);
|
||||
vim_free(s);
|
||||
}
|
||||
else
|
||||
ga_concat(&ga, s);
|
||||
if (li->li_next != NULL)
|
||||
ga_append(&ga, ' ');
|
||||
#endif
|
||||
}
|
||||
#ifdef USE_ARGV
|
||||
argv[argc] = NULL;
|
||||
#else
|
||||
if (win32_build_cmd(l, &ga) == FAIL)
|
||||
goto theend;
|
||||
cmd = ga.ga_data;
|
||||
#endif
|
||||
}
|
||||
@@ -5161,8 +5571,10 @@ job_info(job_T *job, dict_T *dict)
|
||||
nr = job->jv_proc_info.dwProcessId;
|
||||
#endif
|
||||
dict_add_nr_str(dict, "process", nr, NULL);
|
||||
dict_add_nr_str(dict, "tty", 0L,
|
||||
job->jv_tty_name != NULL ? job->jv_tty_name : (char_u *)"");
|
||||
dict_add_nr_str(dict, "tty_in", 0L,
|
||||
job->jv_tty_in != NULL ? job->jv_tty_in : (char_u *)"");
|
||||
dict_add_nr_str(dict, "tty_out", 0L,
|
||||
job->jv_tty_out != NULL ? job->jv_tty_out : (char_u *)"");
|
||||
|
||||
dict_add_nr_str(dict, "exitval", job->jv_exitval, NULL);
|
||||
dict_add_nr_str(dict, "exit_cb", 0L, job->jv_exit_cb);
|
||||
@@ -5203,7 +5615,7 @@ job_stop(job_T *job, typval_T *argvars, char *type)
|
||||
return 0;
|
||||
}
|
||||
ch_log(job->jv_channel, "Stopping job with '%s'", (char *)arg);
|
||||
if (mch_stop_job(job, arg) == FAIL)
|
||||
if (mch_signal_job(job, arg) == FAIL)
|
||||
return 0;
|
||||
|
||||
/* Assume that only "kill" will kill the job. */
|
||||
|
||||
@@ -1535,6 +1535,22 @@ skipwhite(char_u *q)
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
* getwhitecols: return the number of whitespace
|
||||
* columns (bytes) at the start of a given line
|
||||
*/
|
||||
int
|
||||
getwhitecols_curline()
|
||||
{
|
||||
return getwhitecols(ml_get_curline());
|
||||
}
|
||||
|
||||
int
|
||||
getwhitecols(char_u *p)
|
||||
{
|
||||
return skipwhite(p) - p;
|
||||
}
|
||||
|
||||
/*
|
||||
* skip over digits
|
||||
*/
|
||||
|
||||
+14
-4
@@ -2095,16 +2095,26 @@ fi
|
||||
AC_MSG_CHECKING(--enable-terminal argument)
|
||||
AC_ARG_ENABLE(terminal,
|
||||
[ --enable-terminal Enable terminal emulation support.],
|
||||
[enable_terminal="yes"], )
|
||||
if test "$enable_terminal" = "yes"; then
|
||||
[enable_terminal="yes"], [enable_terminal="auto"])
|
||||
if test "$enable_terminal" = "yes" || test "$enable_terminal" = "auto" -a "x$features" = "xhuge" ; then
|
||||
if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
|
||||
AC_MSG_RESULT([cannot use terminal emulator with tiny or small features])
|
||||
enable_terminal="no"
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
if test "$enable_terminal" = "auto"; then
|
||||
enable_terminal="yes"
|
||||
AC_MSG_RESULT(defaulting to yes)
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$enable_terminal" = "auto"; then
|
||||
enable_terminal="no"
|
||||
AC_MSG_RESULT(defaulting to no)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
if test "$enable_terminal" = "yes"; then
|
||||
AC_DEFINE(FEAT_TERMINAL)
|
||||
|
||||
+52
-31
@@ -1660,6 +1660,40 @@ diff_equal_entry(diff_T *dp, int idx1, int idx2)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare the characters at "p1" and "p2". If they are equal (possibly
|
||||
* ignoring case) return TRUE and set "len" to the number of bytes.
|
||||
*/
|
||||
static int
|
||||
diff_equal_char(char_u *p1, char_u *p2, int *len)
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
int l = (*mb_ptr2len)(p1);
|
||||
|
||||
if (l != (*mb_ptr2len)(p2))
|
||||
return FALSE;
|
||||
if (l > 1)
|
||||
{
|
||||
if (STRNCMP(p1, p2, l) != 0
|
||||
&& (!enc_utf8
|
||||
|| !(diff_flags & DIFF_ICASE)
|
||||
|| utf_fold(utf_ptr2char(p1))
|
||||
!= utf_fold(utf_ptr2char(p2))))
|
||||
return FALSE;
|
||||
*len = l;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if ((*p1 != *p2)
|
||||
&& (!(diff_flags & DIFF_ICASE)
|
||||
|| TOLOWER_LOC(*p1) != TOLOWER_LOC(*p2)))
|
||||
return FALSE;
|
||||
*len = 1;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare strings "s1" and "s2" according to 'diffopt'.
|
||||
* Return non-zero when they are different.
|
||||
@@ -1668,9 +1702,7 @@ diff_equal_entry(diff_T *dp, int idx1, int idx2)
|
||||
diff_cmp(char_u *s1, char_u *s2)
|
||||
{
|
||||
char_u *p1, *p2;
|
||||
#ifdef FEAT_MBYTE
|
||||
int l;
|
||||
#endif
|
||||
|
||||
if ((diff_flags & (DIFF_ICASE | DIFF_IWHITE)) == 0)
|
||||
return STRCMP(s1, s2);
|
||||
@@ -1689,30 +1721,10 @@ diff_cmp(char_u *s1, char_u *s2)
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
l = (*mb_ptr2len)(p1);
|
||||
if (l != (*mb_ptr2len)(p2))
|
||||
if (!diff_equal_char(p1, p2, &l))
|
||||
break;
|
||||
if (l > 1)
|
||||
{
|
||||
if (STRNCMP(p1, p2, l) != 0
|
||||
&& (!enc_utf8
|
||||
|| !(diff_flags & DIFF_ICASE)
|
||||
|| utf_fold(utf_ptr2char(p1))
|
||||
!= utf_fold(utf_ptr2char(p2))))
|
||||
break;
|
||||
p1 += l;
|
||||
p2 += l;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (*p1 != *p2 && (!(diff_flags & DIFF_ICASE)
|
||||
|| TOLOWER_LOC(*p1) != TOLOWER_LOC(*p2)))
|
||||
break;
|
||||
++p1;
|
||||
++p2;
|
||||
}
|
||||
p1 += l;
|
||||
p2 += l;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1969,6 +1981,8 @@ diff_find_change(
|
||||
int idx;
|
||||
int off;
|
||||
int added = TRUE;
|
||||
char_u *p1, *p2;
|
||||
int l;
|
||||
|
||||
/* Make a copy of the line, the next ml_get() will invalidate it. */
|
||||
line_org = vim_strsave(ml_get_buf(wp->w_buffer, lnum, FALSE));
|
||||
@@ -2017,10 +2031,11 @@ diff_find_change(
|
||||
}
|
||||
else
|
||||
{
|
||||
if (line_org[si_org] != line_new[si_new])
|
||||
if (!diff_equal_char(line_org + si_org, line_new + si_new,
|
||||
&l))
|
||||
break;
|
||||
++si_org;
|
||||
++si_new;
|
||||
si_org += l;
|
||||
si_new += l;
|
||||
}
|
||||
}
|
||||
#ifdef FEAT_MBYTE
|
||||
@@ -2056,10 +2071,16 @@ diff_find_change(
|
||||
}
|
||||
else
|
||||
{
|
||||
if (line_org[ei_org] != line_new[ei_new])
|
||||
p1 = line_org + ei_org;
|
||||
p2 = line_new + ei_new;
|
||||
#ifdef FEAT_MBYTE
|
||||
p1 -= (*mb_head_off)(line_org, p1);
|
||||
p2 -= (*mb_head_off)(line_new, p2);
|
||||
#endif
|
||||
if (!diff_equal_char(p1, p2, &l))
|
||||
break;
|
||||
--ei_org;
|
||||
--ei_new;
|
||||
ei_org -= l;
|
||||
ei_new -= l;
|
||||
}
|
||||
}
|
||||
if (*endp < ei_org)
|
||||
|
||||
+9
-7
@@ -5196,7 +5196,7 @@ ins_complete(int c, int enable_pum)
|
||||
* first non_blank in the line, if it is not a wordchar
|
||||
* include it to get a better pattern, but then we don't
|
||||
* want the "\\<" prefix, check it bellow */
|
||||
compl_col = (colnr_T)(skipwhite(line) - line);
|
||||
compl_col = (colnr_T)getwhitecols(line);
|
||||
compl_startpos.col = compl_col;
|
||||
compl_startpos.lnum = curwin->w_cursor.lnum;
|
||||
compl_cont_status &= ~CONT_SOL; /* clear SOL if present */
|
||||
@@ -5362,7 +5362,7 @@ ins_complete(int c, int enable_pum)
|
||||
}
|
||||
else if (CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode))
|
||||
{
|
||||
compl_col = (colnr_T)(skipwhite(line) - line);
|
||||
compl_col = (colnr_T)getwhitecols(line);
|
||||
compl_length = (int)curs_col - (int)compl_col;
|
||||
if (compl_length < 0) /* cursor in indent: empty pattern */
|
||||
compl_length = 0;
|
||||
@@ -8222,8 +8222,7 @@ in_cinkeys(
|
||||
{
|
||||
/* "0=word": Check if there are only blanks before the
|
||||
* word. */
|
||||
line = ml_get_curline();
|
||||
if ((int)(skipwhite(line) - line) !=
|
||||
if (getwhitecols(line) !=
|
||||
(int)(curwin->w_cursor.col - (p - look)))
|
||||
match = FALSE;
|
||||
}
|
||||
@@ -9432,7 +9431,7 @@ ins_mousescroll(int dir)
|
||||
{
|
||||
pos_T tpos;
|
||||
# if defined(FEAT_WINDOWS)
|
||||
win_T *old_curwin = curwin;
|
||||
win_T *old_curwin = curwin, *wp;
|
||||
# endif
|
||||
# ifdef FEAT_INS_EXPAND
|
||||
int did_scroll = FALSE;
|
||||
@@ -9452,7 +9451,10 @@ ins_mousescroll(int dir)
|
||||
col = mouse_col;
|
||||
|
||||
/* find the window at the pointer coordinates */
|
||||
curwin = mouse_find_win(&row, &col);
|
||||
wp = mouse_find_win(&row, &col);
|
||||
if (wp == NULL)
|
||||
return;
|
||||
curwin = wp;
|
||||
curbuf = curwin->w_buffer;
|
||||
}
|
||||
if (curwin == old_curwin)
|
||||
@@ -9713,7 +9715,7 @@ ins_left(
|
||||
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
|
||||
/* Only call start_arrow() when not busy with preediting, it will
|
||||
* break undo. K_LEFT is inserted in im_correct_cursor(). */
|
||||
if (!im_is_preediting())
|
||||
if (p_imst == IM_OVER_THE_SPOT || !im_is_preediting())
|
||||
#endif
|
||||
{
|
||||
start_arrow_with_change(&tpos, end_change);
|
||||
|
||||
@@ -187,6 +187,10 @@ static struct vimvar
|
||||
{VV_NAME("t_none", VAR_NUMBER), VV_RO},
|
||||
{VV_NAME("t_job", VAR_NUMBER), VV_RO},
|
||||
{VV_NAME("t_channel", VAR_NUMBER), VV_RO},
|
||||
{VV_NAME("termrgbresp", VAR_STRING), VV_RO},
|
||||
{VV_NAME("termu7resp", VAR_STRING), VV_RO},
|
||||
{VV_NAME("termstyleresp", VAR_STRING), VV_RO},
|
||||
{VV_NAME("termblinkresp", VAR_STRING), VV_RO},
|
||||
};
|
||||
|
||||
/* shorthand */
|
||||
|
||||
+191
-91
@@ -328,6 +328,7 @@ static void f_searchpairpos(typval_T *argvars, typval_T *rettv);
|
||||
static void f_searchpos(typval_T *argvars, typval_T *rettv);
|
||||
static void f_server2client(typval_T *argvars, typval_T *rettv);
|
||||
static void f_serverlist(typval_T *argvars, typval_T *rettv);
|
||||
static void f_setbufline(typval_T *argvars, typval_T *rettv);
|
||||
static void f_setbufvar(typval_T *argvars, typval_T *rettv);
|
||||
static void f_setcharsearch(typval_T *argvars, typval_T *rettv);
|
||||
static void f_setcmdpos(typval_T *argvars, typval_T *rettv);
|
||||
@@ -392,6 +393,7 @@ static void f_tagfiles(typval_T *argvars, typval_T *rettv);
|
||||
static void f_tempname(typval_T *argvars, typval_T *rettv);
|
||||
static void f_test_alloc_fail(typval_T *argvars, typval_T *rettv);
|
||||
static void f_test_autochdir(typval_T *argvars, typval_T *rettv);
|
||||
static void f_test_feedinput(typval_T *argvars, typval_T *rettv);
|
||||
static void f_test_override(typval_T *argvars, typval_T *rettv);
|
||||
static void f_test_garbagecollect_now(typval_T *argvars, typval_T *rettv);
|
||||
static void f_test_ignore_error(typval_T *argvars, typval_T *rettv);
|
||||
@@ -764,6 +766,7 @@ static struct fst
|
||||
{"searchpos", 1, 4, f_searchpos},
|
||||
{"server2client", 2, 2, f_server2client},
|
||||
{"serverlist", 0, 0, f_serverlist},
|
||||
{"setbufline", 3, 3, f_setbufline},
|
||||
{"setbufvar", 3, 3, f_setbufvar},
|
||||
{"setcharsearch", 1, 1, f_setcharsearch},
|
||||
{"setcmdpos", 1, 1, f_setcmdpos},
|
||||
@@ -831,14 +834,16 @@ static struct fst
|
||||
#endif
|
||||
{"tempname", 0, 0, f_tempname},
|
||||
#ifdef FEAT_TERMINAL
|
||||
{"term_getaltscreen", 1, 1, f_term_getaltscreen},
|
||||
{"term_getattr", 2, 2, f_term_getattr},
|
||||
{"term_getcursor", 1, 1, f_term_getcursor},
|
||||
{"term_getjob", 1, 1, f_term_getjob},
|
||||
{"term_getline", 2, 2, f_term_getline},
|
||||
{"term_getscrolled", 1, 1, f_term_getscrolled},
|
||||
{"term_getsize", 1, 1, f_term_getsize},
|
||||
{"term_getstatus", 1, 1, f_term_getstatus},
|
||||
{"term_gettitle", 1, 1, f_term_gettitle},
|
||||
{"term_gettty", 1, 1, f_term_gettty},
|
||||
{"term_gettty", 1, 2, f_term_gettty},
|
||||
{"term_list", 0, 0, f_term_list},
|
||||
{"term_scrape", 2, 2, f_term_scrape},
|
||||
{"term_sendkeys", 2, 2, f_term_sendkeys},
|
||||
@@ -847,6 +852,7 @@ static struct fst
|
||||
#endif
|
||||
{"test_alloc_fail", 3, 3, f_test_alloc_fail},
|
||||
{"test_autochdir", 0, 0, f_test_autochdir},
|
||||
{"test_feedinput", 1, 1, f_test_feedinput},
|
||||
{"test_garbagecollect_now", 0, 0, f_test_garbagecollect_now},
|
||||
{"test_ignore_error", 1, 1, f_test_ignore_error},
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
@@ -2019,7 +2025,7 @@ f_ch_setoptions(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
return;
|
||||
clear_job_options(&opt);
|
||||
if (get_job_options(&argvars[1], &opt,
|
||||
JO_CB_ALL + JO_TIMEOUT_ALL + JO_MODE_ALL) == OK)
|
||||
JO_CB_ALL + JO_TIMEOUT_ALL + JO_MODE_ALL, 0) == OK)
|
||||
channel_set_options(channel, &opt);
|
||||
free_job_options(&opt);
|
||||
}
|
||||
@@ -2043,7 +2049,7 @@ f_ch_status(typval_T *argvars, typval_T *rettv)
|
||||
if (argvars[1].v_type != VAR_UNKNOWN)
|
||||
{
|
||||
clear_job_options(&opt);
|
||||
if (get_job_options(&argvars[1], &opt, JO_PART) == OK
|
||||
if (get_job_options(&argvars[1], &opt, JO_PART, 0) == OK
|
||||
&& (opt.jo_set & JO_PART))
|
||||
part = opt.jo_part;
|
||||
}
|
||||
@@ -4387,6 +4393,8 @@ f_getchar(typval_T *argvars, typval_T *rettv)
|
||||
/* Find the window at the mouse coordinates and compute the
|
||||
* text position. */
|
||||
win = mouse_find_win(&row, &col);
|
||||
if (win == NULL)
|
||||
return;
|
||||
(void)mouse_comp_pos(win, &row, &col, &lnum);
|
||||
# ifdef FEAT_WINDOWS
|
||||
for (wp = firstwin; wp != win; wp = wp->w_next)
|
||||
@@ -4813,7 +4821,7 @@ get_qf_loc_list(int is_qf, win_T *wp, typval_T *what_arg, typval_T *rettv)
|
||||
{
|
||||
if (rettv_list_alloc(rettv) == OK)
|
||||
if (is_qf || wp != NULL)
|
||||
(void)get_errorlist(wp, -1, rettv->vval.v_list);
|
||||
(void)get_errorlist(NULL, wp, -1, rettv->vval.v_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4825,7 +4833,7 @@ get_qf_loc_list(int is_qf, win_T *wp, typval_T *what_arg, typval_T *rettv)
|
||||
dict_T *d = what_arg->vval.v_dict;
|
||||
|
||||
if (d != NULL)
|
||||
get_errorlist_properties(wp, d, rettv->vval.v_dict);
|
||||
qf_get_properties(wp, d, rettv->vval.v_dict);
|
||||
}
|
||||
else
|
||||
EMSG(_(e_dictreq));
|
||||
@@ -5233,6 +5241,9 @@ get_win_info(win_T *wp, short tpnr, short winnr)
|
||||
dict_add_nr_str(dict, "width", wp->w_width, NULL);
|
||||
dict_add_nr_str(dict, "bufnr", wp->w_buffer->b_fnum, NULL);
|
||||
|
||||
#ifdef FEAT_TERMINAL
|
||||
dict_add_nr_str(dict, "terminal", bt_terminal(wp->w_buffer), NULL);
|
||||
#endif
|
||||
#ifdef FEAT_QUICKFIX
|
||||
dict_add_nr_str(dict, "quickfix", bt_quickfix(wp->w_buffer), NULL);
|
||||
dict_add_nr_str(dict, "loclist",
|
||||
@@ -5935,7 +5946,7 @@ f_has(typval_T *argvars, typval_T *rettv)
|
||||
#ifdef FEAT_TERMGUICOLORS
|
||||
"termguicolors",
|
||||
#endif
|
||||
#ifdef FEAT_TERMINAL
|
||||
#if defined(FEAT_TERMINAL) && !defined(WIN3264)
|
||||
"terminal",
|
||||
#endif
|
||||
#ifdef TERMINFO
|
||||
@@ -6145,6 +6156,10 @@ f_has(typval_T *argvars, typval_T *rettv)
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
else if (STRICMP(name, "netbeans_enabled") == 0)
|
||||
n = netbeans_active();
|
||||
#endif
|
||||
#if defined(FEAT_TERMINAL) && defined(WIN3264)
|
||||
else if (STRICMP(name, "terminal") == 0)
|
||||
n = terminal_enabled();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -6800,7 +6815,7 @@ f_job_setoptions(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
if (job == NULL)
|
||||
return;
|
||||
clear_job_options(&opt);
|
||||
if (get_job_options(&argvars[1], &opt, JO_STOPONEXIT + JO_EXIT_CB) == OK)
|
||||
if (get_job_options(&argvars[1], &opt, JO_STOPONEXIT + JO_EXIT_CB, 0) == OK)
|
||||
job_set_options(job, &opt);
|
||||
free_job_options(&opt);
|
||||
}
|
||||
@@ -7258,10 +7273,17 @@ f_mapcheck(typval_T *argvars, typval_T *rettv)
|
||||
get_maparg(argvars, rettv, FALSE);
|
||||
}
|
||||
|
||||
static void find_some_match(typval_T *argvars, typval_T *rettv, int start);
|
||||
typedef enum
|
||||
{
|
||||
MATCH_END, /* matchend() */
|
||||
MATCH_MATCH, /* match() */
|
||||
MATCH_STR, /* matchstr() */
|
||||
MATCH_LIST, /* matchlist() */
|
||||
MATCH_POS /* matchstrpos() */
|
||||
} matchtype_T;
|
||||
|
||||
static void
|
||||
find_some_match(typval_T *argvars, typval_T *rettv, int type)
|
||||
find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type)
|
||||
{
|
||||
char_u *str = NULL;
|
||||
long len = 0;
|
||||
@@ -7285,13 +7307,13 @@ find_some_match(typval_T *argvars, typval_T *rettv, int type)
|
||||
p_cpo = (char_u *)"";
|
||||
|
||||
rettv->vval.v_number = -1;
|
||||
if (type == 3 || type == 4)
|
||||
if (type == MATCH_LIST || type == MATCH_POS)
|
||||
{
|
||||
/* type 3: return empty list when there are no matches.
|
||||
* type 4: return ["", -1, -1, -1] */
|
||||
/* type MATCH_LIST: return empty list when there are no matches.
|
||||
* type MATCH_POS: return ["", -1, -1, -1] */
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
goto theend;
|
||||
if (type == 4
|
||||
if (type == MATCH_POS
|
||||
&& (list_append_string(rettv->vval.v_list,
|
||||
(char_u *)"", 0) == FAIL
|
||||
|| list_append_number(rettv->vval.v_list,
|
||||
@@ -7306,7 +7328,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, int type)
|
||||
goto theend;
|
||||
}
|
||||
}
|
||||
else if (type == 2)
|
||||
else if (type == MATCH_STR)
|
||||
{
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = NULL;
|
||||
@@ -7418,7 +7440,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, int type)
|
||||
|
||||
if (match)
|
||||
{
|
||||
if (type == 4)
|
||||
if (type == MATCH_POS)
|
||||
{
|
||||
listitem_T *li1 = rettv->vval.v_list->lv_first;
|
||||
listitem_T *li2 = li1->li_next;
|
||||
@@ -7435,7 +7457,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, int type)
|
||||
if (l != NULL)
|
||||
li2->li_tv.vval.v_number = (varnumber_T)idx;
|
||||
}
|
||||
else if (type == 3)
|
||||
else if (type == MATCH_LIST)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -7455,7 +7477,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, int type)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (type == 2)
|
||||
else if (type == MATCH_STR)
|
||||
{
|
||||
/* return matched string */
|
||||
if (l != NULL)
|
||||
@@ -7468,7 +7490,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, int type)
|
||||
rettv->vval.v_number = idx;
|
||||
else
|
||||
{
|
||||
if (type != 0)
|
||||
if (type != MATCH_END)
|
||||
rettv->vval.v_number =
|
||||
(varnumber_T)(regmatch.startp[0] - str);
|
||||
else
|
||||
@@ -7480,12 +7502,11 @@ find_some_match(typval_T *argvars, typval_T *rettv, int type)
|
||||
vim_regfree(regmatch.regprog);
|
||||
}
|
||||
|
||||
if (type == 4 && l == NULL)
|
||||
theend:
|
||||
if (type == MATCH_POS && l == NULL && rettv->vval.v_list != NULL)
|
||||
/* matchstrpos() without a list: drop the second item. */
|
||||
listitem_remove(rettv->vval.v_list,
|
||||
rettv->vval.v_list->lv_first->li_next);
|
||||
|
||||
theend:
|
||||
vim_free(tofree);
|
||||
p_cpo = save_cpo;
|
||||
}
|
||||
@@ -7496,7 +7517,7 @@ theend:
|
||||
static void
|
||||
f_match(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
find_some_match(argvars, rettv, 1);
|
||||
find_some_match(argvars, rettv, MATCH_MATCH);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -7664,7 +7685,7 @@ f_matchdelete(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
|
||||
static void
|
||||
f_matchend(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
find_some_match(argvars, rettv, 0);
|
||||
find_some_match(argvars, rettv, MATCH_END);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -7673,7 +7694,7 @@ f_matchend(typval_T *argvars, typval_T *rettv)
|
||||
static void
|
||||
f_matchlist(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
find_some_match(argvars, rettv, 3);
|
||||
find_some_match(argvars, rettv, MATCH_LIST);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -7682,7 +7703,7 @@ f_matchlist(typval_T *argvars, typval_T *rettv)
|
||||
static void
|
||||
f_matchstr(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
find_some_match(argvars, rettv, 2);
|
||||
find_some_match(argvars, rettv, MATCH_STR);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -7691,7 +7712,7 @@ f_matchstr(typval_T *argvars, typval_T *rettv)
|
||||
static void
|
||||
f_matchstrpos(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
find_some_match(argvars, rettv, 4);
|
||||
find_some_match(argvars, rettv, MATCH_POS);
|
||||
}
|
||||
|
||||
static void max_min(typval_T *argvars, typval_T *rettv, int domax);
|
||||
@@ -7863,6 +7884,10 @@ f_mode(typval_T *argvars, typval_T *rettv)
|
||||
buf[0] = 'x';
|
||||
buf[1] = '!';
|
||||
}
|
||||
#ifdef FEAT_TERMINAL
|
||||
else if (term_use_loop())
|
||||
buf[0] = 't';
|
||||
#endif
|
||||
else if (VIsual_active)
|
||||
{
|
||||
if (VIsual_select)
|
||||
@@ -8634,7 +8659,10 @@ remote_common(typval_T *argvars, typval_T *rettv, int expr)
|
||||
# endif
|
||||
{
|
||||
if (r != NULL)
|
||||
{
|
||||
EMSG(r); /* sending worked but evaluation failed */
|
||||
vim_free(r);
|
||||
}
|
||||
else
|
||||
EMSG2(_("E241: Unable to send to %s"), server_name);
|
||||
return;
|
||||
@@ -8694,6 +8722,8 @@ f_remote_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
|
||||
argvars[1].v_type = VAR_STRING;
|
||||
argvars[1].vval.v_string = vim_strsave((char_u *)"foreground()");
|
||||
argvars[2].v_type = VAR_UNKNOWN;
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = NULL;
|
||||
remote_common(argvars, rettv, TRUE);
|
||||
vim_free(argvars[1].vval.v_string);
|
||||
# endif
|
||||
@@ -9873,6 +9903,118 @@ f_serverlist(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
rettv->vval.v_string = r;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set line or list of lines in buffer "buf".
|
||||
*/
|
||||
static void
|
||||
set_buffer_lines(buf_T *buf, linenr_T lnum, typval_T *lines, typval_T *rettv)
|
||||
{
|
||||
char_u *line = NULL;
|
||||
list_T *l = NULL;
|
||||
listitem_T *li = NULL;
|
||||
long added = 0;
|
||||
linenr_T lcount;
|
||||
buf_T *curbuf_save;
|
||||
int is_curbuf = buf == curbuf;
|
||||
|
||||
/* When using the current buffer ml_mfp will be set if needed. Useful when
|
||||
* setline() is used on startup. For other buffers the buffer must be
|
||||
* loaded. */
|
||||
if (buf == NULL || (!is_curbuf && buf->b_ml.ml_mfp == NULL) || lnum < 1)
|
||||
{
|
||||
rettv->vval.v_number = 1; /* FAIL */
|
||||
return;
|
||||
}
|
||||
|
||||
curbuf_save = curbuf;
|
||||
curbuf = buf;
|
||||
|
||||
lcount = curbuf->b_ml.ml_line_count;
|
||||
|
||||
if (lines->v_type == VAR_LIST)
|
||||
{
|
||||
l = lines->vval.v_list;
|
||||
li = l->lv_first;
|
||||
}
|
||||
else
|
||||
line = get_tv_string_chk(lines);
|
||||
|
||||
/* default result is zero == OK */
|
||||
for (;;)
|
||||
{
|
||||
if (l != NULL)
|
||||
{
|
||||
/* list argument, get next string */
|
||||
if (li == NULL)
|
||||
break;
|
||||
line = get_tv_string_chk(&li->li_tv);
|
||||
li = li->li_next;
|
||||
}
|
||||
|
||||
rettv->vval.v_number = 1; /* FAIL */
|
||||
if (line == NULL || lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1)
|
||||
break;
|
||||
|
||||
/* When coming here from Insert mode, sync undo, so that this can be
|
||||
* undone separately from what was previously inserted. */
|
||||
if (u_sync_once == 2)
|
||||
{
|
||||
u_sync_once = 1; /* notify that u_sync() was called */
|
||||
u_sync(TRUE);
|
||||
}
|
||||
|
||||
if (lnum <= curbuf->b_ml.ml_line_count)
|
||||
{
|
||||
/* existing line, replace it */
|
||||
if (u_savesub(lnum) == OK && ml_replace(lnum, line, TRUE) == OK)
|
||||
{
|
||||
changed_bytes(lnum, 0);
|
||||
if (is_curbuf && lnum == curwin->w_cursor.lnum)
|
||||
check_cursor_col();
|
||||
rettv->vval.v_number = 0; /* OK */
|
||||
}
|
||||
}
|
||||
else if (added > 0 || u_save(lnum - 1, lnum) == OK)
|
||||
{
|
||||
/* lnum is one past the last line, append the line */
|
||||
++added;
|
||||
if (ml_append(lnum - 1, line, (colnr_T)0, FALSE) == OK)
|
||||
rettv->vval.v_number = 0; /* OK */
|
||||
}
|
||||
|
||||
if (l == NULL) /* only one string argument */
|
||||
break;
|
||||
++lnum;
|
||||
}
|
||||
|
||||
if (added > 0)
|
||||
appended_lines_mark(lcount, added);
|
||||
|
||||
curbuf = curbuf_save;
|
||||
}
|
||||
|
||||
/*
|
||||
* "setbufline()" function
|
||||
*/
|
||||
static void
|
||||
f_setbufline(argvars, rettv)
|
||||
typval_T *argvars;
|
||||
typval_T *rettv;
|
||||
{
|
||||
linenr_T lnum;
|
||||
buf_T *buf;
|
||||
|
||||
buf = get_buf_tv(&argvars[0], FALSE);
|
||||
if (buf == NULL)
|
||||
rettv->vval.v_number = 1; /* FAIL */
|
||||
else
|
||||
{
|
||||
lnum = get_tv_lnum_buf(&argvars[1], buf);
|
||||
|
||||
set_buffer_lines(buf, lnum, &argvars[2], rettv);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* "setbufvar()" function
|
||||
*/
|
||||
@@ -10027,72 +10169,9 @@ f_setfperm(typval_T *argvars, typval_T *rettv)
|
||||
static void
|
||||
f_setline(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
linenr_T lnum;
|
||||
char_u *line = NULL;
|
||||
list_T *l = NULL;
|
||||
listitem_T *li = NULL;
|
||||
long added = 0;
|
||||
linenr_T lcount = curbuf->b_ml.ml_line_count;
|
||||
linenr_T lnum = get_tv_lnum(&argvars[0]);
|
||||
|
||||
lnum = get_tv_lnum(&argvars[0]);
|
||||
if (argvars[1].v_type == VAR_LIST)
|
||||
{
|
||||
l = argvars[1].vval.v_list;
|
||||
li = l->lv_first;
|
||||
}
|
||||
else
|
||||
line = get_tv_string_chk(&argvars[1]);
|
||||
|
||||
/* default result is zero == OK */
|
||||
for (;;)
|
||||
{
|
||||
if (l != NULL)
|
||||
{
|
||||
/* list argument, get next string */
|
||||
if (li == NULL)
|
||||
break;
|
||||
line = get_tv_string_chk(&li->li_tv);
|
||||
li = li->li_next;
|
||||
}
|
||||
|
||||
rettv->vval.v_number = 1; /* FAIL */
|
||||
if (line == NULL || lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1)
|
||||
break;
|
||||
|
||||
/* When coming here from Insert mode, sync undo, so that this can be
|
||||
* undone separately from what was previously inserted. */
|
||||
if (u_sync_once == 2)
|
||||
{
|
||||
u_sync_once = 1; /* notify that u_sync() was called */
|
||||
u_sync(TRUE);
|
||||
}
|
||||
|
||||
if (lnum <= curbuf->b_ml.ml_line_count)
|
||||
{
|
||||
/* existing line, replace it */
|
||||
if (u_savesub(lnum) == OK && ml_replace(lnum, line, TRUE) == OK)
|
||||
{
|
||||
changed_bytes(lnum, 0);
|
||||
if (lnum == curwin->w_cursor.lnum)
|
||||
check_cursor_col();
|
||||
rettv->vval.v_number = 0; /* OK */
|
||||
}
|
||||
}
|
||||
else if (added > 0 || u_save(lnum - 1, lnum) == OK)
|
||||
{
|
||||
/* lnum is one past the last line, append the line */
|
||||
++added;
|
||||
if (ml_append(lnum - 1, line, (colnr_T)0, FALSE) == OK)
|
||||
rettv->vval.v_number = 0; /* OK */
|
||||
}
|
||||
|
||||
if (l == NULL) /* only one string argument */
|
||||
break;
|
||||
++lnum;
|
||||
}
|
||||
|
||||
if (added > 0)
|
||||
appended_lines_mark(lcount, added);
|
||||
set_buffer_lines(curbuf, lnum, &argvars[1], rettv);
|
||||
}
|
||||
|
||||
static void set_qf_ll_list(win_T *wp, typval_T *list_arg, typval_T *action_arg, typval_T *what_arg, typval_T *rettv);
|
||||
@@ -11849,6 +11928,10 @@ f_synIDattr(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
case 's':
|
||||
if (TOLOWER_ASC(what[1]) == 'p') /* sp[#] */
|
||||
p = highlight_color(id, what, modec);
|
||||
/* strikeout */
|
||||
else if (TOLOWER_ASC(what[1]) == 't' &&
|
||||
TOLOWER_ASC(what[2]) == 'r')
|
||||
p = highlight_has_attr(id, HL_STRIKETHROUGH, modec);
|
||||
else /* standout */
|
||||
p = highlight_has_attr(id, HL_STANDOUT, modec);
|
||||
break;
|
||||
@@ -12471,6 +12554,23 @@ f_test_autochdir(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* "test_feedinput()"
|
||||
*/
|
||||
static void
|
||||
f_test_feedinput(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
{
|
||||
#ifdef USE_INPUT_BUF
|
||||
char_u *val = get_tv_string_chk(&argvars[0]);
|
||||
|
||||
if (val != NULL)
|
||||
{
|
||||
trash_input_buf();
|
||||
add_to_input_buf_csi(val, (int)STRLEN(val));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* "test_disable({name}, {val})" function
|
||||
*/
|
||||
|
||||
+7
-2
@@ -2098,11 +2098,16 @@ viminfo_filename(char_u *file)
|
||||
else if ((file = find_viminfo_parameter('n')) == NULL || *file == NUL)
|
||||
{
|
||||
#ifdef VIMINFO_FILE2
|
||||
/* don't use $HOME when not defined (turned into "c:/"!). */
|
||||
# ifdef VMS
|
||||
if (mch_getenv((char_u *)"SYS$LOGIN") == NULL)
|
||||
# else
|
||||
# ifdef MSWIN
|
||||
/* Use $VIM only if $HOME is the default "C:/". */
|
||||
if (STRCMP(vim_getenv((char_u *)"HOME", NULL), "C:/") == 0
|
||||
&& mch_getenv((char_u *)"HOME") == NULL)
|
||||
# else
|
||||
if (mch_getenv((char_u *)"HOME") == NULL)
|
||||
# endif
|
||||
# endif
|
||||
{
|
||||
/* don't use $VIM when not available. */
|
||||
@@ -3572,7 +3577,7 @@ getfile(
|
||||
{
|
||||
if (other)
|
||||
--no_wait_return;
|
||||
EMSG(_(e_nowrtmsg));
|
||||
no_write_message();
|
||||
retval = GETFILE_NOT_WRITTEN; /* file has been changed */
|
||||
goto theend;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1490,8 +1490,8 @@ EX(CMD_tearoff, "tearoff", ex_tearoff,
|
||||
NEEDARG|EXTRA|TRLBAR|NOTRLCOM|CMDWIN,
|
||||
ADDR_LINES),
|
||||
EX(CMD_terminal, "terminal", ex_terminal,
|
||||
RANGE|NOTADR|FILES|TRLBAR|CMDWIN,
|
||||
ADDR_OTHER),
|
||||
RANGE|BANG|FILES|TRLBAR|CMDWIN,
|
||||
ADDR_LINES),
|
||||
EX(CMD_tfirst, "tfirst", ex_tag,
|
||||
RANGE|NOTADR|BANG|TRLBAR|ZEROR,
|
||||
ADDR_LINES),
|
||||
|
||||
+32
-16
@@ -1194,6 +1194,7 @@ check_due_timer(void)
|
||||
long next_due = -1;
|
||||
proftime_T now;
|
||||
int did_one = FALSE;
|
||||
int need_update_screen = FALSE;
|
||||
long current_id = last_timer_id;
|
||||
# ifdef WIN3264
|
||||
LARGE_INTEGER fr;
|
||||
@@ -1218,28 +1219,44 @@ check_due_timer(void)
|
||||
{
|
||||
int save_timer_busy = timer_busy;
|
||||
int save_vgetc_busy = vgetc_busy;
|
||||
int did_emsg_save = did_emsg;
|
||||
int called_emsg_save = called_emsg;
|
||||
int did_throw_save = did_throw;
|
||||
int save_did_emsg = did_emsg;
|
||||
int save_called_emsg = called_emsg;
|
||||
int save_must_redraw = must_redraw;
|
||||
int save_trylevel = trylevel;
|
||||
int save_did_throw = did_throw;
|
||||
except_T *save_current_exception = current_exception;
|
||||
|
||||
/* Create a scope for running the timer callback, ignoring most of
|
||||
* the current scope, such as being inside a try/catch. */
|
||||
timer_busy = timer_busy > 0 || vgetc_busy > 0;
|
||||
vgetc_busy = 0;
|
||||
called_emsg = FALSE;
|
||||
did_emsg = FALSE;
|
||||
did_uncaught_emsg = FALSE;
|
||||
must_redraw = 0;
|
||||
trylevel = 0;
|
||||
did_throw = FALSE;
|
||||
current_exception = NULL;
|
||||
|
||||
timer->tr_firing = TRUE;
|
||||
timer_callback(timer);
|
||||
timer->tr_firing = FALSE;
|
||||
|
||||
timer_next = timer->tr_next;
|
||||
did_one = TRUE;
|
||||
timer_busy = save_timer_busy;
|
||||
vgetc_busy = save_vgetc_busy;
|
||||
if (called_emsg)
|
||||
{
|
||||
if (did_uncaught_emsg)
|
||||
++timer->tr_emsg_count;
|
||||
if (!did_throw_save && did_throw && current_exception != NULL)
|
||||
discard_current_exception();
|
||||
}
|
||||
did_emsg = did_emsg_save;
|
||||
called_emsg = called_emsg_save;
|
||||
did_emsg = save_did_emsg;
|
||||
called_emsg = save_called_emsg;
|
||||
trylevel = save_trylevel;
|
||||
did_throw = save_did_throw;
|
||||
current_exception = save_current_exception;
|
||||
if (must_redraw != 0)
|
||||
need_update_screen = TRUE;
|
||||
must_redraw = must_redraw > save_must_redraw
|
||||
? must_redraw : save_must_redraw;
|
||||
|
||||
/* Only fire the timer again if it repeats and stop_timer() wasn't
|
||||
* called while inside the callback (tr_id == -1). */
|
||||
@@ -1265,7 +1282,7 @@ check_due_timer(void)
|
||||
}
|
||||
|
||||
if (did_one)
|
||||
redraw_after_callback();
|
||||
redraw_after_callback(need_update_screen);
|
||||
|
||||
return current_id != last_timer_id ? 1 : next_due;
|
||||
}
|
||||
@@ -1934,9 +1951,9 @@ check_changed(buf_T *buf, int flags)
|
||||
}
|
||||
#endif
|
||||
if (flags & CCGD_EXCMD)
|
||||
EMSG(_(e_nowrtmsg));
|
||||
no_write_message();
|
||||
else
|
||||
EMSG(_(e_nowrtmsg_nobang));
|
||||
no_write_message_nobang();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@@ -2051,9 +2068,7 @@ dialog_changed(
|
||||
else
|
||||
{
|
||||
#endif
|
||||
dialog_msg(buff, _("Save changes to \"%s\"?"),
|
||||
(buf->b_fname != NULL) ?
|
||||
buf->b_fname : (char_u *)_("Untitled"));
|
||||
dialog_msg(buff, _("Save changes to \"%s\"?"), buf->b_fname);
|
||||
if (checkall)
|
||||
ret = vim_dialog_yesnoallcancel(VIM_QUESTION, NULL, buff, 1);
|
||||
else
|
||||
@@ -3822,6 +3837,7 @@ ex_packadd(exarg_T *eap)
|
||||
ex_options(
|
||||
exarg_T *eap UNUSED)
|
||||
{
|
||||
vim_setenv((char_u *)"OPTWIN_CMD", (char_u *)(cmdmod.tab ? "tab" : ""));
|
||||
cmd_source((char_u *)SYS_OPTWIN_FILE, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
+61
-28
@@ -6348,7 +6348,8 @@ ex_command(exarg_T *eap)
|
||||
{
|
||||
++p;
|
||||
end = skiptowhite(p);
|
||||
if (uc_scan_attr(p, end - p, &argt, &def, &flags, &compl, &compl_arg, &addr_type_arg)
|
||||
if (uc_scan_attr(p, end - p, &argt, &def, &flags, &compl,
|
||||
&compl_arg, &addr_type_arg)
|
||||
== FAIL)
|
||||
return;
|
||||
p = skipwhite(end);
|
||||
@@ -6389,7 +6390,7 @@ ex_command(exarg_T *eap)
|
||||
}
|
||||
else
|
||||
uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg,
|
||||
addr_type_arg, eap->forceit);
|
||||
addr_type_arg, eap->forceit);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -6609,8 +6610,18 @@ uc_check_code(
|
||||
char_u *p = code + 1;
|
||||
size_t l = len - 2;
|
||||
int quote = 0;
|
||||
enum { ct_ARGS, ct_BANG, ct_COUNT, ct_LINE1, ct_LINE2, ct_MODS,
|
||||
ct_REGISTER, ct_LT, ct_NONE } type = ct_NONE;
|
||||
enum {
|
||||
ct_ARGS,
|
||||
ct_BANG,
|
||||
ct_COUNT,
|
||||
ct_LINE1,
|
||||
ct_LINE2,
|
||||
ct_RANGE,
|
||||
ct_MODS,
|
||||
ct_REGISTER,
|
||||
ct_LT,
|
||||
ct_NONE
|
||||
} type = ct_NONE;
|
||||
|
||||
if ((vim_strchr((char_u *)"qQfF", *p) != NULL) && p[1] == '-')
|
||||
{
|
||||
@@ -6632,6 +6643,8 @@ uc_check_code(
|
||||
type = ct_LINE1;
|
||||
else if (STRNICMP(p, "line2>", l) == 0)
|
||||
type = ct_LINE2;
|
||||
else if (STRNICMP(p, "range>", l) == 0)
|
||||
type = ct_RANGE;
|
||||
else if (STRNICMP(p, "lt>", l) == 0)
|
||||
type = ct_LT;
|
||||
else if (STRNICMP(p, "reg>", l) == 0 || STRNICMP(p, "register>", l) == 0)
|
||||
@@ -6733,11 +6746,13 @@ uc_check_code(
|
||||
|
||||
case ct_LINE1:
|
||||
case ct_LINE2:
|
||||
case ct_RANGE:
|
||||
case ct_COUNT:
|
||||
{
|
||||
char num_buf[20];
|
||||
long num = (type == ct_LINE1) ? eap->line1 :
|
||||
(type == ct_LINE2) ? eap->line2 :
|
||||
(type == ct_RANGE) ? eap->addr_count :
|
||||
(eap->addr_count > 0) ? eap->line2 : cmd->uc_def;
|
||||
size_t num_len;
|
||||
|
||||
@@ -7485,7 +7500,7 @@ ex_win_close(
|
||||
else
|
||||
# endif
|
||||
{
|
||||
EMSG(_(e_nowrtmsg));
|
||||
no_write_message();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -10662,31 +10677,33 @@ find_cmdline_var(char_u *src, int *usedlen)
|
||||
"%",
|
||||
#define SPEC_PERC 0
|
||||
"#",
|
||||
#define SPEC_HASH 1
|
||||
#define SPEC_HASH (SPEC_PERC + 1)
|
||||
"<cword>", /* cursor word */
|
||||
#define SPEC_CWORD 2
|
||||
#define SPEC_CWORD (SPEC_HASH + 1)
|
||||
"<cWORD>", /* cursor WORD */
|
||||
#define SPEC_CCWORD 3
|
||||
#define SPEC_CCWORD (SPEC_CWORD + 1)
|
||||
"<cexpr>", /* expr under cursor */
|
||||
#define SPEC_CEXPR (SPEC_CCWORD + 1)
|
||||
"<cfile>", /* cursor path name */
|
||||
#define SPEC_CFILE 4
|
||||
#define SPEC_CFILE (SPEC_CEXPR + 1)
|
||||
"<sfile>", /* ":so" file name */
|
||||
#define SPEC_SFILE 5
|
||||
#define SPEC_SFILE (SPEC_CFILE + 1)
|
||||
"<slnum>", /* ":so" file line number */
|
||||
#define SPEC_SLNUM 6
|
||||
#define SPEC_SLNUM (SPEC_SFILE + 1)
|
||||
#ifdef FEAT_AUTOCMD
|
||||
"<afile>", /* autocommand file name */
|
||||
# define SPEC_AFILE 7
|
||||
# define SPEC_AFILE (SPEC_SLNUM + 1)
|
||||
"<abuf>", /* autocommand buffer number */
|
||||
# define SPEC_ABUF 8
|
||||
# define SPEC_ABUF (SPEC_AFILE + 1)
|
||||
"<amatch>", /* autocommand match name */
|
||||
# define SPEC_AMATCH 9
|
||||
# define SPEC_AMATCH (SPEC_ABUF + 1)
|
||||
#endif
|
||||
#ifdef FEAT_CLIENTSERVER
|
||||
"<client>"
|
||||
# ifdef FEAT_AUTOCMD
|
||||
# define SPEC_CLIENT 10
|
||||
# define SPEC_CLIENT (SPEC_AMATCH + 1)
|
||||
# else
|
||||
# define SPEC_CLIENT 7
|
||||
# define SPEC_CLIENT (SPEC_SLNUM + 1)
|
||||
# endif
|
||||
#endif
|
||||
};
|
||||
@@ -10774,10 +10791,13 @@ eval_vars(
|
||||
/*
|
||||
* word or WORD under cursor
|
||||
*/
|
||||
if (spec_idx == SPEC_CWORD || spec_idx == SPEC_CCWORD)
|
||||
if (spec_idx == SPEC_CWORD || spec_idx == SPEC_CCWORD
|
||||
|| spec_idx == SPEC_CEXPR)
|
||||
{
|
||||
resultlen = find_ident_under_cursor(&result, spec_idx == SPEC_CWORD ?
|
||||
(FIND_IDENT|FIND_STRING) : FIND_STRING);
|
||||
resultlen = find_ident_under_cursor(&result,
|
||||
spec_idx == SPEC_CWORD ? (FIND_IDENT | FIND_STRING)
|
||||
: spec_idx == SPEC_CEXPR ? (FIND_IDENT | FIND_STRING | FIND_EVAL)
|
||||
: FIND_STRING);
|
||||
if (resultlen == 0)
|
||||
{
|
||||
*errormsg = (char_u *)"";
|
||||
@@ -11126,7 +11146,7 @@ static int ses_do_frame(frame_T *fr);
|
||||
static int ses_do_win(win_T *wp);
|
||||
static int ses_arglist(FILE *fd, char *cmd, garray_T *gap, int fullname, unsigned *flagp);
|
||||
static int ses_put_fname(FILE *fd, char_u *name, unsigned *flagp);
|
||||
static int ses_fname(FILE *fd, buf_T *buf, unsigned *flagp);
|
||||
static int ses_fname(FILE *fd, buf_T *buf, unsigned *flagp, int add_eol);
|
||||
|
||||
/*
|
||||
* Write openfile commands for the current buffers to an .exrc file.
|
||||
@@ -11222,7 +11242,7 @@ makeopens(
|
||||
{
|
||||
if (fprintf(fd, "badd +%ld ", buf->b_wininfo == NULL ? 1L
|
||||
: buf->b_wininfo->wi_fpos.lnum) < 0
|
||||
|| ses_fname(fd, buf, &ssop_flags) == FAIL)
|
||||
|| ses_fname(fd, buf, &ssop_flags, TRUE) == FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -11324,7 +11344,8 @@ makeopens(
|
||||
)
|
||||
{
|
||||
if (fputs(need_tabnew ? "tabedit " : "edit ", fd) < 0
|
||||
|| ses_fname(fd, wp->w_buffer, &ssop_flags) == FAIL)
|
||||
|| ses_fname(fd, wp->w_buffer, &ssop_flags, TRUE)
|
||||
== FAIL)
|
||||
return FAIL;
|
||||
need_tabnew = FALSE;
|
||||
if (!wp->w_arg_idx_invalid)
|
||||
@@ -11671,9 +11692,20 @@ put_view(
|
||||
/*
|
||||
* Editing a file in this buffer: use ":edit file".
|
||||
* This may have side effects! (e.g., compressed or network file).
|
||||
*
|
||||
* Note, if a buffer for that file already exists, use :badd to
|
||||
* edit that buffer, to not lose folding information (:edit resets
|
||||
* folds in other buffers)
|
||||
*/
|
||||
if (fputs("edit ", fd) < 0
|
||||
|| ses_fname(fd, wp->w_buffer, flagp) == FAIL)
|
||||
if (fputs("if bufexists('", fd) < 0
|
||||
|| ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL
|
||||
|| fputs("') | buffer ", fd) < 0
|
||||
|| ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL
|
||||
|| fputs(" | else | edit ", fd) < 0
|
||||
|| ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL
|
||||
|| fputs(" | endif", fd) < 0
|
||||
||
|
||||
put_eol(fd) == FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
else
|
||||
@@ -11686,7 +11718,7 @@ put_view(
|
||||
{
|
||||
/* The buffer does have a name, but it's not a file name. */
|
||||
if (fputs("file ", fd) < 0
|
||||
|| ses_fname(fd, wp->w_buffer, flagp) == FAIL)
|
||||
|| ses_fname(fd, wp->w_buffer, flagp, TRUE) == FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
@@ -11858,11 +11890,11 @@ ses_arglist(
|
||||
|
||||
/*
|
||||
* Write a buffer name to the session file.
|
||||
* Also ends the line.
|
||||
* Also ends the line, if "add_eol" is TRUE.
|
||||
* Returns FAIL if writing fails.
|
||||
*/
|
||||
static int
|
||||
ses_fname(FILE *fd, buf_T *buf, unsigned *flagp)
|
||||
ses_fname(FILE *fd, buf_T *buf, unsigned *flagp, int add_eol)
|
||||
{
|
||||
char_u *name;
|
||||
|
||||
@@ -11881,7 +11913,8 @@ ses_fname(FILE *fd, buf_T *buf, unsigned *flagp)
|
||||
name = buf->b_sfname;
|
||||
else
|
||||
name = buf->b_ffname;
|
||||
if (ses_put_fname(fd, name, flagp) == FAIL || put_eol(fd) == FAIL)
|
||||
if (ses_put_fname(fd, name, flagp) == FAIL
|
||||
|| (add_eol && put_eol(fd) == FAIL))
|
||||
return FAIL;
|
||||
return OK;
|
||||
}
|
||||
|
||||
+2
-1
@@ -3479,7 +3479,8 @@ cursorcmd(void)
|
||||
|
||||
windgoto(msg_row, msg_col);
|
||||
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
|
||||
redrawcmd_preedit();
|
||||
if (p_imst == IM_ON_THE_SPOT)
|
||||
redrawcmd_preedit();
|
||||
#endif
|
||||
#ifdef MCH_CURSOR_SHAPE
|
||||
mch_update_cursor();
|
||||
|
||||
+6
-1
@@ -1283,10 +1283,15 @@
|
||||
|
||||
/*
|
||||
* +terminal ":terminal" command. Runs a terminal in a window.
|
||||
* requires +channel and +multibyte
|
||||
*/
|
||||
#if !defined(FEAT_JOB_CHANNEL) && defined(FEAT_TERMINAL)
|
||||
#if defined(FEAT_TERMINAL) && \
|
||||
!(defined(FEAT_JOB_CHANNEL) && defined(FEAT_MBYTE))
|
||||
# undef FEAT_TERMINAL
|
||||
#endif
|
||||
#if defined(FEAT_TERMINAL) && !defined(CURSOR_SHAPE)
|
||||
# define CURSOR_SHAPE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* +signs Allow signs to be displayed to the left of text lines.
|
||||
|
||||
+5
-1
@@ -1370,7 +1370,8 @@ retry:
|
||||
* Decrypt the read bytes. This is done before checking for
|
||||
* EOF because the crypt layer may be buffering.
|
||||
*/
|
||||
if (cryptkey != NULL && size > 0)
|
||||
if (cryptkey != NULL && curbuf->b_cryptstate != NULL
|
||||
&& size > 0)
|
||||
{
|
||||
if (crypt_works_inplace(curbuf->b_cryptstate))
|
||||
{
|
||||
@@ -6903,6 +6904,9 @@ buf_check_timestamp(
|
||||
#endif
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
|| isNetbeansBuffer(buf)
|
||||
#endif
|
||||
#ifdef FEAT_TERMINAL
|
||||
|| buf->b_term != NULL
|
||||
#endif
|
||||
)
|
||||
return 0;
|
||||
|
||||
+21
-11
@@ -125,7 +125,7 @@ static int vgetorpeek(int);
|
||||
static void map_free(mapblock_T **);
|
||||
static void validate_maphash(void);
|
||||
static void showmap(mapblock_T *mp, int local);
|
||||
static int inchar(char_u *buf, int maxlen, long wait_time, int tb_change_cnt);
|
||||
static int inchar(char_u *buf, int maxlen, long wait_time);
|
||||
#ifdef FEAT_EVAL
|
||||
static char_u *eval_map_expr(char_u *str, int c);
|
||||
#endif
|
||||
@@ -462,8 +462,7 @@ flush_buffers(int flush_typeahead)
|
||||
* of an escape sequence.
|
||||
* In an xterm we get one char at a time and we have to get them all.
|
||||
*/
|
||||
while (inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 10L,
|
||||
typebuf.tb_change_cnt) != 0)
|
||||
while (inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 10L) != 0)
|
||||
;
|
||||
typebuf.tb_off = MAXMAPLEN;
|
||||
typebuf.tb_len = 0;
|
||||
@@ -1599,8 +1598,13 @@ vgetc(void)
|
||||
{
|
||||
int did_inc = FALSE;
|
||||
|
||||
if (mod_mask) /* no mapping after modifier has been read */
|
||||
if (mod_mask
|
||||
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
|
||||
|| im_is_preediting()
|
||||
#endif
|
||||
)
|
||||
{
|
||||
/* no mapping after modifier has been read */
|
||||
++no_mapping;
|
||||
++allow_keys;
|
||||
did_inc = TRUE; /* mod_mask may change value */
|
||||
@@ -2046,8 +2050,7 @@ vgetorpeek(int advance)
|
||||
if (got_int)
|
||||
{
|
||||
/* flush all input */
|
||||
c = inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 0L,
|
||||
typebuf.tb_change_cnt);
|
||||
c = inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 0L);
|
||||
/*
|
||||
* If inchar() returns TRUE (script file was active) or we
|
||||
* are inside a mapping, get out of insert mode.
|
||||
@@ -2610,8 +2613,7 @@ vgetorpeek(int advance)
|
||||
&& (p_timeout
|
||||
|| (keylen == KEYLEN_PART_KEY && p_ttimeout))
|
||||
&& (c = inchar(typebuf.tb_buf + typebuf.tb_off
|
||||
+ typebuf.tb_len, 3, 25L,
|
||||
typebuf.tb_change_cnt)) == 0)
|
||||
+ typebuf.tb_len, 3, 25L)) == 0)
|
||||
{
|
||||
colnr_T col = 0, vcol;
|
||||
char_u *ptr;
|
||||
@@ -2848,7 +2850,7 @@ vgetorpeek(int advance)
|
||||
? -1L
|
||||
: ((keylen == KEYLEN_PART_KEY && p_ttm >= 0)
|
||||
? p_ttm
|
||||
: p_tm)), typebuf.tb_change_cnt);
|
||||
: p_tm)));
|
||||
|
||||
#ifdef FEAT_CMDL_INFO
|
||||
if (i != 0)
|
||||
@@ -2954,12 +2956,12 @@ vgetorpeek(int advance)
|
||||
inchar(
|
||||
char_u *buf,
|
||||
int maxlen,
|
||||
long wait_time, /* milli seconds */
|
||||
int tb_change_cnt)
|
||||
long wait_time) /* milli seconds */
|
||||
{
|
||||
int len = 0; /* init for GCC */
|
||||
int retesc = FALSE; /* return ESC with gotint */
|
||||
int script_char;
|
||||
int tb_change_cnt = typebuf.tb_change_cnt;
|
||||
|
||||
if (wait_time == -1L || wait_time > 100L) /* flush output before waiting */
|
||||
{
|
||||
@@ -3065,9 +3067,17 @@ inchar(
|
||||
len = ui_inchar(buf, maxlen / 3, wait_time, tb_change_cnt);
|
||||
}
|
||||
|
||||
/* If the typebuf was changed further down, it is like nothing was added by
|
||||
* this call. */
|
||||
if (typebuf_changed(tb_change_cnt))
|
||||
return 0;
|
||||
|
||||
/* Note the change in the typeahead buffer, this matters for when
|
||||
* vgetorpeek() is called recursively, e.g. using getchar(1) in a timer
|
||||
* function. */
|
||||
if (len > 0 && ++typebuf.tb_change_cnt == 0)
|
||||
typebuf.tb_change_cnt = 1;
|
||||
|
||||
return fix_input_buffer(buf, len);
|
||||
}
|
||||
|
||||
|
||||
+12
-2
@@ -182,6 +182,10 @@ EXTERN dict_T globvardict; /* Dictionary with g: variables */
|
||||
#endif
|
||||
EXTERN int did_emsg; /* set by emsg() when the message
|
||||
is displayed or thrown */
|
||||
#ifdef FEAT_EVAL
|
||||
EXTERN int did_uncaught_emsg; /* emsg() was called and did not
|
||||
cause an exception */
|
||||
#endif
|
||||
EXTERN int did_emsg_syntax; /* did_emsg set because of a
|
||||
syntax error */
|
||||
EXTERN int called_emsg; /* always set by emsg() */
|
||||
@@ -362,6 +366,10 @@ EXTERN int highlight_attr[HLF_COUNT]; /* Highl. attr for each context. */
|
||||
EXTERN int highlight_user[9]; /* User[1-9] attributes */
|
||||
# ifdef FEAT_STL_OPT
|
||||
EXTERN int highlight_stlnc[9]; /* On top of user */
|
||||
# ifdef FEAT_TERMINAL
|
||||
EXTERN int highlight_stlterm[9]; /* On top of user */
|
||||
EXTERN int highlight_stltermnc[9]; /* On top of user */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#ifdef FEAT_GUI
|
||||
@@ -1516,8 +1524,6 @@ EXTERN char_u e_notcreate[] INIT(= N_("E482: Can't create file %s"));
|
||||
EXTERN char_u e_notmp[] INIT(= N_("E483: Can't get temp file name"));
|
||||
EXTERN char_u e_notopen[] INIT(= N_("E484: Can't open file %s"));
|
||||
EXTERN char_u e_notread[] INIT(= N_("E485: Can't read file %s"));
|
||||
EXTERN char_u e_nowrtmsg[] INIT(= N_("E37: No write since last change (add ! to override)"));
|
||||
EXTERN char_u e_nowrtmsg_nobang[] INIT(= N_("E37: No write since last change"));
|
||||
EXTERN char_u e_null[] INIT(= N_("E38: Null argument"));
|
||||
#if defined(FEAT_DIGRAPHS) || defined(FEAT_TIMERS)
|
||||
EXTERN char_u e_number_exp[] INIT(= N_("E39: Number expected"));
|
||||
@@ -1675,6 +1681,10 @@ EXTERN int did_echo_string_emsg INIT(= FALSE);
|
||||
EXTERN int *eval_lavars_used INIT(= NULL);
|
||||
#endif
|
||||
|
||||
#ifdef WIN3264
|
||||
EXTERN int ctrl_break_was_pressed INIT(= FALSE);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Optional Farsi support. Include it here, so EXTERN and INIT are defined.
|
||||
*/
|
||||
|
||||
@@ -1066,8 +1066,12 @@ gui_update_cursor(
|
||||
int cur_width = 0;
|
||||
int cur_height = 0;
|
||||
int old_hl_mask;
|
||||
int idx;
|
||||
cursorentry_T *shape;
|
||||
int id;
|
||||
#ifdef FEAT_TERMINAL
|
||||
guicolor_T shape_fg = INVALCOLOR;
|
||||
guicolor_T shape_bg = INVALCOLOR;
|
||||
#endif
|
||||
guicolor_T cfg, cbg, cc; /* cursor fore-/background color */
|
||||
int cattr; /* cursor attributes */
|
||||
int attr;
|
||||
@@ -1109,20 +1113,35 @@ gui_update_cursor(
|
||||
|
||||
/*
|
||||
* How the cursor is drawn depends on the current mode.
|
||||
* When in a terminal window use the shape/color specified there.
|
||||
*/
|
||||
idx = get_shape_idx(FALSE);
|
||||
if (State & LANGMAP)
|
||||
id = shape_table[idx].id_lm;
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (use_terminal_cursor())
|
||||
shape = term_get_cursor_shape(&shape_fg, &shape_bg);
|
||||
else
|
||||
id = shape_table[idx].id;
|
||||
#endif
|
||||
shape = &shape_table[get_shape_idx(FALSE)];
|
||||
if (State & LANGMAP)
|
||||
id = shape->id_lm;
|
||||
else
|
||||
id = shape->id;
|
||||
|
||||
/* get the colors and attributes for the cursor. Default is inverted */
|
||||
cfg = INVALCOLOR;
|
||||
cbg = INVALCOLOR;
|
||||
cattr = HL_INVERSE;
|
||||
gui_mch_set_blinking(shape_table[idx].blinkwait,
|
||||
shape_table[idx].blinkon,
|
||||
shape_table[idx].blinkoff);
|
||||
gui_mch_set_blinking(shape->blinkwait,
|
||||
shape->blinkon,
|
||||
shape->blinkoff);
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (shape_bg != INVALCOLOR)
|
||||
{
|
||||
cattr = 0;
|
||||
cfg = shape_fg;
|
||||
cbg = shape_bg;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (id > 0)
|
||||
{
|
||||
cattr = syn_id2colors(id, &cfg, &cbg);
|
||||
@@ -1217,7 +1236,7 @@ gui_update_cursor(
|
||||
}
|
||||
|
||||
old_hl_mask = gui.highlight_mask;
|
||||
if (shape_table[idx].shape == SHAPE_BLOCK
|
||||
if (shape->shape == SHAPE_BLOCK
|
||||
#ifdef FEAT_HANGULIN
|
||||
|| composing_hangul
|
||||
#endif
|
||||
@@ -1257,16 +1276,14 @@ gui_update_cursor(
|
||||
* First draw the partial cursor, then overwrite with the text
|
||||
* character, using a transparent background.
|
||||
*/
|
||||
if (shape_table[idx].shape == SHAPE_VER)
|
||||
if (shape->shape == SHAPE_VER)
|
||||
{
|
||||
cur_height = gui.char_height;
|
||||
cur_width = (gui.char_width * shape_table[idx].percentage
|
||||
+ 99) / 100;
|
||||
cur_width = (gui.char_width * shape->percentage + 99) / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur_height = (gui.char_height * shape_table[idx].percentage
|
||||
+ 99) / 100;
|
||||
cur_height = (gui.char_height * shape->percentage + 99) / 100;
|
||||
cur_width = gui.char_width;
|
||||
}
|
||||
#ifdef FEAT_MBYTE
|
||||
@@ -1274,7 +1291,7 @@ gui_update_cursor(
|
||||
LineOffset[gui.row] + screen_Columns) > 1)
|
||||
{
|
||||
/* Double wide character. */
|
||||
if (shape_table[idx].shape != SHAPE_VER)
|
||||
if (shape->shape != SHAPE_VER)
|
||||
cur_width += gui.char_width;
|
||||
# ifdef FEAT_RIGHTLEFT
|
||||
if (CURSOR_BAR_RIGHT)
|
||||
@@ -1745,7 +1762,7 @@ gui_clear_block(
|
||||
void
|
||||
gui_update_cursor_later(void)
|
||||
{
|
||||
OUT_STR(IF_EB("\033|s", ESC_STR "|s"));
|
||||
OUT_STR(IF_EB("\033|s", ESC_STR "|s"));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2396,6 +2413,7 @@ gui_outstr_nowrap(
|
||||
/* Do we underline the text? */
|
||||
if (hl_mask_todo & HL_UNDERLINE)
|
||||
draw_flags |= DRAW_UNDERL;
|
||||
|
||||
#else
|
||||
/* Do we underline the text? */
|
||||
if ((hl_mask_todo & HL_UNDERLINE) || (hl_mask_todo & HL_ITALIC))
|
||||
@@ -2405,6 +2423,10 @@ gui_outstr_nowrap(
|
||||
if (hl_mask_todo & HL_UNDERCURL)
|
||||
draw_flags |= DRAW_UNDERC;
|
||||
|
||||
/* Do we strikethrough the text? */
|
||||
if (hl_mask_todo & HL_STRIKETHROUGH)
|
||||
draw_flags |= DRAW_STRIKE;
|
||||
|
||||
/* Do we draw transparently? */
|
||||
if (flags & GUI_MON_TRS_CURSOR)
|
||||
draw_flags |= DRAW_TRANSP;
|
||||
@@ -4965,7 +4987,7 @@ gui_mouse_correct(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Find window where the mouse pointer "y" coordinate is in.
|
||||
* Find window where the mouse pointer "x" / "y" coordinate is in.
|
||||
*/
|
||||
static win_T *
|
||||
xy2win(int x UNUSED, int y UNUSED)
|
||||
@@ -4989,6 +5011,8 @@ xy2win(int x UNUSED, int y UNUSED)
|
||||
return NULL;
|
||||
# endif
|
||||
wp = mouse_find_win(&row, &col);
|
||||
if (wp == NULL)
|
||||
return NULL;
|
||||
# ifdef FEAT_MOUSESHAPE
|
||||
if (State == HITRETURN || State == ASKMORE)
|
||||
{
|
||||
|
||||
@@ -143,8 +143,9 @@
|
||||
# define DRAW_ITALIC 0x10 /* draw italic text */
|
||||
#endif
|
||||
#define DRAW_CURSOR 0x20 /* drawing block cursor (win32) */
|
||||
#define DRAW_WIDE 0x40 /* drawing wide char (MacVim) */
|
||||
#define DRAW_COMP 0x80 /* drawing composing char (MacVim) */
|
||||
#define DRAW_STRIKE 0x40 /* strikethrough */
|
||||
#define DRAW_WIDE 0x80 /* drawing wide char (MacVim) */
|
||||
#define DRAW_COMP 0x100 /* drawing composing char (MacVim) */
|
||||
|
||||
/* For our own tearoff menu item */
|
||||
#define TEAR_STRING "-->Detach"
|
||||
|
||||
+3
-11
@@ -1177,23 +1177,15 @@ drawBalloon(BalloonEval *beval)
|
||||
int x_offset = EVAL_OFFSET_X;
|
||||
int y_offset = EVAL_OFFSET_Y;
|
||||
PangoLayout *layout;
|
||||
# if GTK_CHECK_VERSION(3,22,2)
|
||||
GdkRectangle rect;
|
||||
GdkMonitor * const mon = gdk_display_get_monitor_at_window(
|
||||
gtk_widget_get_display(beval->balloonShell),
|
||||
gtk_widget_get_window(beval->balloonShell));
|
||||
gdk_monitor_get_geometry(mon, &rect);
|
||||
|
||||
screen_w = rect.width;
|
||||
screen_h = rect.height;
|
||||
# else
|
||||
# if !GTK_CHECK_VERSION(3,22,2)
|
||||
GdkScreen *screen;
|
||||
|
||||
screen = gtk_widget_get_screen(beval->target);
|
||||
gtk_window_set_screen(GTK_WINDOW(beval->balloonShell), screen);
|
||||
screen_w = gdk_screen_get_width(screen);
|
||||
screen_h = gdk_screen_get_height(screen);
|
||||
# endif
|
||||
gui_gtk_get_screen_size_of_win(beval->balloonShell,
|
||||
&screen_w, &screen_h);
|
||||
# if !GTK_CHECK_VERSION(3,0,0)
|
||||
gtk_widget_ensure_style(beval->balloonShell);
|
||||
gtk_widget_ensure_style(beval->balloonLabel);
|
||||
|
||||
+133
-125
@@ -789,6 +789,37 @@ property_event(GtkWidget *widget,
|
||||
#endif /* defined(FEAT_CLIENTSERVER) */
|
||||
|
||||
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
typedef gboolean timeout_cb_type;
|
||||
#else
|
||||
typedef gint timeout_cb_type;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Start a timer that will invoke the specified callback.
|
||||
* Returns the ID of the timer.
|
||||
*/
|
||||
static guint
|
||||
timeout_add(int time, timeout_cb_type (*callback)(gpointer), int *flagp)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
return g_timeout_add((guint)time, (GSourceFunc)callback, flagp);
|
||||
#else
|
||||
return gtk_timeout_add((guint32)time, (GtkFunction)callback, flagp);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
timeout_remove(guint timer)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
g_source_remove(timer);
|
||||
#else
|
||||
gtk_timeout_remove(timer);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Focus handlers:
|
||||
*/
|
||||
@@ -866,11 +897,7 @@ gui_mch_stop_blink(void)
|
||||
{
|
||||
if (blink_timer)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
g_source_remove(blink_timer);
|
||||
#else
|
||||
gtk_timeout_remove(blink_timer);
|
||||
#endif
|
||||
timeout_remove(blink_timer);
|
||||
blink_timer = 0;
|
||||
}
|
||||
if (blink_state == BLINK_OFF)
|
||||
@@ -881,36 +908,20 @@ gui_mch_stop_blink(void)
|
||||
blink_state = BLINK_NONE;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
static gboolean
|
||||
#else
|
||||
static gint
|
||||
#endif
|
||||
static timeout_cb_type
|
||||
blink_cb(gpointer data UNUSED)
|
||||
{
|
||||
if (blink_state == BLINK_ON)
|
||||
{
|
||||
gui_undraw_cursor();
|
||||
blink_state = BLINK_OFF;
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
blink_timer = g_timeout_add((guint)blink_offtime,
|
||||
(GSourceFunc) blink_cb, NULL);
|
||||
#else
|
||||
blink_timer = gtk_timeout_add((guint32)blink_offtime,
|
||||
(GtkFunction) blink_cb, NULL);
|
||||
#endif
|
||||
blink_timer = timeout_add(blink_offtime, blink_cb, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_update_cursor(TRUE, FALSE);
|
||||
blink_state = BLINK_ON;
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
blink_timer = g_timeout_add((guint)blink_ontime,
|
||||
(GSourceFunc) blink_cb, NULL);
|
||||
#else
|
||||
blink_timer = gtk_timeout_add((guint32)blink_ontime,
|
||||
(GtkFunction) blink_cb, NULL);
|
||||
#endif
|
||||
blink_timer = timeout_add(blink_ontime, blink_cb, NULL);
|
||||
}
|
||||
gui_mch_flush();
|
||||
|
||||
@@ -926,23 +937,13 @@ gui_mch_start_blink(void)
|
||||
{
|
||||
if (blink_timer)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
g_source_remove(blink_timer);
|
||||
#else
|
||||
gtk_timeout_remove(blink_timer);
|
||||
#endif
|
||||
timeout_remove(blink_timer);
|
||||
blink_timer = 0;
|
||||
}
|
||||
/* Only switch blinking on if none of the times is zero */
|
||||
if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
blink_timer = g_timeout_add((guint)blink_waittime,
|
||||
(GSourceFunc) blink_cb, NULL);
|
||||
#else
|
||||
blink_timer = gtk_timeout_add((guint32)blink_waittime,
|
||||
(GtkFunction) blink_cb, NULL);
|
||||
#endif
|
||||
blink_timer = timeout_add(blink_waittime, blink_cb, NULL);
|
||||
blink_state = BLINK_ON;
|
||||
gui_update_cursor(TRUE, FALSE);
|
||||
gui_mch_flush();
|
||||
@@ -1733,7 +1734,6 @@ gui_mch_init_check(void)
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Mouse handling callbacks
|
||||
*/
|
||||
@@ -1745,11 +1745,7 @@ static int mouse_timed_out = TRUE;
|
||||
/*
|
||||
* Timer used to recognize multiple clicks of the mouse button
|
||||
*/
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
static gboolean
|
||||
#else
|
||||
static gint
|
||||
#endif
|
||||
static timeout_cb_type
|
||||
mouse_click_timer_cb(gpointer data)
|
||||
{
|
||||
/* we don't use this information currently */
|
||||
@@ -1759,13 +1755,9 @@ mouse_click_timer_cb(gpointer data)
|
||||
return FALSE; /* don't happen again */
|
||||
}
|
||||
|
||||
static guint motion_repeat_timer = 0;
|
||||
static int motion_repeat_offset = FALSE;
|
||||
#ifdef GTK_DEST_DEFAULT_ALL
|
||||
static gboolean motion_repeat_timer_cb(gpointer);
|
||||
#else
|
||||
static gint motion_repeat_timer_cb(gpointer);
|
||||
#endif
|
||||
static guint motion_repeat_timer = 0;
|
||||
static int motion_repeat_offset = FALSE;
|
||||
static timeout_cb_type motion_repeat_timer_cb(gpointer);
|
||||
|
||||
static void
|
||||
process_motion_notify(int x, int y, GdkModifierType state)
|
||||
@@ -1853,13 +1845,8 @@ process_motion_notify(int x, int y, GdkModifierType state)
|
||||
|
||||
/* shoot again */
|
||||
if (!motion_repeat_timer)
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
motion_repeat_timer = g_timeout_add((guint)delay,
|
||||
motion_repeat_timer_cb, NULL);
|
||||
#else
|
||||
motion_repeat_timer = gtk_timeout_add((guint32)delay,
|
||||
motion_repeat_timer_cb, NULL);
|
||||
#endif
|
||||
motion_repeat_timer = timeout_add(delay, motion_repeat_timer_cb,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1904,11 +1891,7 @@ gui_gtk_window_at_position(GtkWidget *widget,
|
||||
/*
|
||||
* Timer used to recognize multiple clicks of the mouse button.
|
||||
*/
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
static gboolean
|
||||
#else
|
||||
static gint
|
||||
#endif
|
||||
static timeout_cb_type
|
||||
motion_repeat_timer_cb(gpointer data UNUSED)
|
||||
{
|
||||
int x;
|
||||
@@ -2019,23 +2002,14 @@ button_press_event(GtkWidget *widget,
|
||||
/* Handle multiple clicks */
|
||||
if (!mouse_timed_out && mouse_click_timer)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
g_source_remove(mouse_click_timer);
|
||||
#else
|
||||
gtk_timeout_remove(mouse_click_timer);
|
||||
#endif
|
||||
timeout_remove(mouse_click_timer);
|
||||
mouse_click_timer = 0;
|
||||
repeated_click = TRUE;
|
||||
}
|
||||
|
||||
mouse_timed_out = FALSE;
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
mouse_click_timer = g_timeout_add((guint)p_mouset,
|
||||
mouse_click_timer_cb, &mouse_timed_out);
|
||||
#else
|
||||
mouse_click_timer = gtk_timeout_add((guint32)p_mouset,
|
||||
mouse_click_timer_cb, &mouse_timed_out);
|
||||
#endif
|
||||
mouse_click_timer = timeout_add(p_mouset, mouse_click_timer_cb,
|
||||
&mouse_timed_out);
|
||||
|
||||
switch (event->button)
|
||||
{
|
||||
@@ -2129,11 +2103,7 @@ button_release_event(GtkWidget *widget UNUSED,
|
||||
area .*/
|
||||
if (motion_repeat_timer)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
g_source_remove(motion_repeat_timer);
|
||||
#else
|
||||
gtk_timeout_remove(motion_repeat_timer);
|
||||
#endif
|
||||
timeout_remove(motion_repeat_timer);
|
||||
motion_repeat_timer = 0;
|
||||
}
|
||||
|
||||
@@ -4578,7 +4548,7 @@ mainwin_destroy_cb(GtkObject *object UNUSED, gpointer data UNUSED)
|
||||
* scrollbar init.), actually do the standard hints and stop the timer.
|
||||
* We'll not let the default hints be set while this timer's active.
|
||||
*/
|
||||
static gboolean
|
||||
static timeout_cb_type
|
||||
check_startup_plug_hints(gpointer data UNUSED)
|
||||
{
|
||||
if (init_window_hints_state == 1)
|
||||
@@ -4681,7 +4651,7 @@ gui_mch_open(void)
|
||||
{
|
||||
update_window_manager_hints(pixel_width, pixel_height);
|
||||
init_window_hints_state = 1;
|
||||
g_timeout_add(1000, check_startup_plug_hints, NULL);
|
||||
timeout_add(1000, check_startup_plug_hints, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4971,6 +4941,29 @@ gui_mch_set_shellsize(int width, int height,
|
||||
gui_mch_update();
|
||||
}
|
||||
|
||||
void
|
||||
gui_gtk_get_screen_size_of_win(GtkWidget *wid, int *width, int *height)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,22,0)
|
||||
GdkDisplay *dpy = gtk_widget_get_display(wid);
|
||||
GdkWindow *win = gtk_widget_get_window(wid);
|
||||
GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
|
||||
GdkRectangle geometry;
|
||||
|
||||
gdk_monitor_get_geometry(monitor, &geometry);
|
||||
*width = geometry.width;
|
||||
*height = geometry.height;
|
||||
#else
|
||||
GdkScreen* screen;
|
||||
|
||||
if (wid != NULL && gtk_widget_has_screen(wid))
|
||||
screen = gtk_widget_get_screen(wid);
|
||||
else
|
||||
screen = gdk_screen_get_default();
|
||||
*width = gdk_screen_get_width(screen);
|
||||
*height = gdk_screen_get_height(screen);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* The screen size is used to make sure the initial window doesn't get bigger
|
||||
@@ -4980,30 +4973,11 @@ gui_mch_set_shellsize(int width, int height,
|
||||
void
|
||||
gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,22,2)
|
||||
GdkRectangle rect;
|
||||
GdkMonitor * const mon = gdk_display_get_monitor_at_window(
|
||||
gtk_widget_get_display(gui.mainwin),
|
||||
gtk_widget_get_window(gui.mainwin));
|
||||
gdk_monitor_get_geometry(mon, &rect);
|
||||
gui_gtk_get_screen_size_of_win(gui.mainwin, screen_w, screen_h);
|
||||
|
||||
*screen_w = rect.width;
|
||||
/* Subtract 'guiheadroom' from the height to allow some room for the
|
||||
* window manager (task list and window title bar). */
|
||||
*screen_h = rect.height - p_ghr;
|
||||
#else
|
||||
GdkScreen* screen;
|
||||
|
||||
if (gui.mainwin != NULL && gtk_widget_has_screen(gui.mainwin))
|
||||
screen = gtk_widget_get_screen(gui.mainwin);
|
||||
else
|
||||
screen = gdk_screen_get_default();
|
||||
|
||||
*screen_w = gdk_screen_get_width(screen);
|
||||
/* Subtract 'guiheadroom' from the height to allow some room for the
|
||||
* window manager (task list and window title bar). */
|
||||
*screen_h = gdk_screen_get_height(screen) - p_ghr;
|
||||
#endif
|
||||
*screen_h -= p_ghr;
|
||||
|
||||
/*
|
||||
* FIXME: dirty trick: Because the gui_get_base_height() doesn't include
|
||||
@@ -5938,6 +5912,27 @@ draw_under(int flags, int row, int col, int cells)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Draw a strikethrough line */
|
||||
if (flags & DRAW_STRIKE)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
cairo_set_line_width(cr, 1.0);
|
||||
cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
|
||||
cairo_set_source_rgba(cr,
|
||||
gui.spcolor->red, gui.spcolor->green, gui.spcolor->blue,
|
||||
gui.spcolor->alpha);
|
||||
cairo_move_to(cr, FILL_X(col), y + 1 - gui.char_height/2 + 0.5);
|
||||
cairo_line_to(cr, FILL_X(col + cells), y + 1 - gui.char_height/2 + 0.5);
|
||||
cairo_stroke(cr);
|
||||
#else
|
||||
gdk_gc_set_foreground(gui.text_gc, gui.spcolor);
|
||||
gdk_draw_line(gui.drawarea->window, gui.text_gc,
|
||||
FILL_X(col), y + 1 - gui.char_height/2,
|
||||
FILL_X(col + cells), y + 1 - gui.char_height/2);
|
||||
gdk_gc_set_foreground(gui.text_gc, gui.fgcolor);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Underline: draw a line at the bottom of the character cell. */
|
||||
if (flags & DRAW_UNDERL)
|
||||
{
|
||||
@@ -5946,16 +5941,14 @@ draw_under(int flags, int row, int col, int cells)
|
||||
if (p_linespace > 1)
|
||||
y -= p_linespace - 1;
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
{
|
||||
cairo_set_line_width(cr, 1.0);
|
||||
cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
|
||||
cairo_set_source_rgba(cr,
|
||||
gui.fgcolor->red, gui.fgcolor->green, gui.fgcolor->blue,
|
||||
gui.fgcolor->alpha);
|
||||
cairo_move_to(cr, FILL_X(col), y + 0.5);
|
||||
cairo_line_to(cr, FILL_X(col + cells), y + 0.5);
|
||||
cairo_stroke(cr);
|
||||
}
|
||||
cairo_set_line_width(cr, 1.0);
|
||||
cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
|
||||
cairo_set_source_rgba(cr,
|
||||
gui.fgcolor->red, gui.fgcolor->green, gui.fgcolor->blue,
|
||||
gui.fgcolor->alpha);
|
||||
cairo_move_to(cr, FILL_X(col), y + 0.5);
|
||||
cairo_line_to(cr, FILL_X(col + cells), y + 0.5);
|
||||
cairo_stroke(cr);
|
||||
#else
|
||||
gdk_draw_line(gui.drawarea->window, gui.text_gc,
|
||||
FILL_X(col), y,
|
||||
@@ -6584,11 +6577,7 @@ gui_mch_update(void)
|
||||
g_main_context_iteration(NULL, TRUE);
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
static gboolean
|
||||
#else
|
||||
static gint
|
||||
#endif
|
||||
static timeout_cb_type
|
||||
input_timer_cb(gpointer data)
|
||||
{
|
||||
int *timed_out = (int *) data;
|
||||
@@ -6599,6 +6588,19 @@ input_timer_cb(gpointer data)
|
||||
return FALSE; /* don't happen again */
|
||||
}
|
||||
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
static timeout_cb_type
|
||||
channel_poll_cb(gpointer data UNUSED)
|
||||
{
|
||||
/* Using an event handler for a channel that may be disconnected does
|
||||
* not work, it hangs. Instead poll for messages. */
|
||||
channel_handle_events(TRUE);
|
||||
parse_queued_messages();
|
||||
|
||||
return TRUE; /* repeat */
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GUI input routine called by gui_wait_for_chars(). Waits for a character
|
||||
* from the keyboard.
|
||||
@@ -6615,20 +6617,26 @@ gui_mch_wait_for_chars(long wtime)
|
||||
guint timer;
|
||||
static int timed_out;
|
||||
int retval = FAIL;
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
guint channel_timer = 0;
|
||||
#endif
|
||||
|
||||
timed_out = FALSE;
|
||||
|
||||
/* this timeout makes sure that we will return if no characters arrived in
|
||||
* time */
|
||||
if (wtime > 0)
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
timer = g_timeout_add((guint)wtime, input_timer_cb, &timed_out);
|
||||
#else
|
||||
timer = gtk_timeout_add((guint32)wtime, input_timer_cb, &timed_out);
|
||||
#endif
|
||||
timer = timeout_add(wtime, input_timer_cb, &timed_out);
|
||||
else
|
||||
timer = 0;
|
||||
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
/* If there is a channel with the keep_open flag we need to poll for input
|
||||
* on them. */
|
||||
if (channel_any_keep_open())
|
||||
channel_timer = timeout_add(20, channel_poll_cb, NULL);
|
||||
#endif
|
||||
|
||||
focus = gui.in_focus;
|
||||
|
||||
do
|
||||
@@ -6678,10 +6686,10 @@ gui_mch_wait_for_chars(long wtime)
|
||||
|
||||
theend:
|
||||
if (timer != 0 && !timed_out)
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
g_source_remove(timer);
|
||||
#else
|
||||
gtk_timeout_remove(timer);
|
||||
timeout_remove(timer);
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
if (channel_timer != 0)
|
||||
timeout_remove(channel_timer);
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
|
||||
@@ -3909,6 +3909,11 @@ draw_string_QD(int row, int col, char_u *s, int len, int flags)
|
||||
MoveTo(FILL_X(col), FILL_Y(row + 1) - 1);
|
||||
LineTo(FILL_X(col + len) - 1, FILL_Y(row + 1) - 1);
|
||||
}
|
||||
if (flags & DRAW_STRIKE)
|
||||
{
|
||||
MoveTo(FILL_X(col), FILL_Y(row + 1) - gui.char_height/2);
|
||||
LineTo(FILL_X(col + len) - 1, FILL_Y(row + 1) - gui.char_height/2);
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & DRAW_UNDERC)
|
||||
|
||||
+23
-6
@@ -1840,6 +1840,7 @@ process_message(void)
|
||||
{
|
||||
trash_input_buf();
|
||||
got_int = TRUE;
|
||||
ctrl_break_was_pressed = TRUE;
|
||||
string[0] = Ctrl_C;
|
||||
add_to_input_buf(string, 1);
|
||||
}
|
||||
@@ -2072,20 +2073,23 @@ gui_mch_wait_for_chars(int wtime)
|
||||
did_add_timer = FALSE;
|
||||
#endif
|
||||
#ifdef MESSAGE_QUEUE
|
||||
/* Check channel while waiting message. */
|
||||
/* Check channel I/O while waiting for a message. */
|
||||
for (;;)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
parse_queued_messages();
|
||||
|
||||
if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)
|
||||
|| MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLINPUT)
|
||||
!= WAIT_TIMEOUT)
|
||||
if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
|
||||
{
|
||||
process_message();
|
||||
break;
|
||||
}
|
||||
else if (MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLINPUT)
|
||||
!= WAIT_TIMEOUT)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
/*
|
||||
* Don't use gui_mch_update() because then we will spin-lock until a
|
||||
* char arrives, instead we use GetMessage() to hang until an
|
||||
@@ -2093,6 +2097,7 @@ gui_mch_wait_for_chars(int wtime)
|
||||
* returning as soon as it contains a single char -- webb
|
||||
*/
|
||||
process_message();
|
||||
#endif
|
||||
|
||||
if (input_available())
|
||||
{
|
||||
@@ -6422,6 +6427,18 @@ gui_mch_draw_string(
|
||||
DeleteObject(SelectObject(s_hdc, old_pen));
|
||||
}
|
||||
|
||||
/* Strikethrough */
|
||||
if (flags & DRAW_STRIKE)
|
||||
{
|
||||
hpen = CreatePen(PS_SOLID, 1, gui.currSpColor);
|
||||
old_pen = SelectObject(s_hdc, hpen);
|
||||
y = FILL_Y(row + 1) - gui.char_height/2;
|
||||
MoveToEx(s_hdc, FILL_X(col), y, NULL);
|
||||
/* Note: LineTo() excludes the last pixel in the line. */
|
||||
LineTo(s_hdc, FILL_X(col + len), y);
|
||||
DeleteObject(SelectObject(s_hdc, old_pen));
|
||||
}
|
||||
|
||||
/* Undercurl */
|
||||
if (flags & DRAW_UNDERC)
|
||||
{
|
||||
|
||||
+62
-28
@@ -136,20 +136,11 @@ static guicolor_T prev_sp_color = INVALCOLOR;
|
||||
static XButtonPressedEvent last_mouse_event;
|
||||
#endif
|
||||
|
||||
static void gui_x11_timer_cb(XtPointer timed_out, XtIntervalId *interval_id);
|
||||
static void gui_x11_visibility_cb(Widget w, XtPointer dud, XEvent *event, Boolean *dum);
|
||||
static void gui_x11_expose_cb(Widget w, XtPointer dud, XEvent *event, Boolean *dum);
|
||||
static void gui_x11_resize_window_cb(Widget w, XtPointer dud, XEvent *event, Boolean *dum);
|
||||
static void gui_x11_focus_change_cb(Widget w, XtPointer data, XEvent *event, Boolean *dum);
|
||||
static void gui_x11_enter_cb(Widget w, XtPointer data, XEvent *event, Boolean *dum);
|
||||
static void gui_x11_leave_cb(Widget w, XtPointer data, XEvent *event, Boolean *dum);
|
||||
static void gui_x11_mouse_cb(Widget w, XtPointer data, XEvent *event, Boolean *dum);
|
||||
static void gui_x11_check_copy_area(void);
|
||||
#ifdef FEAT_CLIENTSERVER
|
||||
static void gui_x11_send_event_handler(Widget, XtPointer, XEvent *, Boolean *);
|
||||
#endif
|
||||
static void gui_x11_wm_protocol_handler(Widget, XtPointer, XEvent *, Boolean *);
|
||||
static void gui_x11_blink_cb(XtPointer timed_out, XtIntervalId *interval_id);
|
||||
static Cursor gui_x11_create_blank_mouse(void);
|
||||
static void draw_curl(int row, int col, int cells);
|
||||
|
||||
@@ -574,6 +565,25 @@ gui_x11_timer_cb(
|
||||
*((int *)timed_out) = TRUE;
|
||||
}
|
||||
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
static void
|
||||
channel_poll_cb(
|
||||
XtPointer client_data,
|
||||
XtIntervalId *interval_id UNUSED)
|
||||
{
|
||||
XtIntervalId *channel_timer = (XtIntervalId *)client_data;
|
||||
|
||||
/* Using an event handler for a channel that may be disconnected does
|
||||
* not work, it hangs. Instead poll for messages. */
|
||||
channel_handle_events(TRUE);
|
||||
parse_queued_messages();
|
||||
|
||||
/* repeat */
|
||||
*channel_timer = XtAppAddTimeOut(app_context, (long_u)20,
|
||||
channel_poll_cb, client_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
gui_x11_visibility_cb(
|
||||
Widget w UNUSED,
|
||||
@@ -2532,6 +2542,16 @@ gui_mch_draw_string(
|
||||
y, FILL_X(col + cells) - 1, y);
|
||||
}
|
||||
|
||||
if (flags & DRAW_STRIKE)
|
||||
{
|
||||
int y = FILL_Y(row + 1) - gui.char_height/2;
|
||||
|
||||
XSetForeground(gui.dpy, gui.text_gc, prev_sp_color);
|
||||
XDrawLine(gui.dpy, gui.wid, gui.text_gc, FILL_X(col),
|
||||
y, FILL_X(col + cells) - 1, y);
|
||||
XSetForeground(gui.dpy, gui.text_gc, prev_fg_color);
|
||||
}
|
||||
|
||||
#ifdef FEAT_XFONTSET
|
||||
if (current_fontset != NULL)
|
||||
XSetClipMask(gui.dpy, gui.text_gc, None);
|
||||
@@ -2698,12 +2718,22 @@ gui_mch_wait_for_chars(long wtime)
|
||||
static int timed_out;
|
||||
XtIntervalId timer = (XtIntervalId)0;
|
||||
XtInputMask desired;
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
XtIntervalId channel_timer = (XtIntervalId)0;
|
||||
#endif
|
||||
|
||||
timed_out = FALSE;
|
||||
|
||||
if (wtime > 0)
|
||||
timer = XtAppAddTimeOut(app_context, (long_u)wtime, gui_x11_timer_cb,
|
||||
&timed_out);
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
/* If there is a channel with the keep_open flag we need to poll for input
|
||||
* on them. */
|
||||
if (channel_any_keep_open())
|
||||
channel_timer = XtAppAddTimeOut(app_context, (long_u)20,
|
||||
channel_poll_cb, (XtPointer)&channel_timer);
|
||||
#endif
|
||||
|
||||
focus = gui.in_focus;
|
||||
#ifdef ALT_X_INPUT
|
||||
@@ -2755,6 +2785,10 @@ gui_mch_wait_for_chars(long wtime)
|
||||
|
||||
if (timer != (XtIntervalId)0 && !timed_out)
|
||||
XtRemoveTimeOut(timer);
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
if (channel_timer != (XtIntervalId)0)
|
||||
XtRemoveTimeOut(channel_timer);
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -3087,25 +3121,6 @@ gui_mch_stop_blink(void)
|
||||
blink_state = BLINK_NONE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the cursor blinking. If it was already blinking, this restarts the
|
||||
* waiting time and shows the cursor.
|
||||
*/
|
||||
void
|
||||
gui_mch_start_blink(void)
|
||||
{
|
||||
if (blink_timer != (XtIntervalId)0)
|
||||
XtRemoveTimeOut(blink_timer);
|
||||
/* Only switch blinking on if none of the times is zero */
|
||||
if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus)
|
||||
{
|
||||
blink_timer = XtAppAddTimeOut(app_context, blink_waittime,
|
||||
gui_x11_blink_cb, NULL);
|
||||
blink_state = BLINK_ON;
|
||||
gui_update_cursor(TRUE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gui_x11_blink_cb(
|
||||
XtPointer timed_out UNUSED,
|
||||
@@ -3127,6 +3142,25 @@ gui_x11_blink_cb(
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the cursor blinking. If it was already blinking, this restarts the
|
||||
* waiting time and shows the cursor.
|
||||
*/
|
||||
void
|
||||
gui_mch_start_blink(void)
|
||||
{
|
||||
if (blink_timer != (XtIntervalId)0)
|
||||
XtRemoveTimeOut(blink_timer);
|
||||
/* Only switch blinking on if none of the times is zero */
|
||||
if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus)
|
||||
{
|
||||
blink_timer = XtAppAddTimeOut(app_context, blink_waittime,
|
||||
gui_x11_blink_cb, NULL);
|
||||
blink_state = BLINK_ON;
|
||||
gui_update_cursor(TRUE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the RGB value of a pixel as a long.
|
||||
*/
|
||||
|
||||
+1
-1
@@ -993,7 +993,7 @@ static VALUE vim_message(VALUE self UNUSED, VALUE str)
|
||||
if (RSTRING_LEN(str) > 0)
|
||||
{
|
||||
/* Only do this when the string isn't empty, alloc(0) causes trouble. */
|
||||
buff = ALLOCA_N(char, RSTRING_LEN(str));
|
||||
buff = ALLOCA_N(char, RSTRING_LEN(str) + 1);
|
||||
strcpy(buff, RSTRING_PTR(str));
|
||||
p = strchr(buff, '\n');
|
||||
if (p) *p = '\0';
|
||||
|
||||
@@ -421,6 +421,7 @@ serverSendToVim(
|
||||
{
|
||||
LookupName(dpy, loosename ? loosename : name,
|
||||
/*DELETE=*/TRUE, NULL);
|
||||
vim_free(loosename);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
+14
-10
@@ -2,7 +2,7 @@
|
||||
* iscygpty.c -- part of ptycheck
|
||||
* https://github.com/k-takata/ptycheck
|
||||
*
|
||||
* Copyright (c) 2015-2016 K.Takata
|
||||
* Copyright (c) 2015-2017 K.Takata
|
||||
*
|
||||
* You can redistribute it and/or modify it under the terms of either
|
||||
* the MIT license (as described below) or the Vim license.
|
||||
@@ -27,6 +27,8 @@
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <ctype.h>
|
||||
#include <io.h>
|
||||
#include <wchar.h>
|
||||
@@ -60,19 +62,19 @@
|
||||
//#define USE_DYNFILEID
|
||||
#ifdef USE_DYNFILEID
|
||||
typedef BOOL (WINAPI *pfnGetFileInformationByHandleEx)(
|
||||
HANDLE hFile,
|
||||
HANDLE hFile,
|
||||
FILE_INFO_BY_HANDLE_CLASS FileInformationClass,
|
||||
LPVOID lpFileInformation,
|
||||
DWORD dwBufferSize
|
||||
LPVOID lpFileInformation,
|
||||
DWORD dwBufferSize
|
||||
);
|
||||
static pfnGetFileInformationByHandleEx pGetFileInformationByHandleEx = NULL;
|
||||
|
||||
# ifndef USE_FILEEXTD
|
||||
static BOOL WINAPI stub_GetFileInformationByHandleEx(
|
||||
HANDLE hFile,
|
||||
HANDLE hFile,
|
||||
FILE_INFO_BY_HANDLE_CLASS FileInformationClass,
|
||||
LPVOID lpFileInformation,
|
||||
DWORD dwBufferSize
|
||||
LPVOID lpFileInformation,
|
||||
DWORD dwBufferSize
|
||||
)
|
||||
{
|
||||
return FALSE;
|
||||
@@ -111,7 +113,7 @@ int is_cygpty(int fd)
|
||||
return 0;
|
||||
#else
|
||||
HANDLE h;
|
||||
int size = sizeof(FILE_NAME_INFO) + sizeof(WCHAR) * MAX_PATH;
|
||||
int size = sizeof(FILE_NAME_INFO) + sizeof(WCHAR) * (MAX_PATH - 1);
|
||||
FILE_NAME_INFO *nameinfo;
|
||||
WCHAR *p = NULL;
|
||||
|
||||
@@ -125,7 +127,7 @@ int is_cygpty(int fd)
|
||||
if (GetFileType(h) != FILE_TYPE_PIPE) {
|
||||
return 0;
|
||||
}
|
||||
nameinfo = malloc(size);
|
||||
nameinfo = malloc(size + sizeof(WCHAR));
|
||||
if (nameinfo == NULL) {
|
||||
return 0;
|
||||
}
|
||||
@@ -178,4 +180,6 @@ int is_cygpty_used(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* vi:set ts=8 sts=4 sw=4 noet: */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* vim: set ts=4 sw=4: */
|
||||
|
||||
+6
-1
@@ -2,7 +2,7 @@
|
||||
* iscygpty.h -- part of ptycheck
|
||||
* https://github.com/k-takata/ptycheck
|
||||
*
|
||||
* Copyright (c) 2015-2016 K.Takata
|
||||
* Copyright (c) 2015-2017 K.Takata
|
||||
*
|
||||
* You can redistribute it and/or modify it under the terms of either
|
||||
* the MIT license (as described below) or the Vim license.
|
||||
@@ -30,7 +30,12 @@
|
||||
#ifndef _ISCYGPTY_H
|
||||
#define _ISCYGPTY_H
|
||||
|
||||
#ifdef _WIN32
|
||||
int is_cygpty(int fd);
|
||||
int is_cygpty_used(void);
|
||||
#else
|
||||
#define is_cygpty(fd) 0
|
||||
#define is_cygpty_used() 0
|
||||
#endif
|
||||
|
||||
#endif /* _ISCYGPTY_H */
|
||||
|
||||
@@ -120,7 +120,8 @@ typedef enum {
|
||||
VTERM_PROP_ICONNAME, /* string */
|
||||
VTERM_PROP_REVERSE, /* bool */
|
||||
VTERM_PROP_CURSORSHAPE, /* number */
|
||||
VTERM_PROP_MOUSE /* number */
|
||||
VTERM_PROP_MOUSE, /* number */
|
||||
VTERM_PROP_CURSORCOLOR /* string */
|
||||
} VTermProp;
|
||||
|
||||
enum {
|
||||
@@ -188,6 +189,8 @@ void vterm_keyboard_start_paste(VTerm *vt);
|
||||
void vterm_keyboard_end_paste(VTerm *vt);
|
||||
|
||||
void vterm_mouse_move(VTerm *vt, int row, int col, VTermModifier mod);
|
||||
/* "button" is 1 for left, 2 for middle, 3 for right.
|
||||
* Button 4 is scroll wheel down, button 5 is scroll wheel up. */
|
||||
void vterm_mouse_button(VTerm *vt, int button, int pressed, VTermModifier mod);
|
||||
|
||||
/* ------------
|
||||
@@ -302,6 +305,9 @@ typedef struct {
|
||||
int (*settermprop)(VTermProp prop, VTermValue *val, void *user);
|
||||
int (*bell)(void *user);
|
||||
int (*resize)(int rows, int cols, void *user);
|
||||
/* A line was pushed off the top of the window.
|
||||
* "cells[cols]" contains the cells of that line.
|
||||
* Return value is unused. */
|
||||
int (*sb_pushline)(int cols, const VTermScreenCell *cells, void *user);
|
||||
int (*sb_popline)(int cols, VTermScreenCell *cells, void *user);
|
||||
} VTermScreenCallbacks;
|
||||
@@ -320,6 +326,9 @@ void *vterm_screen_get_cbdata(VTermScreen *screen);
|
||||
void vterm_screen_set_unrecognised_fallbacks(VTermScreen *screen, const VTermParserCallbacks *fallbacks, void *user);
|
||||
void *vterm_screen_get_unrecognised_fbdata(VTermScreen *screen);
|
||||
|
||||
/* Enable support for using the alternate screen if "altscreen" is non-zero.
|
||||
* Before that switching to the alternate screen won't work.
|
||||
* Calling with "altscreen" zero has no effect. */
|
||||
void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen);
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -214,7 +214,7 @@ static int moverect_internal(VTermRect dest, VTermRect src, void *user)
|
||||
VTermPos pos;
|
||||
for(pos.row = 0; pos.row < src.start_row; pos.row++) {
|
||||
for(pos.col = 0; pos.col < screen->cols; pos.col++)
|
||||
vterm_screen_get_cell(screen, pos, screen->sb_buffer + pos.col);
|
||||
(void)vterm_screen_get_cell(screen, pos, screen->sb_buffer + pos.col);
|
||||
|
||||
(screen->callbacks->sb_pushline)(screen->cols, screen->sb_buffer, screen->cbdata);
|
||||
}
|
||||
|
||||
@@ -878,6 +878,7 @@ static void request_dec_mode(VTermState *state, int num)
|
||||
|
||||
case 2004:
|
||||
reply = state->mode.bracketpaste;
|
||||
break;
|
||||
|
||||
default:
|
||||
vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "?%d;%d$y", num, 0);
|
||||
@@ -1504,6 +1505,10 @@ static int on_osc(const char *command, size_t cmdlen, void *user)
|
||||
settermprop_string(state, VTERM_PROP_TITLE, command + 2, cmdlen - 2);
|
||||
return 1;
|
||||
}
|
||||
else if(strneq(command, "12;", 3)) {
|
||||
settermprop_string(state, VTERM_PROP_CURSORCOLOR, command + 3, cmdlen - 3);
|
||||
return 1;
|
||||
}
|
||||
else if(state->fallbacks && state->fallbacks->osc)
|
||||
if((*state->fallbacks->osc)(command, cmdlen, state->fbdata))
|
||||
return 1;
|
||||
@@ -1819,6 +1824,7 @@ int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val)
|
||||
switch(prop) {
|
||||
case VTERM_PROP_TITLE:
|
||||
case VTERM_PROP_ICONNAME:
|
||||
case VTERM_PROP_CURSORCOLOR:
|
||||
/* we don't store these, just transparently pass through */
|
||||
return 1;
|
||||
case VTERM_PROP_CURSORVISIBLE:
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
* Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
|
||||
*/
|
||||
|
||||
#if !defined(IS_COMBINING_FUNCTION) || !defined(WCWIDTH_FUNCTION)
|
||||
struct interval {
|
||||
int first;
|
||||
int last;
|
||||
@@ -126,7 +127,6 @@ static const struct interval combining[] = {
|
||||
{ 0xE0100, 0xE01EF }
|
||||
};
|
||||
|
||||
|
||||
/* auxiliary function for binary search in interval table */
|
||||
static int bisearch(uint32_t ucs, const struct interval *table, int max) {
|
||||
int min = 0;
|
||||
@@ -146,6 +146,7 @@ static int bisearch(uint32_t ucs, const struct interval *table, int max) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* The following two functions define the column width of an ISO 10646
|
||||
@@ -180,6 +181,11 @@ static int bisearch(uint32_t ucs, const struct interval *table, int max) {
|
||||
* in ISO 10646.
|
||||
*/
|
||||
|
||||
#ifdef WCWIDTH_FUNCTION
|
||||
/* use a provided wcwidth() function */
|
||||
int WCWIDTH_FUNCTION(uint32_t ucs);
|
||||
#else
|
||||
# define WCWIDTH_FUNCTION mk_wcwidth
|
||||
|
||||
static int mk_wcwidth(uint32_t ucs)
|
||||
{
|
||||
@@ -196,7 +202,7 @@ static int mk_wcwidth(uint32_t ucs)
|
||||
|
||||
/* if we arrive here, ucs is not a combining or C0/C1 control character */
|
||||
|
||||
return 1 +
|
||||
return 1 +
|
||||
(ucs >= 0x1100 &&
|
||||
(ucs <= 0x115f || /* Hangul Jamo init. consonants */
|
||||
ucs == 0x2329 || ucs == 0x232a ||
|
||||
@@ -211,6 +217,7 @@ static int mk_wcwidth(uint32_t ucs)
|
||||
(ucs >= 0x20000 && ucs <= 0x2fffd) ||
|
||||
(ucs >= 0x30000 && ucs <= 0x3fffd)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0 /* unused */
|
||||
static int mk_wcswidth(const uint32_t *pwcs, size_t n)
|
||||
@@ -317,15 +324,28 @@ static int mk_wcswidth_cjk(const uint32_t *pwcs, size_t n)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef IS_COMBINING_FUNCTION
|
||||
/* Use a provided is_combining() function. */
|
||||
int IS_COMBINING_FUNCTION(uint32_t codepoint);
|
||||
#else
|
||||
# define IS_COMBINING_FUNCTION vterm_is_combining
|
||||
static int
|
||||
vterm_is_combining(uint32_t codepoint)
|
||||
{
|
||||
return bisearch(codepoint, combining, sizeof(combining) / sizeof(struct interval) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* ################################
|
||||
* ### The rest added by Paul Evans */
|
||||
|
||||
INTERNAL int vterm_unicode_width(uint32_t codepoint)
|
||||
{
|
||||
return mk_wcwidth(codepoint);
|
||||
return WCWIDTH_FUNCTION(codepoint);
|
||||
}
|
||||
|
||||
INTERNAL int vterm_unicode_is_combining(uint32_t codepoint)
|
||||
{
|
||||
return bisearch(codepoint, combining, sizeof(combining) / sizeof(struct interval) - 1);
|
||||
return IS_COMBINING_FUNCTION(codepoint);
|
||||
}
|
||||
|
||||
@@ -294,6 +294,7 @@ VTermValueType vterm_get_prop_type(VTermProp prop)
|
||||
case VTERM_PROP_REVERSE: return VTERM_VALUETYPE_BOOL;
|
||||
case VTERM_PROP_CURSORSHAPE: return VTERM_VALUETYPE_INT;
|
||||
case VTERM_PROP_MOUSE: return VTERM_VALUETYPE_INT;
|
||||
case VTERM_PROP_CURSORCOLOR: return VTERM_VALUETYPE_STRING;
|
||||
}
|
||||
return 0; /* UNREACHABLE */
|
||||
}
|
||||
|
||||
@@ -144,8 +144,8 @@ struct VTermState
|
||||
struct VTermPen pen;
|
||||
|
||||
struct {
|
||||
int cursor_visible:1;
|
||||
int cursor_blink:1;
|
||||
unsigned int cursor_visible:1;
|
||||
unsigned int cursor_blink:1;
|
||||
unsigned int cursor_shape:2;
|
||||
} mode;
|
||||
} saved;
|
||||
|
||||
+19
-20
@@ -2557,10 +2557,10 @@ scripterror:
|
||||
*/
|
||||
if (vim_strpbrk(p, "\\:") != NULL && !path_with_url(p))
|
||||
{
|
||||
char posix_path[PATH_MAX];
|
||||
char posix_path[MAXPATHL];
|
||||
|
||||
# if CYGWIN_VERSION_DLL_MAJOR >= 1007
|
||||
cygwin_conv_path(CCP_WIN_A_TO_POSIX, p, posix_path, PATH_MAX);
|
||||
cygwin_conv_path(CCP_WIN_A_TO_POSIX, p, posix_path, MAXPATHL);
|
||||
# else
|
||||
cygwin_conv_to_posix_path(p, posix_path);
|
||||
# endif
|
||||
@@ -3681,36 +3681,35 @@ set_progpath(char_u *argv0)
|
||||
{
|
||||
char_u *val = argv0;
|
||||
|
||||
# ifdef PROC_EXE_LINK
|
||||
char buf[PATH_MAX + 1];
|
||||
ssize_t len;
|
||||
|
||||
len = readlink(PROC_EXE_LINK, buf, PATH_MAX);
|
||||
if (len > 0)
|
||||
{
|
||||
buf[len] = NUL;
|
||||
val = (char_u *)buf;
|
||||
}
|
||||
# else
|
||||
# if defined(WIN32)
|
||||
/* A relative path containing a "/" will become invalid when using ":cd",
|
||||
* turn it into a full path.
|
||||
* On MS-Windows "vim" should be expanded to "vim.exe", thus always do
|
||||
* this. */
|
||||
# ifdef WIN32
|
||||
char_u *path = NULL;
|
||||
|
||||
if (mch_can_exe(argv0, &path, FALSE) && path != NULL)
|
||||
val = path;
|
||||
# else
|
||||
char_u buf[MAXPATHL];
|
||||
# else
|
||||
char_u buf[MAXPATHL + 1];
|
||||
# ifdef PROC_EXE_LINK
|
||||
char linkbuf[MAXPATHL + 1];
|
||||
ssize_t len;
|
||||
|
||||
if (!mch_isFullName(argv0))
|
||||
len = readlink(PROC_EXE_LINK, linkbuf, MAXPATHL);
|
||||
if (len > 0)
|
||||
{
|
||||
if (gettail(argv0) != argv0
|
||||
&& vim_FullName(argv0, buf, MAXPATHL, TRUE) != FAIL)
|
||||
val = buf;
|
||||
linkbuf[len] = NUL;
|
||||
val = (char_u *)linkbuf;
|
||||
}
|
||||
# endif
|
||||
|
||||
if (!mch_isFullName(val))
|
||||
{
|
||||
if (gettail(val) != val
|
||||
&& vim_FullName(val, buf, MAXPATHL, TRUE) != FAIL)
|
||||
val = buf;
|
||||
}
|
||||
# endif
|
||||
|
||||
set_vim_var_string(VV_PROGPATH, val, -1);
|
||||
|
||||
+17
-3
@@ -1649,6 +1649,19 @@ handle_viminfo_mark(garray_T *values, int force)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE if marks for "buf" should not be written.
|
||||
*/
|
||||
static int
|
||||
skip_for_viminfo(buf_T *buf)
|
||||
{
|
||||
return
|
||||
#ifdef FEAT_TERMINAL
|
||||
bt_terminal(buf) ||
|
||||
#endif
|
||||
removable(buf->b_ffname);
|
||||
}
|
||||
|
||||
void
|
||||
write_viminfo_filemarks(FILE *fp)
|
||||
{
|
||||
@@ -1681,7 +1694,7 @@ write_viminfo_filemarks(FILE *fp)
|
||||
* Move '0 to '1, '1 to '2, etc. until the matching one or '9
|
||||
* Set the '0 mark to current cursor position.
|
||||
*/
|
||||
if (curbuf->b_ffname != NULL && !removable(curbuf->b_ffname))
|
||||
if (curbuf->b_ffname != NULL && !skip_for_viminfo(curbuf))
|
||||
{
|
||||
name = buflist_nr2name(curbuf->b_fnum, TRUE, FALSE);
|
||||
for (i = NMARKS; i < NMARKS + EXTRA_MARKS - 1; ++i)
|
||||
@@ -1757,7 +1770,7 @@ write_viminfo_filemarks(FILE *fp)
|
||||
--idx;
|
||||
if (fm->fmark.fnum == 0
|
||||
|| ((buf = buflist_findnr(fm->fmark.fnum)) != NULL
|
||||
&& !removable(buf->b_ffname)))
|
||||
&& !skip_for_viminfo(buf)))
|
||||
write_one_filemark(fp, fm, '-', '\'');
|
||||
}
|
||||
#endif
|
||||
@@ -1917,7 +1930,8 @@ write_viminfo_marks(FILE *fp_out, garray_T *buflist)
|
||||
}
|
||||
}
|
||||
if (is_mark_set && buf->b_ffname != NULL
|
||||
&& buf->b_ffname[0] != NUL && !removable(buf->b_ffname))
|
||||
&& buf->b_ffname[0] != NUL
|
||||
&& !skip_for_viminfo(buf))
|
||||
{
|
||||
if (buflist == NULL)
|
||||
write_buffer_marks(buf, fp_out);
|
||||
|
||||
+273
-108
@@ -1395,6 +1395,17 @@ static struct interval ambiguous[] =
|
||||
{0x100000, 0x10fffd}
|
||||
};
|
||||
|
||||
#if defined(FEAT_TERMINAL) || defined(PROTO)
|
||||
/*
|
||||
* utf_char2cells() with different argument type for libvterm.
|
||||
*/
|
||||
int
|
||||
utf_uint2cells(UINT32_T c)
|
||||
{
|
||||
return utf_char2cells((int)c);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For UTF-8 character "c" return 2 for a double-width character, 1 for others.
|
||||
* Returns 4 or 6 for an unprintable character.
|
||||
@@ -2296,6 +2307,17 @@ utf_char2bytes(int c, char_u *buf)
|
||||
return 6;
|
||||
}
|
||||
|
||||
#if defined(FEAT_TERMINAL) || defined(PROTO)
|
||||
/*
|
||||
* utf_iscomposing() with different argument type for libvterm.
|
||||
*/
|
||||
int
|
||||
utf_iscomposing_uint(UINT32_T c)
|
||||
{
|
||||
return utf_iscomposing((int)c);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return TRUE if "c" is a composing UTF-8 character. This means it will be
|
||||
* drawn on top of the preceding character.
|
||||
@@ -4773,9 +4795,12 @@ static unsigned long im_commit_handler_id = 0;
|
||||
# ifndef FEAT_GUI_MACVIM
|
||||
static unsigned int im_activatekey_keyval = GDK_VoidSymbol;
|
||||
static unsigned int im_activatekey_state = 0;
|
||||
# endif
|
||||
|
||||
# ifndef FEAT_GUI_MACVIM
|
||||
static GtkWidget *preedit_window = NULL;
|
||||
static GtkWidget *preedit_label = NULL;
|
||||
|
||||
static void im_preedit_window_set_position(void);
|
||||
|
||||
void
|
||||
im_set_active(int active)
|
||||
{
|
||||
@@ -4817,6 +4842,9 @@ im_set_position(int row, int col)
|
||||
area.height = gui.char_height;
|
||||
|
||||
gtk_im_context_set_cursor_location(xic, &area);
|
||||
|
||||
if (p_imst == IM_OVER_THE_SPOT)
|
||||
im_preedit_window_set_position();
|
||||
}
|
||||
}
|
||||
# endif
|
||||
@@ -4850,13 +4878,115 @@ im_add_to_input(char_u *str, int len)
|
||||
# endif
|
||||
}
|
||||
|
||||
# ifndef FEAT_GUI_MACVIM
|
||||
static void
|
||||
im_preedit_window_set_position(void)
|
||||
{
|
||||
int x, y, w, h, sw, sh;
|
||||
|
||||
if (preedit_window == NULL)
|
||||
return;
|
||||
|
||||
gui_gtk_get_screen_size_of_win(preedit_window, &sw, &sh);
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
gdk_window_get_origin(gtk_widget_get_window(gui.drawarea), &x, &y);
|
||||
#else
|
||||
gdk_window_get_origin(gui.drawarea->window, &x, &y);
|
||||
#endif
|
||||
gtk_window_get_size(GTK_WINDOW(preedit_window), &w, &h);
|
||||
x = x + FILL_X(gui.col);
|
||||
y = y + FILL_Y(gui.row);
|
||||
if (x + w > sw)
|
||||
x = sw - w;
|
||||
if (y + h > sh)
|
||||
y = sh - h;
|
||||
gtk_window_move(GTK_WINDOW(preedit_window), x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
im_preedit_window_open()
|
||||
{
|
||||
char *preedit_string;
|
||||
char buf[8];
|
||||
PangoAttrList *attr_list;
|
||||
PangoLayout *layout;
|
||||
GdkColor color;
|
||||
gint w, h;
|
||||
|
||||
if (preedit_window == NULL)
|
||||
{
|
||||
preedit_window = gtk_window_new(GTK_WINDOW_POPUP);
|
||||
preedit_label = gtk_label_new("");
|
||||
gtk_container_add(GTK_CONTAINER(preedit_window), preedit_label);
|
||||
}
|
||||
|
||||
gtk_widget_modify_font(preedit_label, gui.norm_font);
|
||||
|
||||
vim_snprintf(buf, sizeof(buf), "#%06X", gui.norm_pixel);
|
||||
gdk_color_parse(buf, &color);
|
||||
gtk_widget_modify_fg(preedit_label, GTK_STATE_NORMAL, &color);
|
||||
|
||||
vim_snprintf(buf, sizeof(buf), "#%06X", gui.back_pixel);
|
||||
gdk_color_parse(buf, &color);
|
||||
gtk_widget_modify_bg(preedit_window, GTK_STATE_NORMAL, &color);
|
||||
|
||||
gtk_im_context_get_preedit_string(xic, &preedit_string, &attr_list, NULL);
|
||||
|
||||
if (preedit_string[0] != NUL)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(preedit_label), preedit_string);
|
||||
gtk_label_set_attributes(GTK_LABEL(preedit_label), attr_list);
|
||||
|
||||
layout = gtk_label_get_layout(GTK_LABEL(preedit_label));
|
||||
pango_layout_get_pixel_size(layout, &w, &h);
|
||||
h = MAX(h, gui.char_height);
|
||||
gtk_window_resize(GTK_WINDOW(preedit_window), w, h);
|
||||
|
||||
gtk_widget_show_all(preedit_window);
|
||||
|
||||
im_preedit_window_set_position();
|
||||
}
|
||||
|
||||
g_free(preedit_string);
|
||||
pango_attr_list_unref(attr_list);
|
||||
}
|
||||
|
||||
static void
|
||||
im_preedit_window_close()
|
||||
{
|
||||
if (preedit_window != NULL)
|
||||
gtk_widget_hide(preedit_window);
|
||||
}
|
||||
|
||||
static void
|
||||
im_show_preedit()
|
||||
{
|
||||
im_preedit_window_open();
|
||||
|
||||
if (p_mh) /* blank out the pointer if necessary */
|
||||
gui_mch_mousehide(TRUE);
|
||||
}
|
||||
# endif
|
||||
|
||||
static void
|
||||
im_delete_preedit(void)
|
||||
{
|
||||
char_u bskey[] = {CSI, 'k', 'b'};
|
||||
char_u delkey[] = {CSI, 'k', 'D'};
|
||||
|
||||
if (State & NORMAL)
|
||||
# ifndef FEAT_GUI_MACVIM
|
||||
if (p_imst == IM_OVER_THE_SPOT)
|
||||
{
|
||||
im_preedit_window_close();
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
|
||||
if (State & NORMAL
|
||||
#ifdef FEAT_TERMINAL
|
||||
&& !term_use_loop()
|
||||
#endif
|
||||
)
|
||||
{
|
||||
im_preedit_cursor = 0;
|
||||
return;
|
||||
@@ -4931,40 +5061,43 @@ im_commit_cb(GtkIMContext *context UNUSED,
|
||||
xim_log("im_commit_cb(): %s\n", str);
|
||||
#endif
|
||||
|
||||
/* The imhangul module doesn't reset the preedit string before
|
||||
* committing. Call im_delete_preedit() to work around that. */
|
||||
im_delete_preedit();
|
||||
|
||||
/* Indicate that preediting has finished. */
|
||||
if (preedit_start_col == MAXCOL)
|
||||
if (p_imst == IM_ON_THE_SPOT)
|
||||
{
|
||||
init_preedit_start_col();
|
||||
commit_with_preedit = FALSE;
|
||||
/* The imhangul module doesn't reset the preedit string before
|
||||
* committing. Call im_delete_preedit() to work around that. */
|
||||
im_delete_preedit();
|
||||
|
||||
/* Indicate that preediting has finished. */
|
||||
if (preedit_start_col == MAXCOL)
|
||||
{
|
||||
init_preedit_start_col();
|
||||
commit_with_preedit = FALSE;
|
||||
}
|
||||
|
||||
/* The thing which setting "preedit_start_col" to MAXCOL means that
|
||||
* "preedit_start_col" will be set forcedly when calling
|
||||
* preedit_changed_cb() next time.
|
||||
* "preedit_start_col" should not reset with MAXCOL on this part. Vim
|
||||
* is simulating the preediting by using add_to_input_str(). when
|
||||
* preedit begin immediately before committed, the typebuf is not
|
||||
* flushed to screen, then it can't get correct "preedit_start_col".
|
||||
* Thus, it should calculate the cells by adding cells of the committed
|
||||
* string. */
|
||||
if (input_conv.vc_type != CONV_NONE)
|
||||
{
|
||||
im_str = string_convert(&input_conv, (char_u *)str, &len);
|
||||
g_return_if_fail(im_str != NULL);
|
||||
}
|
||||
else
|
||||
im_str = (char_u *)str;
|
||||
|
||||
clen = mb_string2cells(im_str, len);
|
||||
|
||||
if (input_conv.vc_type != CONV_NONE)
|
||||
vim_free(im_str);
|
||||
preedit_start_col += clen;
|
||||
}
|
||||
|
||||
/* The thing which setting "preedit_start_col" to MAXCOL means that
|
||||
* "preedit_start_col" will be set forcedly when calling
|
||||
* preedit_changed_cb() next time.
|
||||
* "preedit_start_col" should not reset with MAXCOL on this part. Vim
|
||||
* is simulating the preediting by using add_to_input_str(). when
|
||||
* preedit begin immediately before committed, the typebuf is not
|
||||
* flushed to screen, then it can't get correct "preedit_start_col".
|
||||
* Thus, it should calculate the cells by adding cells of the committed
|
||||
* string. */
|
||||
if (input_conv.vc_type != CONV_NONE)
|
||||
{
|
||||
im_str = string_convert(&input_conv, (char_u *)str, &len);
|
||||
g_return_if_fail(im_str != NULL);
|
||||
}
|
||||
else
|
||||
im_str = (char_u *)str;
|
||||
|
||||
clen = mb_string2cells(im_str, len);
|
||||
|
||||
if (input_conv.vc_type != CONV_NONE)
|
||||
vim_free(im_str);
|
||||
preedit_start_col += clen;
|
||||
|
||||
/* Is this a single character that matches a keypad key that's just
|
||||
* been pressed? If so, we don't want it to be entered as such - let
|
||||
* us carry on processing the raw keycode so that it may be used in
|
||||
@@ -4988,14 +5121,17 @@ im_commit_cb(GtkIMContext *context UNUSED,
|
||||
if (add_to_input)
|
||||
im_add_to_input((char_u *)str, slen);
|
||||
|
||||
/* Inserting chars while "im_is_active" is set does not cause a change of
|
||||
* buffer. When the chars are committed the buffer must be marked as
|
||||
* changed. */
|
||||
if (!commit_with_preedit)
|
||||
preedit_start_col = MAXCOL;
|
||||
if (p_imst == IM_ON_THE_SPOT)
|
||||
{
|
||||
/* Inserting chars while "im_is_active" is set does not cause a
|
||||
* change of buffer. When the chars are committed the buffer must be
|
||||
* marked as changed. */
|
||||
if (!commit_with_preedit)
|
||||
preedit_start_col = MAXCOL;
|
||||
|
||||
/* This flag is used in changed() at next call. */
|
||||
xim_changed_while_preediting = TRUE;
|
||||
/* This flag is used in changed() at next call. */
|
||||
xim_changed_while_preediting = TRUE;
|
||||
}
|
||||
|
||||
if (gtk_main_level() > 0)
|
||||
gtk_main_quit();
|
||||
@@ -5040,7 +5176,8 @@ im_preedit_end_macvim()
|
||||
im_delete_preedit();
|
||||
|
||||
/* Indicate that preediting has finished */
|
||||
preedit_start_col = MAXCOL;
|
||||
if (p_imst == IM_ON_THE_SPOT)
|
||||
preedit_start_col = MAXCOL;
|
||||
xim_has_preediting = FALSE;
|
||||
|
||||
#if 0
|
||||
@@ -5121,9 +5258,14 @@ im_preedit_changed_macvim(char *preedit_string, int cursor_index)
|
||||
int i;
|
||||
|
||||
# ifndef FEAT_GUI_MACVIM
|
||||
gtk_im_context_get_preedit_string(context,
|
||||
&preedit_string, NULL,
|
||||
&cursor_index);
|
||||
if (p_imst == IM_ON_THE_SPOT)
|
||||
gtk_im_context_get_preedit_string(context,
|
||||
&preedit_string, NULL,
|
||||
&cursor_index);
|
||||
else
|
||||
gtk_im_context_get_preedit_string(context,
|
||||
&preedit_string, NULL,
|
||||
NULL);
|
||||
# endif
|
||||
|
||||
#ifdef XIM_DEBUG
|
||||
@@ -5132,66 +5274,84 @@ im_preedit_changed_macvim(char *preedit_string, int cursor_index)
|
||||
|
||||
g_return_if_fail(preedit_string != NULL); /* just in case */
|
||||
|
||||
/* If preedit_start_col is MAXCOL set it to the current cursor position. */
|
||||
if (preedit_start_col == MAXCOL && preedit_string[0] != '\0')
|
||||
# ifndef FEAT_GUI_MACVIM
|
||||
if (p_imst == IM_OVER_THE_SPOT)
|
||||
{
|
||||
xim_has_preediting = TRUE;
|
||||
|
||||
/* Urgh, this breaks if the input buffer isn't empty now */
|
||||
init_preedit_start_col();
|
||||
if (preedit_string[0] == NUL)
|
||||
{
|
||||
xim_has_preediting = FALSE;
|
||||
im_delete_preedit();
|
||||
}
|
||||
else
|
||||
{
|
||||
xim_has_preediting = TRUE;
|
||||
im_show_preedit();
|
||||
}
|
||||
}
|
||||
else if (cursor_index == 0 && preedit_string[0] == '\0')
|
||||
else
|
||||
# endif
|
||||
{
|
||||
xim_has_preediting = FALSE;
|
||||
/* If preedit_start_col is MAXCOL set it to the current cursor position. */
|
||||
if (preedit_start_col == MAXCOL && preedit_string[0] != '\0')
|
||||
{
|
||||
xim_has_preediting = TRUE;
|
||||
|
||||
/* If at the start position (after typing backspace)
|
||||
* preedit_start_col must be reset. */
|
||||
preedit_start_col = MAXCOL;
|
||||
}
|
||||
/* Urgh, this breaks if the input buffer isn't empty now */
|
||||
init_preedit_start_col();
|
||||
}
|
||||
else if (cursor_index == 0 && preedit_string[0] == '\0')
|
||||
{
|
||||
xim_has_preediting = FALSE;
|
||||
|
||||
im_delete_preedit();
|
||||
/* If at the start position (after typing backspace)
|
||||
* preedit_start_col must be reset. */
|
||||
preedit_start_col = MAXCOL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the end of the preediting area: "preedit_end_col".
|
||||
* According to the documentation of gtk_im_context_get_preedit_string(),
|
||||
* the cursor_pos output argument returns the offset in bytes. This is
|
||||
* unfortunately not true -- real life shows the offset is in characters,
|
||||
* and the GTK+ source code agrees with me. Will file a bug later.
|
||||
*/
|
||||
if (preedit_start_col != MAXCOL)
|
||||
preedit_end_col = preedit_start_col;
|
||||
str = (char_u *)preedit_string;
|
||||
for (p = str, i = 0; *p != NUL; p += utf_byte2len(*p), ++i)
|
||||
{
|
||||
int is_composing;
|
||||
im_delete_preedit();
|
||||
|
||||
is_composing = ((*p & 0x80) != 0 && utf_iscomposing(utf_ptr2char(p)));
|
||||
/*
|
||||
* These offsets are used as counters when generating <BS> and <Del>
|
||||
* to delete the preedit string. So don't count composing characters
|
||||
* unless 'delcombine' is enabled.
|
||||
* Compute the end of the preediting area: "preedit_end_col".
|
||||
* According to the documentation of gtk_im_context_get_preedit_string(),
|
||||
* the cursor_pos output argument returns the offset in bytes. This is
|
||||
* unfortunately not true -- real life shows the offset is in characters,
|
||||
* and the GTK+ source code agrees with me. Will file a bug later.
|
||||
*/
|
||||
if (!is_composing || p_deco)
|
||||
{
|
||||
if (i < cursor_index)
|
||||
++im_preedit_cursor;
|
||||
else
|
||||
++im_preedit_trailing;
|
||||
}
|
||||
if (!is_composing && i >= cursor_index)
|
||||
{
|
||||
/* This is essentially the same as im_preedit_trailing, except
|
||||
* composing characters are not counted even if p_deco is set. */
|
||||
++num_move_back;
|
||||
}
|
||||
if (preedit_start_col != MAXCOL)
|
||||
preedit_end_col += utf_ptr2cells(p);
|
||||
}
|
||||
preedit_end_col = preedit_start_col;
|
||||
str = (char_u *)preedit_string;
|
||||
for (p = str, i = 0; *p != NUL; p += utf_byte2len(*p), ++i)
|
||||
{
|
||||
int is_composing;
|
||||
|
||||
if (p > str)
|
||||
{
|
||||
im_add_to_input(str, (int)(p - str));
|
||||
im_correct_cursor(num_move_back);
|
||||
is_composing = ((*p & 0x80) != 0 && utf_iscomposing(utf_ptr2char(p)));
|
||||
/*
|
||||
* These offsets are used as counters when generating <BS> and <Del>
|
||||
* to delete the preedit string. So don't count composing characters
|
||||
* unless 'delcombine' is enabled.
|
||||
*/
|
||||
if (!is_composing || p_deco)
|
||||
{
|
||||
if (i < cursor_index)
|
||||
++im_preedit_cursor;
|
||||
else
|
||||
++im_preedit_trailing;
|
||||
}
|
||||
if (!is_composing && i >= cursor_index)
|
||||
{
|
||||
/* This is essentially the same as im_preedit_trailing, except
|
||||
* composing characters are not counted even if p_deco is set. */
|
||||
++num_move_back;
|
||||
}
|
||||
if (preedit_start_col != MAXCOL)
|
||||
preedit_end_col += utf_ptr2cells(p);
|
||||
}
|
||||
|
||||
if (p > str)
|
||||
{
|
||||
im_add_to_input(str, (int)(p - str));
|
||||
im_correct_cursor(num_move_back);
|
||||
}
|
||||
}
|
||||
|
||||
# ifndef FEAT_GUI_MACVIM
|
||||
@@ -5352,7 +5512,8 @@ im_shutdown(void)
|
||||
# endif
|
||||
im_is_active = FALSE;
|
||||
im_commit_handler_id = 0;
|
||||
preedit_start_col = MAXCOL;
|
||||
if (p_imst == IM_ON_THE_SPOT)
|
||||
preedit_start_col = MAXCOL;
|
||||
xim_has_preediting = FALSE;
|
||||
}
|
||||
|
||||
@@ -5511,7 +5672,8 @@ xim_reset(void)
|
||||
}
|
||||
# endif
|
||||
|
||||
preedit_start_col = MAXCOL;
|
||||
if (p_imst == IM_ON_THE_SPOT)
|
||||
preedit_start_col = MAXCOL;
|
||||
xim_has_preediting = FALSE;
|
||||
}
|
||||
|
||||
@@ -5617,19 +5779,22 @@ xim_queue_key_press_event(GdkEventKey *event, int down)
|
||||
{
|
||||
int imresult = gtk_im_context_filter_keypress(xic, event);
|
||||
|
||||
/* Some XIM send following sequence:
|
||||
* 1. preedited string.
|
||||
* 2. committed string.
|
||||
* 3. line changed key.
|
||||
* 4. preedited string.
|
||||
* 5. remove preedited string.
|
||||
* if 3, Vim can't move back the above line for 5.
|
||||
* thus, this part should not parse the key. */
|
||||
if (!imresult && preedit_start_col != MAXCOL
|
||||
&& event->keyval == GDK_Return)
|
||||
if (p_imst == IM_ON_THE_SPOT)
|
||||
{
|
||||
im_synthesize_keypress(GDK_Return, 0U);
|
||||
return FALSE;
|
||||
/* Some XIM send following sequence:
|
||||
* 1. preedited string.
|
||||
* 2. committed string.
|
||||
* 3. line changed key.
|
||||
* 4. preedited string.
|
||||
* 5. remove preedited string.
|
||||
* if 3, Vim can't move back the above line for 5.
|
||||
* thus, this part should not parse the key. */
|
||||
if (!imresult && preedit_start_col != MAXCOL
|
||||
&& event->keyval == GDK_Return)
|
||||
{
|
||||
im_synthesize_keypress(GDK_Return, 0U);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* If XIM tried to commit a keypad key as a single char.,
|
||||
|
||||
+7
-6
@@ -609,11 +609,9 @@ emsg(char_u *s)
|
||||
|
||||
called_emsg = TRUE;
|
||||
|
||||
/*
|
||||
* If "emsg_severe" is TRUE: When an error exception is to be thrown,
|
||||
* prefer this message over previous messages for the same command.
|
||||
*/
|
||||
#ifdef FEAT_EVAL
|
||||
/* If "emsg_severe" is TRUE: When an error exception is to be thrown,
|
||||
* prefer this message over previous messages for the same command. */
|
||||
severe = emsg_severe;
|
||||
emsg_severe = FALSE;
|
||||
#endif
|
||||
@@ -684,6 +682,9 @@ emsg(char_u *s)
|
||||
else
|
||||
flush_buffers(FALSE); /* flush internal buffers */
|
||||
did_emsg = TRUE; /* flag for DoOneCmd() */
|
||||
#ifdef FEAT_EVAL
|
||||
did_uncaught_emsg = TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
emsg_on_display = TRUE; /* remember there is an error message */
|
||||
@@ -2317,7 +2318,7 @@ msg_scroll_up(void)
|
||||
gui_undraw_cursor();
|
||||
#endif
|
||||
/* scrolling up always works */
|
||||
screen_del_lines(0, 0, 1, (int)Rows, TRUE, NULL);
|
||||
screen_del_lines(0, 0, 1, (int)Rows, TRUE, 0, NULL);
|
||||
|
||||
if (!can_clear((char_u *)" "))
|
||||
{
|
||||
@@ -2909,7 +2910,7 @@ do_more_prompt(int typed_char)
|
||||
}
|
||||
|
||||
if (toscroll == -1 && screen_ins_lines(0, 0, 1,
|
||||
(int)Rows, NULL) == OK)
|
||||
(int)Rows, 0, NULL) == OK)
|
||||
{
|
||||
/* display line at top */
|
||||
(void)disp_sb_line(0, mp);
|
||||
|
||||
+63
-55
@@ -1589,8 +1589,7 @@ open_line(
|
||||
&& curbuf->b_p_ai)
|
||||
{
|
||||
fixthisline(get_lisp_indent);
|
||||
p = ml_get_curline();
|
||||
ai_col = (colnr_T)(skipwhite(p) - p);
|
||||
ai_col = (colnr_T)getwhitecols_curline();
|
||||
}
|
||||
#endif
|
||||
#ifdef FEAT_CINDENT
|
||||
@@ -1608,8 +1607,7 @@ open_line(
|
||||
: KEY_OPEN_BACK, ' ', linewhite(curwin->w_cursor.lnum)))
|
||||
{
|
||||
do_c_expr_indent();
|
||||
p = ml_get_curline();
|
||||
ai_col = (colnr_T)(skipwhite(p) - p);
|
||||
ai_col = (colnr_T)getwhitecols_curline();
|
||||
}
|
||||
#endif
|
||||
#if defined(FEAT_VREPLACE) && (defined(FEAT_LISP) || defined(FEAT_CINDENT))
|
||||
@@ -2730,12 +2728,15 @@ skip_to_option_part(char_u *p)
|
||||
changed(void)
|
||||
{
|
||||
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
|
||||
/* The text of the preediting area is inserted, but this doesn't
|
||||
* mean a change of the buffer yet. That is delayed until the
|
||||
* text is committed. (this means preedit becomes empty) */
|
||||
if (im_is_preediting() && !xim_changed_while_preediting)
|
||||
return;
|
||||
xim_changed_while_preediting = FALSE;
|
||||
if (p_imst == IM_ON_THE_SPOT)
|
||||
{
|
||||
/* The text of the preediting area is inserted, but this doesn't
|
||||
* mean a change of the buffer yet. That is delayed until the
|
||||
* text is committed. (this means preedit becomes empty) */
|
||||
if (im_is_preediting() && !xim_changed_while_preediting)
|
||||
return;
|
||||
xim_changed_while_preediting = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!curbuf->b_changed)
|
||||
@@ -3756,10 +3757,33 @@ init_homedir(void)
|
||||
var = mch_getenv((char_u *)"HOME");
|
||||
#endif
|
||||
|
||||
if (var != NULL && *var == NUL) /* empty is same as not set */
|
||||
var = NULL;
|
||||
|
||||
#ifdef WIN3264
|
||||
/*
|
||||
* Typically, $HOME is not defined on Windows, unless the user has
|
||||
* specifically defined it for Vim's sake. However, on Windows NT
|
||||
* platforms, $HOMEDRIVE and $HOMEPATH are automatically defined for
|
||||
* each user. Try constructing $HOME from these.
|
||||
*/
|
||||
if (var == NULL || *var == NUL)
|
||||
{
|
||||
char_u *homedrive, *homepath;
|
||||
|
||||
homedrive = mch_getenv((char_u *)"HOMEDRIVE");
|
||||
homepath = mch_getenv((char_u *)"HOMEPATH");
|
||||
if (homepath == NULL || *homepath == NUL)
|
||||
homepath = (char_u *)"\\";
|
||||
if (homedrive != NULL
|
||||
&& STRLEN(homedrive) + STRLEN(homepath) < MAXPATHL)
|
||||
{
|
||||
sprintf((char *)NameBuff, "%s%s", homedrive, homepath);
|
||||
if (NameBuff[0] != NUL)
|
||||
var = NameBuff;
|
||||
}
|
||||
}
|
||||
|
||||
if (var == NULL)
|
||||
var = mch_getenv((char_u *)"USERPROFILE");
|
||||
|
||||
/*
|
||||
* Weird but true: $HOME may contain an indirect reference to another
|
||||
* variable, esp. "%USERPROFILE%". Happens when $USERPROFILE isn't set
|
||||
@@ -3780,40 +3804,14 @@ init_homedir(void)
|
||||
{
|
||||
vim_snprintf((char *)NameBuff, MAXPATHL, "%s%s", exp, p + 1);
|
||||
var = NameBuff;
|
||||
/* Also set $HOME, it's needed for _viminfo. */
|
||||
vim_setenv((char_u *)"HOME", NameBuff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Typically, $HOME is not defined on Windows, unless the user has
|
||||
* specifically defined it for Vim's sake. However, on Windows NT
|
||||
* platforms, $HOMEDRIVE and $HOMEPATH are automatically defined for
|
||||
* each user. Try constructing $HOME from these.
|
||||
*/
|
||||
if (var == NULL)
|
||||
{
|
||||
char_u *homedrive, *homepath;
|
||||
if (var != NULL && *var == NUL) /* empty is same as not set */
|
||||
var = NULL;
|
||||
|
||||
homedrive = mch_getenv((char_u *)"HOMEDRIVE");
|
||||
homepath = mch_getenv((char_u *)"HOMEPATH");
|
||||
if (homepath == NULL || *homepath == NUL)
|
||||
homepath = (char_u *)"\\";
|
||||
if (homedrive != NULL
|
||||
&& STRLEN(homedrive) + STRLEN(homepath) < MAXPATHL)
|
||||
{
|
||||
sprintf((char *)NameBuff, "%s%s", homedrive, homepath);
|
||||
if (NameBuff[0] != NUL)
|
||||
{
|
||||
var = NameBuff;
|
||||
/* Also set $HOME, it's needed for _viminfo. */
|
||||
vim_setenv((char_u *)"HOME", NameBuff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# if defined(FEAT_MBYTE)
|
||||
# ifdef FEAT_MBYTE
|
||||
if (enc_utf8 && var != NULL)
|
||||
{
|
||||
int len;
|
||||
@@ -3829,9 +3827,7 @@ init_homedir(void)
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(MSWIN)
|
||||
/*
|
||||
* Default home dir is C:/
|
||||
* Best assumption we can make in such a situation.
|
||||
@@ -3839,6 +3835,7 @@ init_homedir(void)
|
||||
if (var == NULL)
|
||||
var = (char_u *)"C:/";
|
||||
#endif
|
||||
|
||||
if (var != NULL)
|
||||
{
|
||||
#ifdef UNIX
|
||||
@@ -4667,6 +4664,10 @@ home_replace(
|
||||
homedir_env_orig = homedir_env = mch_getenv((char_u *)"SYS$LOGIN");
|
||||
#else
|
||||
homedir_env_orig = homedir_env = mch_getenv((char_u *)"HOME");
|
||||
#endif
|
||||
#ifdef WIN3264
|
||||
if (homedir_env == NULL)
|
||||
homedir_env_orig = homedir_env = mch_getenv((char_u *)"USERPROFILE");
|
||||
#endif
|
||||
/* Empty is the same as not set. */
|
||||
if (homedir_env != NULL && *homedir_env == NUL)
|
||||
@@ -5227,7 +5228,7 @@ FullName_save(
|
||||
|
||||
static char_u *skip_string(char_u *p);
|
||||
static pos_T *ind_find_start_comment(void);
|
||||
static pos_T *ind_find_start_CORS(void);
|
||||
static pos_T *ind_find_start_CORS(linenr_T *is_raw);
|
||||
static pos_T *find_start_rawstring(int ind_maxcomment);
|
||||
|
||||
/*
|
||||
@@ -5278,11 +5279,12 @@ find_start_comment(int ind_maxcomment) /* XXX */
|
||||
* Find the start of a comment or raw string, not knowing if we are in a
|
||||
* comment or raw string right now.
|
||||
* Search starts at w_cursor.lnum and goes backwards.
|
||||
* If is_raw is given and returns start of raw_string, sets it to true.
|
||||
* Return NULL when not inside a comment or raw string.
|
||||
* "CORS" -> Comment Or Raw String
|
||||
*/
|
||||
static pos_T *
|
||||
ind_find_start_CORS(void) /* XXX */
|
||||
ind_find_start_CORS(linenr_T *is_raw) /* XXX */
|
||||
{
|
||||
static pos_T comment_pos_copy;
|
||||
pos_T *comment_pos;
|
||||
@@ -5302,7 +5304,11 @@ ind_find_start_CORS(void) /* XXX */
|
||||
* If rs_pos is before comment_pos the comment is inside the raw string. */
|
||||
if (comment_pos == NULL || (rs_pos != NULL
|
||||
&& LT_POS(*rs_pos, *comment_pos)))
|
||||
{
|
||||
if (is_raw != NULL && rs_pos != NULL)
|
||||
*is_raw = rs_pos->lnum;
|
||||
return rs_pos;
|
||||
}
|
||||
return comment_pos;
|
||||
}
|
||||
|
||||
@@ -5647,7 +5653,7 @@ cin_islabel(void) /* XXX */
|
||||
* it.
|
||||
*/
|
||||
curwin->w_cursor.col = 0;
|
||||
if ((trypos = ind_find_start_CORS()) != NULL) /* XXX */
|
||||
if ((trypos = ind_find_start_CORS(NULL)) != NULL) /* XXX */
|
||||
curwin->w_cursor = *trypos;
|
||||
|
||||
line = ml_get_curline();
|
||||
@@ -6774,7 +6780,7 @@ find_start_brace(void) /* XXX */
|
||||
pos = NULL;
|
||||
/* ignore the { if it's in a // or / * * / comment */
|
||||
if ((colnr_T)cin_skip2pos(trypos) == trypos->col
|
||||
&& (pos = ind_find_start_CORS()) == NULL) /* XXX */
|
||||
&& (pos = ind_find_start_CORS(NULL)) == NULL) /* XXX */
|
||||
break;
|
||||
if (pos != NULL)
|
||||
curwin->w_cursor.lnum = pos->lnum;
|
||||
@@ -6825,7 +6831,7 @@ retry:
|
||||
pos_copy = *trypos; /* copy trypos, findmatch will change it */
|
||||
trypos = &pos_copy;
|
||||
curwin->w_cursor = *trypos;
|
||||
if ((trypos_wk = ind_find_start_CORS()) != NULL) /* XXX */
|
||||
if ((trypos_wk = ind_find_start_CORS(NULL)) != NULL) /* XXX */
|
||||
{
|
||||
ind_maxp_wk = ind_maxparen - (int)(cursor_save.lnum
|
||||
- trypos_wk->lnum);
|
||||
@@ -7195,6 +7201,7 @@ get_c_indent(void)
|
||||
int original_line_islabel;
|
||||
int added_to_amount = 0;
|
||||
int js_cur_has_key = 0;
|
||||
linenr_T raw_string_start = 0;
|
||||
cpp_baseclass_cache_T cache_cpp_baseclass = { FALSE, { MAXLNUM, 0 } };
|
||||
|
||||
/* make a copy, value is changed below */
|
||||
@@ -7497,7 +7504,7 @@ get_c_indent(void)
|
||||
curwin->w_cursor.lnum = lnum;
|
||||
|
||||
/* Skip a comment or raw string. XXX */
|
||||
if ((trypos = ind_find_start_CORS()) != NULL)
|
||||
if ((trypos = ind_find_start_CORS(NULL)) != NULL)
|
||||
{
|
||||
lnum = trypos->lnum + 1;
|
||||
continue;
|
||||
@@ -7938,7 +7945,7 @@ get_c_indent(void)
|
||||
* If we're in a comment or raw string now, skip to
|
||||
* the start of it.
|
||||
*/
|
||||
trypos = ind_find_start_CORS();
|
||||
trypos = ind_find_start_CORS(NULL);
|
||||
if (trypos != NULL)
|
||||
{
|
||||
curwin->w_cursor.lnum = trypos->lnum + 1;
|
||||
@@ -8058,7 +8065,7 @@ get_c_indent(void)
|
||||
|
||||
/* If we're in a comment or raw string now, skip
|
||||
* to the start of it. */
|
||||
trypos = ind_find_start_CORS();
|
||||
trypos = ind_find_start_CORS(NULL);
|
||||
if (trypos != NULL)
|
||||
{
|
||||
curwin->w_cursor.lnum = trypos->lnum + 1;
|
||||
@@ -8096,7 +8103,7 @@ get_c_indent(void)
|
||||
* If we're in a comment or raw string now, skip to the start
|
||||
* of it.
|
||||
*/ /* XXX */
|
||||
if ((trypos = ind_find_start_CORS()) != NULL)
|
||||
if ((trypos = ind_find_start_CORS(&raw_string_start)) != NULL)
|
||||
{
|
||||
curwin->w_cursor.lnum = trypos->lnum + 1;
|
||||
curwin->w_cursor.col = 0;
|
||||
@@ -8663,7 +8670,8 @@ get_c_indent(void)
|
||||
curwin->w_cursor.lnum);
|
||||
if (lookfor != LOOKFOR_TERM
|
||||
&& lookfor != LOOKFOR_JS_KEY
|
||||
&& lookfor != LOOKFOR_COMMA)
|
||||
&& lookfor != LOOKFOR_COMMA
|
||||
&& raw_string_start != curwin->w_cursor.lnum)
|
||||
lookfor = LOOKFOR_UNTERM;
|
||||
}
|
||||
}
|
||||
@@ -8944,7 +8952,7 @@ term_again:
|
||||
* If we're in a comment or raw string now, skip to the start
|
||||
* of it.
|
||||
*/ /* XXX */
|
||||
if ((trypos = ind_find_start_CORS()) != NULL)
|
||||
if ((trypos = ind_find_start_CORS(NULL)) != NULL)
|
||||
{
|
||||
curwin->w_cursor.lnum = trypos->lnum + 1;
|
||||
curwin->w_cursor.col = 0;
|
||||
|
||||
+15
-1
@@ -605,7 +605,21 @@ check_cursor_col_win(win_T *win)
|
||||
else if (ve_flags == VE_ALL)
|
||||
{
|
||||
if (oldcoladd > win->w_cursor.col)
|
||||
{
|
||||
win->w_cursor.coladd = oldcoladd - win->w_cursor.col;
|
||||
|
||||
/* Make sure that coladd is not more than the char width.
|
||||
* Not for the last character, coladd is then used when the cursor
|
||||
* is actually after the last character. */
|
||||
if (win->w_cursor.col + 1 < len && win->w_cursor.coladd > 0)
|
||||
{
|
||||
int cs, ce;
|
||||
|
||||
getvcol(win, &win->w_cursor, &cs, NULL, &ce);
|
||||
if (win->w_cursor.coladd > ce - cs)
|
||||
win->w_cursor.coladd = ce - cs;
|
||||
}
|
||||
}
|
||||
else
|
||||
/* avoid weird number when there is a miscalculation or overflow */
|
||||
win->w_cursor.coladd = 0;
|
||||
@@ -6316,7 +6330,7 @@ parse_queued_messages(void)
|
||||
{
|
||||
/* For Win32 mch_breakcheck() does not check for input, do it here. */
|
||||
# if defined(WIN32) && defined(FEAT_JOB_CHANNEL)
|
||||
channel_handle_events();
|
||||
channel_handle_events(FALSE);
|
||||
# endif
|
||||
|
||||
# ifdef FEAT_NETBEANS_INTG
|
||||
|
||||
+1
-1
@@ -1192,7 +1192,7 @@ curs_columns(
|
||||
if (extra > 0)
|
||||
win_ins_lines(curwin, 0, extra, FALSE, FALSE);
|
||||
else if (extra < 0)
|
||||
win_del_lines(curwin, 0, -extra, FALSE, FALSE);
|
||||
win_del_lines(curwin, 0, -extra, FALSE, FALSE, 0);
|
||||
}
|
||||
else
|
||||
curwin->w_skipcol = 0;
|
||||
|
||||
+22
-26
@@ -1308,6 +1308,12 @@ normal_end:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_TERMINAL
|
||||
/* don't go to Insert mode from Terminal-Job mode */
|
||||
if (term_use_loop())
|
||||
restart_edit = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* May restart edit(), if we got here with CTRL-O in Insert mode (but not
|
||||
* if still inside a mapping that started in Visual mode).
|
||||
@@ -1565,7 +1571,12 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
|
||||
|
||||
oap->start = VIsual;
|
||||
if (VIsual_mode == 'V')
|
||||
{
|
||||
oap->start.col = 0;
|
||||
# ifdef FEAT_VIRTUALEDIT
|
||||
oap->start.coladd = 0;
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3344,9 +3355,6 @@ reset_VIsual(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(FEAT_BEVAL)
|
||||
static int find_is_eval_item(char_u *ptr, int *colp, int *nbp, int dir);
|
||||
|
||||
/*
|
||||
* Check for a balloon-eval special item to include when searching for an
|
||||
* identifier. When "dir" is BACKWARD "ptr[-1]" must be valid!
|
||||
@@ -3385,7 +3393,6 @@ find_is_eval_item(
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Find the identifier under or to the right of the cursor.
|
||||
@@ -3435,9 +3442,7 @@ find_ident_at_pos(
|
||||
int prev_class;
|
||||
int prevcol;
|
||||
#endif
|
||||
#if defined(FEAT_BEVAL)
|
||||
int bn = 0; /* bracket nesting */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* if i == 0: try to find an identifier
|
||||
@@ -3455,11 +3460,9 @@ find_ident_at_pos(
|
||||
{
|
||||
while (ptr[col] != NUL)
|
||||
{
|
||||
# if defined(FEAT_BEVAL)
|
||||
/* Stop at a ']' to evaluate "a[x]". */
|
||||
if ((find_type & FIND_EVAL) && ptr[col] == ']')
|
||||
break;
|
||||
# endif
|
||||
this_class = mb_get_class(ptr + col);
|
||||
if (this_class != 0 && (i == 1 || this_class != 1))
|
||||
break;
|
||||
@@ -3470,16 +3473,12 @@ find_ident_at_pos(
|
||||
#endif
|
||||
while (ptr[col] != NUL
|
||||
&& (i == 0 ? !vim_iswordc(ptr[col]) : VIM_ISWHITE(ptr[col]))
|
||||
# if defined(FEAT_BEVAL)
|
||||
&& (!(find_type & FIND_EVAL) || ptr[col] != ']')
|
||||
# endif
|
||||
)
|
||||
++col;
|
||||
|
||||
#if defined(FEAT_BEVAL)
|
||||
/* When starting on a ']' count it, so that we include the '['. */
|
||||
bn = ptr[col] == ']';
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 2. Back up to start of identifier/string.
|
||||
@@ -3488,11 +3487,9 @@ find_ident_at_pos(
|
||||
if (has_mbyte)
|
||||
{
|
||||
/* Remember class of character under cursor. */
|
||||
# if defined(FEAT_BEVAL)
|
||||
if ((find_type & FIND_EVAL) && ptr[col] == ']')
|
||||
this_class = mb_get_class((char_u *)"a");
|
||||
else
|
||||
# endif
|
||||
this_class = mb_get_class(ptr + col);
|
||||
while (col > 0 && this_class != 0)
|
||||
{
|
||||
@@ -3502,12 +3499,10 @@ find_ident_at_pos(
|
||||
&& (i == 0
|
||||
|| prev_class == 0
|
||||
|| (find_type & FIND_IDENT))
|
||||
# if defined(FEAT_BEVAL)
|
||||
&& (!(find_type & FIND_EVAL)
|
||||
|| prevcol == 0
|
||||
|| !find_is_eval_item(ptr + prevcol, &prevcol,
|
||||
&bn, BACKWARD))
|
||||
# endif
|
||||
)
|
||||
break;
|
||||
col = prevcol;
|
||||
@@ -3529,12 +3524,10 @@ find_ident_at_pos(
|
||||
: (!VIM_ISWHITE(ptr[col - 1])
|
||||
&& (!(find_type & FIND_IDENT)
|
||||
|| !vim_iswordc(ptr[col - 1]))))
|
||||
#if defined(FEAT_BEVAL)
|
||||
|| ((find_type & FIND_EVAL)
|
||||
&& col > 1
|
||||
&& find_is_eval_item(ptr + col - 1, &col,
|
||||
&bn, BACKWARD))
|
||||
#endif
|
||||
))
|
||||
--col;
|
||||
|
||||
@@ -3566,10 +3559,8 @@ find_ident_at_pos(
|
||||
/*
|
||||
* 3. Find the end if the identifier/string.
|
||||
*/
|
||||
#if defined(FEAT_BEVAL)
|
||||
bn = 0;
|
||||
startcol -= col;
|
||||
#endif
|
||||
col = 0;
|
||||
#ifdef FEAT_MBYTE
|
||||
if (has_mbyte)
|
||||
@@ -3579,11 +3570,9 @@ find_ident_at_pos(
|
||||
while (ptr[col] != NUL
|
||||
&& ((i == 0 ? mb_get_class(ptr + col) == this_class
|
||||
: mb_get_class(ptr + col) != 0)
|
||||
# if defined(FEAT_BEVAL)
|
||||
|| ((find_type & FIND_EVAL)
|
||||
&& col <= (int)startcol
|
||||
&& find_is_eval_item(ptr + col, &col, &bn, FORWARD))
|
||||
# endif
|
||||
))
|
||||
col += (*mb_ptr2len)(ptr + col);
|
||||
}
|
||||
@@ -3591,11 +3580,9 @@ find_ident_at_pos(
|
||||
#endif
|
||||
while ((i == 0 ? vim_iswordc(ptr[col])
|
||||
: (ptr[col] != NUL && !VIM_ISWHITE(ptr[col])))
|
||||
# if defined(FEAT_BEVAL)
|
||||
|| ((find_type & FIND_EVAL)
|
||||
&& col <= (int)startcol
|
||||
&& find_is_eval_item(ptr + col, &col, &bn, FORWARD))
|
||||
# endif
|
||||
)
|
||||
{
|
||||
++col;
|
||||
@@ -4629,7 +4616,7 @@ nv_mousescroll(cmdarg_T *cap)
|
||||
int scroll_wheel_force = 0;
|
||||
# endif
|
||||
# ifdef FEAT_WINDOWS
|
||||
win_T *old_curwin = curwin;
|
||||
win_T *old_curwin = curwin, *wp;
|
||||
|
||||
if (mouse_row >= 0 && mouse_col >= 0)
|
||||
{
|
||||
@@ -4639,7 +4626,10 @@ nv_mousescroll(cmdarg_T *cap)
|
||||
col = mouse_col;
|
||||
|
||||
/* find the window at the pointer coordinates */
|
||||
curwin = mouse_find_win(&row, &col);
|
||||
wp = mouse_find_win(&row, &col);
|
||||
if (wp == NULL)
|
||||
return;
|
||||
curwin = wp;
|
||||
curbuf = curwin->w_buffer;
|
||||
}
|
||||
# endif
|
||||
@@ -5668,6 +5658,11 @@ nv_ident(cmdarg_T *cap)
|
||||
kp = (*curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp);
|
||||
kp_help = (*kp == NUL || STRCMP(kp, ":he") == 0
|
||||
|| STRCMP(kp, ":help") == 0);
|
||||
if (kp_help && *skipwhite(ptr) == NUL)
|
||||
{
|
||||
EMSG(_(e_noident)); /* found white space only */
|
||||
return;
|
||||
}
|
||||
kp_ex = (*kp == ':');
|
||||
buflen = (unsigned)(n * 2 + 30 + STRLEN(kp));
|
||||
buf = alloc(buflen);
|
||||
@@ -7605,6 +7600,7 @@ nv_gomark(cmdarg_T *cap)
|
||||
if (!virtual_active())
|
||||
curwin->w_cursor.coladd = 0;
|
||||
#endif
|
||||
check_cursor_col();
|
||||
#ifdef FEAT_FOLDING
|
||||
if (cap->oap->op_type == OP_NOP
|
||||
&& pos != NULL
|
||||
|
||||
@@ -2507,6 +2507,7 @@ op_insert(oparg_T *oap, long count1)
|
||||
{
|
||||
long ins_len, pre_textlen = 0;
|
||||
char_u *firstline, *ins_text;
|
||||
colnr_T ind_pre = 0, ind_post;
|
||||
struct block_def bd;
|
||||
int i;
|
||||
pos_T t1;
|
||||
@@ -2541,7 +2542,10 @@ op_insert(oparg_T *oap, long count1)
|
||||
#endif
|
||||
/* Get the info about the block before entering the text */
|
||||
block_prep(oap, &bd, oap->start.lnum, TRUE);
|
||||
/* Get indent information */
|
||||
ind_pre = (colnr_T)getwhitecols_curline();
|
||||
firstline = ml_get(oap->start.lnum) + bd.textcol;
|
||||
|
||||
if (oap->op_type == OP_APPEND)
|
||||
firstline += bd.textlen;
|
||||
pre_textlen = (long)STRLEN(firstline);
|
||||
@@ -2603,6 +2607,15 @@ op_insert(oparg_T *oap, long count1)
|
||||
{
|
||||
struct block_def bd2;
|
||||
|
||||
/* If indent kicked in, the firstline might have changed
|
||||
* but only do that, if the indent actually increased. */
|
||||
ind_post = (colnr_T)getwhitecols_curline();
|
||||
if (curbuf->b_op_start.col > ind_pre && ind_post > ind_pre)
|
||||
{
|
||||
bd.textcol += ind_post - ind_pre;
|
||||
bd.start_vcol += ind_post - ind_pre;
|
||||
}
|
||||
|
||||
/* The user may have moved the cursor before inserting something, try
|
||||
* to adjust the block for that. */
|
||||
if (oap->start.lnum == curbuf->b_op_start_orig.lnum && !bd.is_MAX)
|
||||
@@ -2754,7 +2767,7 @@ op_change(oparg_T *oap)
|
||||
# endif
|
||||
firstline = ml_get(oap->start.lnum);
|
||||
pre_textlen = (long)STRLEN(firstline);
|
||||
pre_indent = (long)(skipwhite(firstline) - firstline);
|
||||
pre_indent = (long)getwhitecols(firstline);
|
||||
bd.textcol = curwin->w_cursor.col;
|
||||
}
|
||||
#endif
|
||||
@@ -2779,7 +2792,7 @@ op_change(oparg_T *oap)
|
||||
firstline = ml_get(oap->start.lnum);
|
||||
if (bd.textcol > (colnr_T)pre_indent)
|
||||
{
|
||||
long new_indent = (long)(skipwhite(firstline) - firstline);
|
||||
long new_indent = (long)getwhitecols(firstline);
|
||||
|
||||
pre_textlen += new_indent - pre_indent;
|
||||
bd.textcol += new_indent - pre_indent;
|
||||
@@ -5065,8 +5078,7 @@ format_lines(
|
||||
#endif
|
||||
if (second_indent > 0) /* the "leader" for FO_Q_SECOND */
|
||||
{
|
||||
char_u *p = ml_get_curline();
|
||||
int indent = (int)(skipwhite(p) - p);
|
||||
int indent = getwhitecols_curline();
|
||||
|
||||
if (indent > 0)
|
||||
{
|
||||
|
||||
+95
-46
@@ -487,7 +487,7 @@ struct vimoption
|
||||
|| defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL) \
|
||||
|| defined(FEAT_CONCEAL) || defined(FEAT_QUICKFIX) \
|
||||
|| defined(FEAT_TERMINAL)
|
||||
# define HIGHLIGHT_INIT "8:SpecialKey,~:EndOfBuffer,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine,$:StatusLineTerm"
|
||||
# define HIGHLIGHT_INIT "8:SpecialKey,~:EndOfBuffer,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine,z:StatusLineTerm,Z:StatusLineTermNC"
|
||||
#else
|
||||
# define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,t:Title,v:Visual,w:WarningMsg,W:WildMenu,>:SignColumn,*:TabLine,#:TabLineSel,_:TabLineFill"
|
||||
#endif
|
||||
@@ -1654,13 +1654,26 @@ static struct vimoption options[] =
|
||||
#endif
|
||||
SCRIPTID_INIT},
|
||||
{"imstatusfunc","imsf",P_STRING|P_VI_DEF|P_SECURE,
|
||||
# if defined(FEAT_EVAL) && defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
|
||||
#if defined(FEAT_EVAL) && defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
|
||||
(char_u *)&p_imsf, PV_NONE,
|
||||
{(char_u *)"", (char_u *)NULL}
|
||||
# else
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)NULL, (char_u *)0L}
|
||||
#endif
|
||||
SCRIPTID_INIT},
|
||||
{"imstyle", "imst", P_NUM|P_VI_DEF|P_SECURE,
|
||||
#if (defined(FEAT_XIM) && defined(FEAT_GUI_GTK)) || defined(FEAT_GUI_MACVIM)
|
||||
(char_u *)&p_imst, PV_NONE,
|
||||
# if defined(FEAT_GUI_MACVIM)
|
||||
{(char_u *)IM_ON_THE_SPOT, (char_u *)0L}
|
||||
# else
|
||||
{(char_u *)IM_OVER_THE_SPOT, (char_u *)0L}
|
||||
# endif
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)0L, (char_u *)0L}
|
||||
#endif
|
||||
SCRIPTID_INIT},
|
||||
{"include", "inc", P_STRING|P_ALLOCED|P_VI_DEF,
|
||||
#ifdef FEAT_FIND_ID
|
||||
@@ -2268,7 +2281,9 @@ static struct vimoption options[] =
|
||||
{"printheader", "pheader", P_STRING|P_VI_DEF|P_GETTEXT,
|
||||
#ifdef FEAT_PRINTER
|
||||
(char_u *)&p_header, PV_NONE,
|
||||
{(char_u *)N_("%<%f%h%m%=Page %N"), (char_u *)0L}
|
||||
/* untranslated to avoid problems when 'encoding'
|
||||
* is changed */
|
||||
{(char_u *)"%<%f%h%m%=Page %N", (char_u *)0L}
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)NULL, (char_u *)0L}
|
||||
@@ -3195,6 +3210,20 @@ static struct vimoption options[] =
|
||||
(char_u *)NULL, PV_NONE,
|
||||
#endif
|
||||
{(char_u *)1L, (char_u *)0L} SCRIPTID_INIT},
|
||||
{"winptydll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
||||
#if defined(WIN3264) && defined(FEAT_TERMINAL)
|
||||
(char_u *)&p_winptydll, PV_NONE, {
|
||||
# ifdef _WIN64
|
||||
(char_u *)"winpty64.dll",
|
||||
# else
|
||||
(char_u *)"winpty32.dll",
|
||||
# endif
|
||||
(char_u *)0L}
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)0L, (char_u *)0L}
|
||||
#endif
|
||||
SCRIPTID_INIT},
|
||||
{"winwidth", "wiw", P_NUM|P_VI_DEF,
|
||||
#ifdef FEAT_WINDOWS
|
||||
(char_u *)&p_wiw, PV_NONE,
|
||||
@@ -3240,6 +3269,8 @@ static struct vimoption options[] =
|
||||
p_term("t_AL", T_CAL)
|
||||
p_term("t_al", T_AL)
|
||||
p_term("t_bc", T_BC)
|
||||
p_term("t_BE", T_BE)
|
||||
p_term("t_BD", T_BD)
|
||||
p_term("t_cd", T_CD)
|
||||
p_term("t_ce", T_CE)
|
||||
p_term("t_cl", T_CL)
|
||||
@@ -3256,8 +3287,10 @@ static struct vimoption options[] =
|
||||
p_term("t_db", T_DB)
|
||||
p_term("t_DL", T_CDL)
|
||||
p_term("t_dl", T_DL)
|
||||
p_term("t_EC", T_CEC)
|
||||
p_term("t_EI", T_CEI)
|
||||
p_term("t_fs", T_FS)
|
||||
p_term("t_GP", T_CGP)
|
||||
p_term("t_IE", T_CIE)
|
||||
p_term("t_IS", T_CIS)
|
||||
p_term("t_ke", T_KE)
|
||||
@@ -3271,17 +3304,23 @@ static struct vimoption options[] =
|
||||
p_term("t_nd", T_ND)
|
||||
p_term("t_op", T_OP)
|
||||
p_term("t_RB", T_RBG)
|
||||
p_term("t_RC", T_CRC)
|
||||
p_term("t_RI", T_CRI)
|
||||
p_term("t_RS", T_CRS)
|
||||
p_term("t_RV", T_CRV)
|
||||
p_term("t_Sb", T_CSB)
|
||||
p_term("t_SC", T_CSC)
|
||||
p_term("t_se", T_SE)
|
||||
p_term("t_Sf", T_CSF)
|
||||
p_term("t_SH", T_CSH)
|
||||
p_term("t_SI", T_CSI)
|
||||
p_term("t_so", T_SO)
|
||||
p_term("t_SR", T_CSR)
|
||||
p_term("t_sr", T_SR)
|
||||
p_term("t_Te", T_STE)
|
||||
p_term("t_te", T_TE)
|
||||
p_term("t_ti", T_TI)
|
||||
p_term("t_Ts", T_STS)
|
||||
p_term("t_ts", T_TS)
|
||||
p_term("t_u7", T_U7)
|
||||
p_term("t_ue", T_UE)
|
||||
@@ -3290,9 +3329,9 @@ static struct vimoption options[] =
|
||||
p_term("t_vb", T_VB)
|
||||
p_term("t_ve", T_VE)
|
||||
p_term("t_vi", T_VI)
|
||||
p_term("t_VS", T_CVS)
|
||||
p_term("t_vs", T_VS)
|
||||
p_term("t_WP", T_CWP)
|
||||
p_term("t_GP", T_CGP)
|
||||
p_term("t_WS", T_CWS)
|
||||
p_term("t_xn", T_XN)
|
||||
p_term("t_xs", T_XS)
|
||||
@@ -3300,8 +3339,6 @@ static struct vimoption options[] =
|
||||
p_term("t_ZR", T_CZR)
|
||||
p_term("t_8f", T_8F)
|
||||
p_term("t_8b", T_8B)
|
||||
p_term("t_BE", T_BE)
|
||||
p_term("t_BD", T_BD)
|
||||
|
||||
/* terminal key codes are not in here */
|
||||
|
||||
@@ -4109,8 +4146,8 @@ set_init_2(void)
|
||||
* This is just guessing! Recognized are:
|
||||
* "linux" Linux console
|
||||
* "screen.linux" Linux console with screen
|
||||
* "cygwin" Cygwin shell
|
||||
* "putty" Putty program
|
||||
* "cygwin.*" Cygwin shell
|
||||
* "putty.*" Putty program
|
||||
* We also check the COLORFGBG environment variable, which is set by
|
||||
* rxvt and derivatives. This variable contains either two or three
|
||||
* values separated by semicolons; we want the last value in either
|
||||
@@ -4120,15 +4157,15 @@ set_init_2(void)
|
||||
term_bg_default(void)
|
||||
{
|
||||
#if defined(WIN3264)
|
||||
/* DOS console nearly always black */
|
||||
/* DOS console is nearly always black */
|
||||
return (char_u *)"dark";
|
||||
#else
|
||||
char_u *p;
|
||||
|
||||
if (STRCMP(T_NAME, "linux") == 0
|
||||
|| STRCMP(T_NAME, "screen.linux") == 0
|
||||
|| STRCMP(T_NAME, "cygwin") == 0
|
||||
|| STRCMP(T_NAME, "putty") == 0
|
||||
|| STRNCMP(T_NAME, "cygwin", 6) == 0
|
||||
|| STRNCMP(T_NAME, "putty", 5) == 0
|
||||
|| ((p = mch_getenv((char_u *)"COLORFGBG")) != NULL
|
||||
&& (p = vim_strrchr(p, ';')) != NULL
|
||||
&& ((p[1] >= '0' && p[1] <= '6') || p[1] == '8')
|
||||
@@ -4450,8 +4487,6 @@ trigger_optionsset_string(
|
||||
(char_u *)options[opt_idx].fullname, NULL, FALSE, NULL);
|
||||
reset_v_option_vars();
|
||||
}
|
||||
vim_free(oldval);
|
||||
vim_free(newval);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -4917,19 +4952,19 @@ do_set(
|
||||
}
|
||||
else if (opt_idx >= 0) /* string */
|
||||
{
|
||||
char_u *save_arg = NULL;
|
||||
char_u *s = NULL;
|
||||
char_u *oldval = NULL; /* previous value if *varp */
|
||||
char_u *newval;
|
||||
char_u *origval = NULL;
|
||||
char_u *save_arg = NULL;
|
||||
char_u *s = NULL;
|
||||
char_u *oldval = NULL; /* previous value if *varp */
|
||||
char_u *newval;
|
||||
char_u *origval = NULL;
|
||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
||||
char_u *saved_origval = NULL;
|
||||
char_u *saved_newval = NULL;
|
||||
char_u *saved_origval = NULL;
|
||||
char_u *saved_newval = NULL;
|
||||
#endif
|
||||
unsigned newlen;
|
||||
int comma;
|
||||
int bs;
|
||||
int new_value_alloced; /* new string option
|
||||
unsigned newlen;
|
||||
int comma;
|
||||
int bs;
|
||||
int new_value_alloced; /* new string option
|
||||
was allocated */
|
||||
|
||||
/* When using ":set opt=val" for a global option
|
||||
@@ -4942,6 +4977,16 @@ do_set(
|
||||
/* The old value is kept until we are sure that the
|
||||
* new value is valid. */
|
||||
oldval = *(char_u **)varp;
|
||||
|
||||
/* When setting the local value of a global
|
||||
* option, the old value may be the global value. */
|
||||
if (((int)options[opt_idx].indir & PV_BOTH)
|
||||
&& (opt_flags & OPT_LOCAL))
|
||||
origval = *(char_u **)get_varp(
|
||||
&options[opt_idx]);
|
||||
else
|
||||
origval = oldval;
|
||||
|
||||
if (nextchar == '&') /* set to default val */
|
||||
{
|
||||
newval = options[opt_idx].def_val[
|
||||
@@ -5018,6 +5063,8 @@ do_set(
|
||||
break;
|
||||
}
|
||||
vim_free(oldval);
|
||||
if (origval == oldval)
|
||||
origval = *(char_u **)varp;
|
||||
oldval = *(char_u **)varp;
|
||||
}
|
||||
/*
|
||||
@@ -5056,15 +5103,6 @@ do_set(
|
||||
++arg;
|
||||
}
|
||||
|
||||
/* When setting the local value of a global
|
||||
* option, the old value may be the global value. */
|
||||
if (((int)options[opt_idx].indir & PV_BOTH)
|
||||
&& (opt_flags & OPT_LOCAL))
|
||||
origval = *(char_u **)get_varp(
|
||||
&options[opt_idx]);
|
||||
else
|
||||
origval = oldval;
|
||||
|
||||
/*
|
||||
* Copy the new string into allocated memory.
|
||||
* Can't use set_string_option_direct(), because
|
||||
@@ -5268,7 +5306,9 @@ do_set(
|
||||
new_value_alloced = TRUE;
|
||||
}
|
||||
|
||||
/* Set the new value. */
|
||||
/*
|
||||
* Set the new value.
|
||||
*/
|
||||
*(char_u **)(varp) = newval;
|
||||
|
||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
||||
@@ -5294,19 +5334,16 @@ do_set(
|
||||
errmsg = did_set_string_option(opt_idx, (char_u **)varp,
|
||||
new_value_alloced, oldval, errbuf, opt_flags);
|
||||
|
||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
||||
if (errmsg == NULL)
|
||||
trigger_optionsset_string(opt_idx, opt_flags,
|
||||
saved_origval, saved_newval);
|
||||
vim_free(saved_origval);
|
||||
vim_free(saved_newval);
|
||||
#endif
|
||||
/* If error detected, print the error message. */
|
||||
if (errmsg != NULL)
|
||||
{
|
||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
||||
vim_free(saved_origval);
|
||||
vim_free(saved_newval);
|
||||
#endif
|
||||
goto skip;
|
||||
}
|
||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
||||
trigger_optionsset_string(opt_idx, opt_flags,
|
||||
saved_origval, saved_newval);
|
||||
#endif
|
||||
}
|
||||
else /* key code option */
|
||||
{
|
||||
@@ -6117,8 +6154,11 @@ set_string_option(
|
||||
|
||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
||||
/* call autocommand after handling side effects */
|
||||
trigger_optionsset_string(opt_idx, opt_flags,
|
||||
if (r == NULL)
|
||||
trigger_optionsset_string(opt_idx, opt_flags,
|
||||
saved_oldval, saved_newval);
|
||||
vim_free(saved_oldval);
|
||||
vim_free(saved_newval);
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
@@ -9160,6 +9200,15 @@ set_num_option(
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (defined(FEAT_XIM) && defined(FEAT_GUI_GTK)) || defined(FEAT_GUI_MACVIM)
|
||||
/* 'imstyle' */
|
||||
else if (pp == &p_imst)
|
||||
{
|
||||
if (p_imst != IM_ON_THE_SPOT && p_imst != IM_OVER_THE_SPOT)
|
||||
errmsg = e_invarg;
|
||||
}
|
||||
#endif
|
||||
|
||||
else if (pp == &p_window)
|
||||
{
|
||||
if (p_window < 1)
|
||||
|
||||
@@ -594,6 +594,11 @@ EXTERN char_u *p_imak; /* 'imactivatekey' */
|
||||
EXTERN char_u *p_imaf; /* 'imactivatefunc' */
|
||||
EXTERN char_u *p_imsf; /* 'imstatusfunc' */
|
||||
#endif
|
||||
#if (defined(FEAT_XIM) && defined(FEAT_GUI_GTK)) || defined(FEAT_GUI_MACVIM)
|
||||
EXTERN long p_imst; /* 'imstyle' */
|
||||
# define IM_ON_THE_SPOT 0L
|
||||
# define IM_OVER_THE_SPOT 1L
|
||||
#endif
|
||||
#ifdef USE_IM_CONTROL
|
||||
EXTERN int p_imcmdline; /* 'imcmdline' */
|
||||
EXTERN int p_imdisable; /* 'imdisable' */
|
||||
@@ -989,6 +994,9 @@ EXTERN long p_wmh; /* 'winminheight' */
|
||||
EXTERN long p_wmw; /* 'winminwidth' */
|
||||
EXTERN long p_wiw; /* 'winwidth' */
|
||||
#endif
|
||||
#if defined(WIN3264) && defined(FEAT_TERMINAL)
|
||||
EXTERN char_u *p_winptydll; /* 'winptydll' */
|
||||
#endif
|
||||
EXTERN int p_ws; /* 'wrapscan' */
|
||||
EXTERN int p_write; /* 'write' */
|
||||
EXTERN int p_wa; /* 'writeany' */
|
||||
|
||||
+3
-1
@@ -2965,7 +2965,9 @@ get_logfont(
|
||||
int did_replace = FALSE;
|
||||
|
||||
for (i = 0; lf->lfFaceName[i]; ++i)
|
||||
if (lf->lfFaceName[i] == '_')
|
||||
if (IsDBCSLeadByte(lf->lfFaceName[i]))
|
||||
++i;
|
||||
else if (lf->lfFaceName[i] == '_')
|
||||
{
|
||||
lf->lfFaceName[i] = ' ';
|
||||
did_replace = TRUE;
|
||||
|
||||
+138
-37
@@ -365,6 +365,11 @@ mch_chdir(char *path)
|
||||
# endif
|
||||
}
|
||||
|
||||
/* Why is NeXT excluded here (and not in os_unixx.h)? */
|
||||
#if defined(ECHOE) && defined(ICANON) && (defined(HAVE_TERMIO_H) || defined(HAVE_TERMIOS_H)) && !defined(__NeXT__)
|
||||
# define NEW_TTY_SYSTEM
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Write s[len] to the screen.
|
||||
*/
|
||||
@@ -2277,6 +2282,7 @@ vim_is_xterm(char_u *name)
|
||||
|| STRNICMP(name, "kterm", 5) == 0
|
||||
|| STRNICMP(name, "mlterm", 6) == 0
|
||||
|| STRNICMP(name, "rxvt", 4) == 0
|
||||
|| STRNICMP(name, "screen.xterm", 12) == 0
|
||||
|| STRCMP(name, "builtin_xterm") == 0);
|
||||
}
|
||||
|
||||
@@ -3391,11 +3397,7 @@ mch_settmode(int tmode)
|
||||
{
|
||||
static int first = TRUE;
|
||||
|
||||
/* Why is NeXT excluded here (and not in os_unixx.h)? */
|
||||
#if defined(ECHOE) && defined(ICANON) && (defined(HAVE_TERMIO_H) || defined(HAVE_TERMIOS_H)) && !defined(__NeXT__)
|
||||
/*
|
||||
* for "new" tty systems
|
||||
*/
|
||||
#ifdef NEW_TTY_SYSTEM
|
||||
# ifdef HAVE_TERMIOS_H
|
||||
static struct termios told;
|
||||
struct termios tnew;
|
||||
@@ -3457,7 +3459,6 @@ mch_settmode(int tmode)
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* for "old" tty systems
|
||||
*/
|
||||
@@ -3498,48 +3499,72 @@ mch_settmode(int tmode)
|
||||
void
|
||||
get_stty(void)
|
||||
{
|
||||
char_u buf[2];
|
||||
char_u *p;
|
||||
ttyinfo_T info;
|
||||
char_u buf[2];
|
||||
char_u *p;
|
||||
|
||||
/* Why is NeXT excluded here (and not in os_unixx.h)? */
|
||||
#if defined(ECHOE) && defined(ICANON) && (defined(HAVE_TERMIO_H) || defined(HAVE_TERMIOS_H)) && !defined(__NeXT__)
|
||||
/* for "new" tty systems */
|
||||
if (get_tty_info(read_cmd_fd, &info) == OK)
|
||||
{
|
||||
intr_char = info.interrupt;
|
||||
buf[0] = info.backspace;
|
||||
buf[1] = NUL;
|
||||
add_termcode((char_u *)"kb", buf, FALSE);
|
||||
|
||||
/* If <BS> and <DEL> are now the same, redefine <DEL>. */
|
||||
p = find_termcode((char_u *)"kD");
|
||||
if (p != NULL && p[0] == buf[0] && p[1] == buf[1])
|
||||
do_fixdel(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Obtain the characters that Backspace and Enter produce on "fd".
|
||||
* Returns OK or FAIL.
|
||||
*/
|
||||
int
|
||||
get_tty_info(int fd, ttyinfo_T *info)
|
||||
{
|
||||
#ifdef NEW_TTY_SYSTEM
|
||||
# ifdef HAVE_TERMIOS_H
|
||||
struct termios keys;
|
||||
# else
|
||||
struct termio keys;
|
||||
# endif
|
||||
|
||||
if (
|
||||
# if defined(HAVE_TERMIOS_H)
|
||||
if (tcgetattr(read_cmd_fd, &keys) != -1)
|
||||
tcgetattr(fd, &keys) != -1
|
||||
# else
|
||||
if (ioctl(read_cmd_fd, TCGETA, &keys) != -1)
|
||||
ioctl(fd, TCGETA, &keys) != -1
|
||||
# endif
|
||||
)
|
||||
{
|
||||
buf[0] = keys.c_cc[VERASE];
|
||||
intr_char = keys.c_cc[VINTR];
|
||||
info->backspace = keys.c_cc[VERASE];
|
||||
info->interrupt = keys.c_cc[VINTR];
|
||||
if (keys.c_iflag & ICRNL)
|
||||
info->enter = NL;
|
||||
else
|
||||
info->enter = CAR;
|
||||
if (keys.c_oflag & ONLCR)
|
||||
info->nl_does_cr = TRUE;
|
||||
else
|
||||
info->nl_does_cr = FALSE;
|
||||
return OK;
|
||||
}
|
||||
#else
|
||||
/* for "old" tty systems */
|
||||
struct sgttyb keys;
|
||||
|
||||
if (ioctl(read_cmd_fd, TIOCGETP, &keys) != -1)
|
||||
if (ioctl(fd, TIOCGETP, &keys) != -1)
|
||||
{
|
||||
buf[0] = keys.sg_erase;
|
||||
intr_char = keys.sg_kill;
|
||||
#endif
|
||||
buf[1] = NUL;
|
||||
add_termcode((char_u *)"kb", buf, FALSE);
|
||||
|
||||
/*
|
||||
* If <BS> and <DEL> are now the same, redefine <DEL>.
|
||||
*/
|
||||
p = find_termcode((char_u *)"kD");
|
||||
if (p != NULL && p[0] == buf[0] && p[1] == buf[1])
|
||||
do_fixdel(NULL);
|
||||
info->backspace = keys.sg_erase;
|
||||
info->interrupt = keys.sg_kill;
|
||||
info->enter = CAR;
|
||||
info->nl_does_cr = TRUE;
|
||||
return OK;
|
||||
}
|
||||
#if 0
|
||||
} /* to keep cindent happy */
|
||||
#endif
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
#endif /* VMS */
|
||||
@@ -4075,8 +4100,17 @@ mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc)
|
||||
++*argc;
|
||||
while (*p != NUL && (inquote || (*p != ' ' && *p != TAB)))
|
||||
{
|
||||
if (*p == '"')
|
||||
if (p[0] == '"')
|
||||
inquote = !inquote;
|
||||
else if (p[0] == '\\' && p[1] != NUL)
|
||||
{
|
||||
/* First pass: skip over "\ " and "\"".
|
||||
* Second pass: Remove the backslash. */
|
||||
if (i == 1)
|
||||
mch_memmove(p, p + 1, STRLEN(p));
|
||||
else
|
||||
++p;
|
||||
}
|
||||
++p;
|
||||
}
|
||||
if (*p == NUL)
|
||||
@@ -4328,6 +4362,7 @@ mch_call_shell(
|
||||
|
||||
# define EXEC_FAILED 122 /* Exit code when shell didn't execute. Don't use
|
||||
127, some shells use that already */
|
||||
# define OPEN_NULL_FAILED 123 /* Exit code if /dev/null can't be opened */
|
||||
|
||||
char_u *newcmd;
|
||||
pid_t pid;
|
||||
@@ -5236,6 +5271,7 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options)
|
||||
int use_file_for_in = options->jo_io[PART_IN] == JIO_FILE;
|
||||
int use_file_for_out = options->jo_io[PART_OUT] == JIO_FILE;
|
||||
int use_file_for_err = options->jo_io[PART_ERR] == JIO_FILE;
|
||||
int use_buffer_for_in = options->jo_io[PART_IN] == JIO_BUFFER;
|
||||
int use_out_for_err = options->jo_io[PART_ERR] == JIO_OUT;
|
||||
SIGSET_DECL(curset)
|
||||
|
||||
@@ -5245,8 +5281,15 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options)
|
||||
/* default is to fail */
|
||||
job->jv_status = JOB_FAILED;
|
||||
|
||||
if (options->jo_pty)
|
||||
open_pty(&pty_master_fd, &pty_slave_fd, &job->jv_tty_name);
|
||||
if (options->jo_pty
|
||||
&& (!(use_file_for_in || use_null_for_in)
|
||||
|| !(use_file_for_in || use_null_for_out)
|
||||
|| !(use_out_for_err || use_file_for_err || use_null_for_err)))
|
||||
{
|
||||
open_pty(&pty_master_fd, &pty_slave_fd, &job->jv_tty_out);
|
||||
if (job->jv_tty_out != NULL)
|
||||
job->jv_tty_in = vim_strsave(job->jv_tty_out);
|
||||
}
|
||||
|
||||
/* TODO: without the channel feature connect the child to /dev/null? */
|
||||
/* Open pipes for stdin, stdout, stderr. */
|
||||
@@ -5261,8 +5304,12 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options)
|
||||
goto failed;
|
||||
}
|
||||
}
|
||||
else if (!use_null_for_in && pty_master_fd < 0 && pipe(fd_in) < 0)
|
||||
goto failed;
|
||||
else
|
||||
/* When writing buffer lines to the input don't use the pty, so that
|
||||
* the pipe can be closed when all lines were written. */
|
||||
if (!use_null_for_in && (pty_master_fd < 0 || use_buffer_for_in)
|
||||
&& pipe(fd_in) < 0)
|
||||
goto failed;
|
||||
|
||||
if (use_file_for_out)
|
||||
{
|
||||
@@ -5342,8 +5389,31 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options)
|
||||
# endif
|
||||
set_default_child_environment();
|
||||
|
||||
if (options->jo_env != NULL)
|
||||
{
|
||||
dict_T *dict = options->jo_env;
|
||||
hashitem_T *hi;
|
||||
int todo = (int)dict->dv_hashtab.ht_used;
|
||||
|
||||
for (hi = dict->dv_hashtab.ht_array; todo > 0; ++hi)
|
||||
if (!HASHITEM_EMPTY(hi))
|
||||
{
|
||||
typval_T *item = &dict_lookup(hi)->di_tv;
|
||||
|
||||
vim_setenv((char_u*)hi->hi_key, get_tv_string(item));
|
||||
--todo;
|
||||
}
|
||||
}
|
||||
|
||||
if (use_null_for_in || use_null_for_out || use_null_for_err)
|
||||
{
|
||||
null_fd = open("/dev/null", O_RDWR | O_EXTRA, 0);
|
||||
if (null_fd < 0)
|
||||
{
|
||||
perror("opening /dev/null failed");
|
||||
_exit(OPEN_NULL_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
if (pty_slave_fd >= 0)
|
||||
{
|
||||
@@ -5409,6 +5479,9 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options)
|
||||
if (null_fd >= 0)
|
||||
close(null_fd);
|
||||
|
||||
if (options->jo_cwd != NULL && mch_chdir((char *)options->jo_cwd) != 0)
|
||||
_exit(EXEC_FAILED);
|
||||
|
||||
/* See above for type of argv. */
|
||||
execvp(argv[0], argv);
|
||||
|
||||
@@ -5429,7 +5502,7 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options)
|
||||
job->jv_channel = channel; /* ch_refcount was set above */
|
||||
|
||||
if (pty_master_fd >= 0)
|
||||
close(pty_slave_fd); /* duped above */
|
||||
close(pty_slave_fd); /* not used in the parent */
|
||||
/* close child stdin, stdout and stderr */
|
||||
if (!use_file_for_in && fd_in[0] >= 0)
|
||||
close(fd_in[0]);
|
||||
@@ -5579,7 +5652,7 @@ mch_detect_ended_job(job_T *job_list)
|
||||
* Return FAIL if "how" is not a valid name.
|
||||
*/
|
||||
int
|
||||
mch_stop_job(job_T *job, char_u *how)
|
||||
mch_signal_job(job_T *job, char_u *how)
|
||||
{
|
||||
int sig = -1;
|
||||
pid_t job_pid;
|
||||
@@ -5632,6 +5705,34 @@ mch_clear_job(job_T *job)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_TERMINAL) || defined(PROTO)
|
||||
int
|
||||
mch_create_pty_channel(job_T *job, jobopt_T *options)
|
||||
{
|
||||
int pty_master_fd = -1;
|
||||
int pty_slave_fd = -1;
|
||||
channel_T *channel;
|
||||
|
||||
open_pty(&pty_master_fd, &pty_slave_fd, &job->jv_tty_out);
|
||||
if (job->jv_tty_out != NULL)
|
||||
job->jv_tty_in = vim_strsave(job->jv_tty_out);
|
||||
close(pty_slave_fd);
|
||||
|
||||
channel = add_channel();
|
||||
if (channel == NULL)
|
||||
{
|
||||
close(pty_master_fd);
|
||||
return FAIL;
|
||||
}
|
||||
job->jv_channel = channel; /* ch_refcount was set by add_channel() */
|
||||
channel->ch_keep_open = TRUE;
|
||||
|
||||
channel_set_pipes(channel, pty_master_fd, pty_master_fd, pty_master_fd);
|
||||
channel_set_job(channel, job, options);
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Check for CTRL-C typed by reading all available characters.
|
||||
* In cooked mode we should get SIGINT, no need to check.
|
||||
|
||||
+167
-38
@@ -2192,6 +2192,8 @@ typedef struct ConsoleBufferStruct
|
||||
CONSOLE_SCREEN_BUFFER_INFO Info;
|
||||
PCHAR_INFO Buffer;
|
||||
COORD BufferSize;
|
||||
PSMALL_RECT Regions;
|
||||
int NumRegions;
|
||||
} ConsoleBuffer;
|
||||
|
||||
/*
|
||||
@@ -2212,6 +2214,7 @@ SaveConsoleBuffer(
|
||||
COORD BufferCoord;
|
||||
SMALL_RECT ReadRegion;
|
||||
WORD Y, Y_incr;
|
||||
int i, numregions;
|
||||
|
||||
if (cb == NULL)
|
||||
return FALSE;
|
||||
@@ -2254,7 +2257,22 @@ SaveConsoleBuffer(
|
||||
ReadRegion.Left = 0;
|
||||
ReadRegion.Right = cb->Info.dwSize.X - 1;
|
||||
Y_incr = 12000 / cb->Info.dwSize.X;
|
||||
for (Y = 0; Y < cb->BufferSize.Y; Y += Y_incr)
|
||||
|
||||
numregions = (cb->Info.dwSize.Y + Y_incr - 1) / Y_incr;
|
||||
if (cb->Regions == NULL || numregions != cb->NumRegions)
|
||||
{
|
||||
cb->NumRegions = numregions;
|
||||
vim_free(cb->Regions);
|
||||
cb->Regions = (PSMALL_RECT)alloc(cb->NumRegions * sizeof(SMALL_RECT));
|
||||
if (cb->Regions == NULL)
|
||||
{
|
||||
vim_free(cb->Buffer);
|
||||
cb->Buffer = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0, Y = 0; i < cb->NumRegions; i++, Y += Y_incr)
|
||||
{
|
||||
/*
|
||||
* Read into position (0, Y) in our buffer.
|
||||
@@ -2268,7 +2286,7 @@ SaveConsoleBuffer(
|
||||
*/
|
||||
ReadRegion.Top = Y;
|
||||
ReadRegion.Bottom = Y + Y_incr - 1;
|
||||
if (!ReadConsoleOutput(g_hConOut, /* output handle */
|
||||
if (!ReadConsoleOutputW(g_hConOut, /* output handle */
|
||||
cb->Buffer, /* our buffer */
|
||||
cb->BufferSize, /* dimensions of our buffer */
|
||||
BufferCoord, /* offset in our buffer */
|
||||
@@ -2276,8 +2294,11 @@ SaveConsoleBuffer(
|
||||
{
|
||||
vim_free(cb->Buffer);
|
||||
cb->Buffer = NULL;
|
||||
vim_free(cb->Regions);
|
||||
cb->Regions = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
cb->Regions[i] = ReadRegion;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -2299,6 +2320,7 @@ RestoreConsoleBuffer(
|
||||
{
|
||||
COORD BufferCoord;
|
||||
SMALL_RECT WriteRegion;
|
||||
int i;
|
||||
|
||||
if (cb == NULL || !cb->IsValid)
|
||||
return FALSE;
|
||||
@@ -2335,19 +2357,19 @@ RestoreConsoleBuffer(
|
||||
*/
|
||||
if (cb->Buffer != NULL)
|
||||
{
|
||||
BufferCoord.X = 0;
|
||||
BufferCoord.Y = 0;
|
||||
WriteRegion.Left = 0;
|
||||
WriteRegion.Top = 0;
|
||||
WriteRegion.Right = cb->Info.dwSize.X - 1;
|
||||
WriteRegion.Bottom = cb->Info.dwSize.Y - 1;
|
||||
if (!WriteConsoleOutput(g_hConOut, /* output handle */
|
||||
cb->Buffer, /* our buffer */
|
||||
cb->BufferSize, /* dimensions of our buffer */
|
||||
BufferCoord, /* offset in our buffer */
|
||||
&WriteRegion)) /* region to restore */
|
||||
for (i = 0; i < cb->NumRegions; i++)
|
||||
{
|
||||
return FALSE;
|
||||
BufferCoord.X = cb->Regions[i].Left;
|
||||
BufferCoord.Y = cb->Regions[i].Top;
|
||||
WriteRegion = cb->Regions[i];
|
||||
if (!WriteConsoleOutputW(g_hConOut, /* output handle */
|
||||
cb->Buffer, /* our buffer */
|
||||
cb->BufferSize, /* dimensions of our buffer */
|
||||
BufferCoord, /* offset in our buffer */
|
||||
&WriteRegion)) /* region to restore */
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3719,6 +3741,9 @@ mch_free_acl(vim_acl_T acl)
|
||||
handler_routine(
|
||||
DWORD dwCtrlType)
|
||||
{
|
||||
INPUT_RECORD ir;
|
||||
DWORD out;
|
||||
|
||||
switch (dwCtrlType)
|
||||
{
|
||||
case CTRL_C_EVENT:
|
||||
@@ -3728,6 +3753,16 @@ handler_routine(
|
||||
|
||||
case CTRL_BREAK_EVENT:
|
||||
g_fCBrkPressed = TRUE;
|
||||
ctrl_break_was_pressed = TRUE;
|
||||
/* ReadConsoleInput is blocking, send a key event to continue. */
|
||||
ir.EventType = KEY_EVENT;
|
||||
ir.Event.KeyEvent.bKeyDown = TRUE;
|
||||
ir.Event.KeyEvent.wRepeatCount = 1;
|
||||
ir.Event.KeyEvent.wVirtualKeyCode = VK_CANCEL;
|
||||
ir.Event.KeyEvent.wVirtualScanCode = 0;
|
||||
ir.Event.KeyEvent.dwControlKeyState = 0;
|
||||
ir.Event.KeyEvent.uChar.UnicodeChar = 0;
|
||||
WriteConsoleInput(g_hConIn, &ir, 1, &out);
|
||||
return TRUE;
|
||||
|
||||
/* fatal events: shut down gracefully */
|
||||
@@ -3981,31 +4016,46 @@ vim_create_process(
|
||||
BOOL inherit_handles,
|
||||
DWORD flags,
|
||||
STARTUPINFO *si,
|
||||
PROCESS_INFORMATION *pi)
|
||||
PROCESS_INFORMATION *pi,
|
||||
LPVOID *env,
|
||||
char *cwd)
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
WCHAR *wcmd = enc_to_utf16((char_u *)cmd, NULL);
|
||||
BOOL ret;
|
||||
WCHAR *wcmd, *wcwd = NULL;
|
||||
|
||||
if (wcmd != NULL)
|
||||
wcmd = enc_to_utf16((char_u *)cmd, NULL);
|
||||
if (wcmd == NULL)
|
||||
goto fallback;
|
||||
if (cwd != NULL)
|
||||
{
|
||||
BOOL ret;
|
||||
ret = CreateProcessW(
|
||||
NULL, /* Executable name */
|
||||
wcmd, /* Command to execute */
|
||||
NULL, /* Process security attributes */
|
||||
NULL, /* Thread security attributes */
|
||||
inherit_handles, /* Inherit handles */
|
||||
flags, /* Creation flags */
|
||||
NULL, /* Environment */
|
||||
NULL, /* Current directory */
|
||||
(LPSTARTUPINFOW)si, /* Startup information */
|
||||
pi); /* Process information */
|
||||
vim_free(wcmd);
|
||||
return ret;
|
||||
wcwd = enc_to_utf16((char_u *)cwd, NULL);
|
||||
if (wcwd == NULL)
|
||||
{
|
||||
vim_free(wcmd);
|
||||
goto fallback;
|
||||
}
|
||||
}
|
||||
|
||||
ret = CreateProcessW(
|
||||
NULL, /* Executable name */
|
||||
wcmd, /* Command to execute */
|
||||
NULL, /* Process security attributes */
|
||||
NULL, /* Thread security attributes */
|
||||
inherit_handles, /* Inherit handles */
|
||||
flags, /* Creation flags */
|
||||
env, /* Environment */
|
||||
wcwd, /* Current directory */
|
||||
(LPSTARTUPINFOW)si, /* Startup information */
|
||||
pi); /* Process information */
|
||||
vim_free(wcmd);
|
||||
if (wcwd != NULL)
|
||||
vim_free(wcwd);
|
||||
return ret;
|
||||
}
|
||||
fallback:
|
||||
#endif
|
||||
return CreateProcess(
|
||||
NULL, /* Executable name */
|
||||
@@ -4014,8 +4064,8 @@ vim_create_process(
|
||||
NULL, /* Thread security attributes */
|
||||
inherit_handles, /* Inherit handles */
|
||||
flags, /* Creation flags */
|
||||
NULL, /* Environment */
|
||||
NULL, /* Current directory */
|
||||
env, /* Environment */
|
||||
cwd, /* Current directory */
|
||||
si, /* Startup information */
|
||||
pi); /* Process information */
|
||||
}
|
||||
@@ -4079,7 +4129,8 @@ mch_system_classic(char *cmd, int options)
|
||||
|
||||
/* Now, run the command */
|
||||
vim_create_process(cmd, FALSE,
|
||||
CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE, &si, &pi);
|
||||
CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE,
|
||||
&si, &pi, NULL, NULL);
|
||||
|
||||
/* Wait for the command to terminate before continuing */
|
||||
{
|
||||
@@ -4398,7 +4449,8 @@ mch_system_piped(char *cmd, int options)
|
||||
* About "Inherit handles" being TRUE: this command can be litigious,
|
||||
* handle inheritance was deactivated for pending temp file, but, if we
|
||||
* deactivate it, the pipes don't work for some reason. */
|
||||
vim_create_process(p, TRUE, CREATE_DEFAULT_ERROR_MODE, &si, &pi);
|
||||
vim_create_process(p, TRUE, CREATE_DEFAULT_ERROR_MODE,
|
||||
&si, &pi, NULL, NULL);
|
||||
|
||||
if (p != cmd)
|
||||
vim_free(p);
|
||||
@@ -4835,7 +4887,8 @@ mch_call_shell(
|
||||
* inherit our handles which causes unpleasant dangling swap
|
||||
* files if we exit before the spawned process
|
||||
*/
|
||||
if (vim_create_process((char *)newcmd, FALSE, flags, &si, &pi))
|
||||
if (vim_create_process((char *)newcmd, FALSE, flags,
|
||||
&si, &pi, NULL, NULL))
|
||||
x = 0;
|
||||
else if (vim_shell_execute((char *)newcmd, n_show_cmd)
|
||||
> (HINSTANCE)32)
|
||||
@@ -4976,6 +5029,70 @@ job_io_file_open(
|
||||
return h;
|
||||
}
|
||||
|
||||
/*
|
||||
* Turn the dictionary "env" into a NUL separated list that can be used as the
|
||||
* environment argument of vim_create_process().
|
||||
*/
|
||||
static void
|
||||
make_job_env(garray_T *gap, dict_T *env)
|
||||
{
|
||||
hashitem_T *hi;
|
||||
int todo = (int)env->dv_hashtab.ht_used;
|
||||
LPVOID base = GetEnvironmentStringsW();
|
||||
|
||||
/* for last \0 */
|
||||
if (ga_grow(gap, 1) == FAIL)
|
||||
return;
|
||||
|
||||
if (base)
|
||||
{
|
||||
WCHAR *p = (WCHAR*) base;
|
||||
|
||||
/* for last \0 */
|
||||
if (ga_grow(gap, 1) == FAIL)
|
||||
return;
|
||||
|
||||
while (*p != 0 || *(p + 1) != 0)
|
||||
{
|
||||
if (ga_grow(gap, 1) == OK)
|
||||
*((WCHAR*)gap->ga_data + gap->ga_len++) = *p;
|
||||
p++;
|
||||
}
|
||||
FreeEnvironmentStrings(base);
|
||||
*((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0';
|
||||
}
|
||||
|
||||
for (hi = env->dv_hashtab.ht_array; todo > 0; ++hi)
|
||||
{
|
||||
if (!HASHITEM_EMPTY(hi))
|
||||
{
|
||||
typval_T *item = &dict_lookup(hi)->di_tv;
|
||||
WCHAR *wkey = enc_to_utf16((char_u *)hi->hi_key, NULL);
|
||||
WCHAR *wval = enc_to_utf16(get_tv_string(item), NULL);
|
||||
--todo;
|
||||
if (wkey != NULL && wval != NULL)
|
||||
{
|
||||
size_t n;
|
||||
size_t lkey = wcslen(wkey);
|
||||
size_t lval = wcslen(wval);
|
||||
|
||||
if (ga_grow(gap, (int)(lkey + lval + 2)) != OK)
|
||||
continue;
|
||||
for (n = 0; n < lkey; n++)
|
||||
*((WCHAR*)gap->ga_data + gap->ga_len++) = wkey[n];
|
||||
*((WCHAR*)gap->ga_data + gap->ga_len++) = L'=';
|
||||
for (n = 0; n < lval; n++)
|
||||
*((WCHAR*)gap->ga_data + gap->ga_len++) = wval[n];
|
||||
*((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0';
|
||||
}
|
||||
if (wkey != NULL) vim_free(wkey);
|
||||
if (wval != NULL) vim_free(wval);
|
||||
}
|
||||
}
|
||||
|
||||
*((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0';
|
||||
}
|
||||
|
||||
void
|
||||
mch_job_start(char *cmd, job_T *job, jobopt_T *options)
|
||||
{
|
||||
@@ -4987,6 +5104,7 @@ mch_job_start(char *cmd, job_T *job, jobopt_T *options)
|
||||
HANDLE ifd[2];
|
||||
HANDLE ofd[2];
|
||||
HANDLE efd[2];
|
||||
garray_T ga;
|
||||
|
||||
int use_null_for_in = options->jo_io[PART_IN] == JIO_NULL;
|
||||
int use_null_for_out = options->jo_io[PART_OUT] == JIO_NULL;
|
||||
@@ -5005,6 +5123,7 @@ mch_job_start(char *cmd, job_T *job, jobopt_T *options)
|
||||
ofd[1] = INVALID_HANDLE_VALUE;
|
||||
efd[0] = INVALID_HANDLE_VALUE;
|
||||
efd[1] = INVALID_HANDLE_VALUE;
|
||||
ga_init2(&ga, (int)sizeof(wchar_t), 500);
|
||||
|
||||
jo = CreateJobObject(NULL, NULL);
|
||||
if (jo == NULL)
|
||||
@@ -5013,6 +5132,9 @@ mch_job_start(char *cmd, job_T *job, jobopt_T *options)
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (options->jo_env != NULL)
|
||||
make_job_env(&ga, options->jo_env);
|
||||
|
||||
ZeroMemory(&pi, sizeof(pi));
|
||||
ZeroMemory(&si, sizeof(si));
|
||||
si.cb = sizeof(si);
|
||||
@@ -5100,14 +5222,19 @@ mch_job_start(char *cmd, job_T *job, jobopt_T *options)
|
||||
CREATE_SUSPENDED |
|
||||
CREATE_DEFAULT_ERROR_MODE |
|
||||
CREATE_NEW_PROCESS_GROUP |
|
||||
CREATE_UNICODE_ENVIRONMENT |
|
||||
CREATE_NEW_CONSOLE,
|
||||
&si, &pi))
|
||||
&si, &pi,
|
||||
ga.ga_data,
|
||||
(char *)options->jo_cwd))
|
||||
{
|
||||
CloseHandle(jo);
|
||||
job->jv_status = JOB_FAILED;
|
||||
goto failed;
|
||||
}
|
||||
|
||||
ga_clear(&ga);
|
||||
|
||||
if (!AssignProcessToJobObject(jo, pi.hProcess))
|
||||
{
|
||||
/* if failing, switch the way to terminate
|
||||
@@ -5148,6 +5275,7 @@ failed:
|
||||
CloseHandle(ofd[1]);
|
||||
CloseHandle(efd[1]);
|
||||
channel_unref(channel);
|
||||
ga_clear(&ga);
|
||||
}
|
||||
|
||||
char *
|
||||
@@ -5248,7 +5376,7 @@ theend:
|
||||
* Return FAIL if it didn't work.
|
||||
*/
|
||||
int
|
||||
mch_stop_job(job_T *job, char_u *how)
|
||||
mch_signal_job(job_T *job, char_u *how)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -6184,6 +6312,7 @@ mch_breakcheck(int force)
|
||||
#ifndef FEAT_GUI_W32 /* never used */
|
||||
if (g_fCtrlCPressed || g_fCBrkPressed)
|
||||
{
|
||||
ctrl_break_was_pressed = g_fCBrkPressed;
|
||||
g_fCtrlCPressed = g_fCBrkPressed = FALSE;
|
||||
got_int = TRUE;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user