mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-07 15:37:14 +02:00
Compare commits
71 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ae238e048d | |||
| 89b629700f | |||
| 037c17b77b | |||
| 7089f4219e | |||
| b1ba9abcb3 | |||
| 2559a47823 | |||
| 4a4981b7cd | |||
| 2e693a88b2 | |||
| 4f2f61a014 | |||
| 7b3d939667 | |||
| b2fe1d676f | |||
| 4e03933726 | |||
| 4bd88d568a | |||
| a6cc5beb17 | |||
| fafb4b18cd | |||
| 17efc7fa05 | |||
| 8f7b29f033 | |||
| 9115c611db | |||
| a3817730c0 | |||
| 1142a31b8c | |||
| 3439028c89 | |||
| 27fc8cab22 | |||
| 3c8cd4a1dc | |||
| 03b00476ee | |||
| e3a22cb1ba | |||
| 6aa7523b96 | |||
| 53efb18530 | |||
| 1e7b52ad8a | |||
| 459fd785e4 | |||
| 171a921b51 | |||
| 4facea310c | |||
| d1e2f3984a | |||
| e8070987c6 | |||
| ceba3dd518 | |||
| 18a79a6841 | |||
| 4cdbed33e4 | |||
| 1a4cbb19de | |||
| ec66c41d84 | |||
| 00eab7f128 | |||
| 6a0299d8f4 | |||
| 07282f01da | |||
| a129974bc7 | |||
| c25e702dee | |||
| 073e779640 | |||
| 1ac41a5c13 | |||
| 9326805442 | |||
| 14c01f8348 | |||
| 6bd1d77067 | |||
| b189295b72 | |||
| 345f28df54 | |||
| c3e555b22f | |||
| fbbd102be0 | |||
| a27e1dcddc | |||
| 1614a14901 | |||
| 524f3b19ae | |||
| eb66328bd7 | |||
| 49474ca122 | |||
| 1671de3098 | |||
| 2efc44b3f0 | |||
| fd00c042af | |||
| 9ca250855b | |||
| 4c063dde73 | |||
| 2a8d3b8997 | |||
| e8a7dfedfc | |||
| 1824f45883 | |||
| 23324a0b35 | |||
| 8617348e21 | |||
| b4367b7fb6 | |||
| 2886dcceba | |||
| 792cf5e1be | |||
| 18223a592e |
@@ -25,6 +25,7 @@ SRC_ALL = \
|
||||
src/change.c \
|
||||
src/channel.c \
|
||||
src/charset.c \
|
||||
src/cindent.c \
|
||||
src/cmdexpand.c \
|
||||
src/cmdhist.c \
|
||||
src/crypt.c \
|
||||
@@ -191,6 +192,7 @@ SRC_ALL = \
|
||||
src/proto/change.pro \
|
||||
src/proto/channel.pro \
|
||||
src/proto/charset.pro \
|
||||
src/proto/cindent.pro \
|
||||
src/proto/cmdexpand.pro \
|
||||
src/proto/cmdhist.pro \
|
||||
src/proto/crypt.pro \
|
||||
@@ -294,11 +296,11 @@ SRC_ALL = \
|
||||
src/libvterm/src/encoding/uk.inc \
|
||||
src/libvterm/src/encoding/uk.tbl \
|
||||
src/libvterm/src/keyboard.c \
|
||||
src/libvterm/src/termmouse.c \
|
||||
src/libvterm/src/mouse.c \
|
||||
src/libvterm/src/parser.c \
|
||||
src/libvterm/src/pen.c \
|
||||
src/libvterm/src/rect.h \
|
||||
src/libvterm/src/termscreen.c \
|
||||
src/libvterm/src/screen.c \
|
||||
src/libvterm/src/state.c \
|
||||
src/libvterm/src/unicode.c \
|
||||
src/libvterm/src/utf8.h \
|
||||
|
||||
+18
-18
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# Locale ID : 2052
|
||||
# fileencoding : UTF-8
|
||||
# Author : Guopeng Wen
|
||||
# Author : Guopeng Wen, David Liu
|
||||
|
||||
!insertmacro MUI_LANGUAGE "SimpChinese"
|
||||
|
||||
@@ -112,7 +112,7 @@ LangString str_desc_plugin ${LANG_SIMPCHINESE} \
|
||||
LangString str_section_plugin_home ${LANG_SIMPCHINESE} \
|
||||
"私有插件目录"
|
||||
LangString str_desc_plugin_home ${LANG_SIMPCHINESE} \
|
||||
"Create plugin directories in HOME directory."
|
||||
"在主目录创建私有插件目录。"
|
||||
|
||||
LangString str_section_plugin_vim ${LANG_SIMPCHINESE} \
|
||||
"公共插件目录"
|
||||
@@ -141,14 +141,14 @@ LangString str_desc_rm_exe ${LANG_SIMPCHINESE} \
|
||||
"删除 Vim 的所有执行文件及脚本。"
|
||||
|
||||
LangString str_ungroup_plugin ${LANG_SIMPCHINESE} \
|
||||
"Remove plugin directories"
|
||||
"移除插件目录"
|
||||
LangString str_desc_rm_plugin ${LANG_SIMPCHINESE} \
|
||||
"Remove the plugin directories if they are empty."
|
||||
"移除插件目录(如果目录为空)。"
|
||||
|
||||
LangString str_unsection_plugin_home ${LANG_SIMPCHINESE} \
|
||||
"私有插件目录"
|
||||
LangString str_desc_rm_plugin_home ${LANG_SIMPCHINESE} \
|
||||
"Remove the plugin directories from HOME directory."
|
||||
"从主目录中移除私有插件目录。"
|
||||
|
||||
LangString str_unsection_plugin_vim ${LANG_SIMPCHINESE} \
|
||||
"公共插件目录"
|
||||
@@ -241,37 +241,37 @@ LangString str_msg_unregistering ${LANG_SIMPCHINESE} \
|
||||
LangString str_vimrc_page_title ${LANG_SIMPCHINESE} \
|
||||
"设置 _vimrc"
|
||||
LangString str_vimrc_page_subtitle ${LANG_SIMPCHINESE} \
|
||||
"选择键盘、鼠标和增强选项。"
|
||||
"选择键盘、鼠标和扩展设置。"
|
||||
|
||||
LangString str_msg_compat_title ${LANG_SIMPCHINESE} \
|
||||
"Vi / Vim 行为"
|
||||
LangString str_msg_compat_desc ${LANG_SIMPCHINESE} \
|
||||
"&Compatibility and enhancements"
|
||||
"兼容性与扩展(&B)"
|
||||
LangString str_msg_compat_vi ${LANG_SIMPCHINESE} \
|
||||
"Vi compatible"
|
||||
"原始 Vi"
|
||||
LangString str_msg_compat_vim ${LANG_SIMPCHINESE} \
|
||||
"Vim original"
|
||||
"原始 Vim"
|
||||
LangString str_msg_compat_defaults ${LANG_SIMPCHINESE} \
|
||||
"Vim with some enhancements (load defaults.vim)"
|
||||
"Vim 原始版本和部分扩展 (加载 defaults.vim)"
|
||||
LangString str_msg_compat_all ${LANG_SIMPCHINESE} \
|
||||
"Vim with all enhancements (load vimrc_example.vim) (Default)"
|
||||
"Vim 原始版本和所有扩展 (加载 vimrc_example.vim) (缺省)"
|
||||
|
||||
LangString str_msg_keymap_title ${LANG_SIMPCHINESE} \
|
||||
"键盘映射"
|
||||
LangString str_msg_keymap_desc ${LANG_SIMPCHINESE} \
|
||||
"&Remap a few keys for Windows (Ctrl-V, Ctrl-C, Ctrl-A, Ctrl-S, Ctrl-F, etc)"
|
||||
"为 Windows 映射按键(&R) (例如:Ctrl-V, Ctrl-C, Ctrl-A, Ctrl-S, Ctrl-F 等)"
|
||||
LangString str_msg_keymap_default ${LANG_SIMPCHINESE} \
|
||||
"Do not remap keys (Default)"
|
||||
"不映射按键 (缺省)"
|
||||
LangString str_msg_keymap_windows ${LANG_SIMPCHINESE} \
|
||||
"Remap a few keys"
|
||||
"映射一些按键"
|
||||
|
||||
LangString str_msg_mouse_title ${LANG_SIMPCHINESE} \
|
||||
"鼠标"
|
||||
LangString str_msg_mouse_desc ${LANG_SIMPCHINESE} \
|
||||
"&Behavior of right and left buttons"
|
||||
"左键和右键行为(&B)"
|
||||
LangString str_msg_mouse_default ${LANG_SIMPCHINESE} \
|
||||
"Right: popup menu, Left: visual mode (Default)"
|
||||
"右键:弹出菜单, 左键:可视化模式 (缺省)"
|
||||
LangString str_msg_mouse_windows ${LANG_SIMPCHINESE} \
|
||||
"Right: popup menu, Left: select mode (Windows)"
|
||||
"右键:弹出菜单, 左键:选择模式 (Windows)"
|
||||
LangString str_msg_mouse_unix ${LANG_SIMPCHINESE} \
|
||||
"Right: extends selection, Left: visual mode (Unix)"
|
||||
"右键: 扩展选择, 左键:可视化模式 (Unix)"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" The default vimrc file.
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last change: 2019 Feb 18
|
||||
" Last change: 2019 Sep 28
|
||||
"
|
||||
" This is loaded if no vimrc file was found.
|
||||
" Except when Vim is run with "-u NONE" or "-C".
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*change.txt* For Vim version 8.1. Last change: 2019 Sep 27
|
||||
*change.txt* For Vim version 8.1. Last change: 2019 Sep 28
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
|
||||
+87
-52
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 8.1. Last change: 2019 Sep 27
|
||||
*eval.txt* For Vim version 8.1. Last change: 2019 Oct 13
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -2892,7 +2892,7 @@ win_id2tabwin({expr}) List get tab and window nr from window ID
|
||||
win_id2win({expr}) Number get window nr from window ID
|
||||
win_screenpos({nr}) List get screen position of window {nr}
|
||||
win_splitmove({nr}, {target} [, {options}])
|
||||
none move window {nr} to split of {target}
|
||||
Number move window {nr} to split of {target}
|
||||
winbufnr({nr}) Number buffer number of window {nr}
|
||||
wincol() Number window column of the cursor
|
||||
winheight({nr}) Number height of window {nr}
|
||||
@@ -2986,6 +2986,9 @@ append({lnum}, {text}) *append()*
|
||||
appendbufline({expr}, {lnum}, {text}) *appendbufline()*
|
||||
Like |append()| but append the text in buffer {expr}.
|
||||
|
||||
This function works only for loaded buffers. First call
|
||||
|bufload()| if needed.
|
||||
|
||||
For the use of {expr}, see |bufname()|.
|
||||
|
||||
{lnum} is used like with |append()|. Note that using |line()|
|
||||
@@ -3552,8 +3555,8 @@ complete({startcol}, {matches}) *complete()* *E785*
|
||||
< This isn't very useful, but it shows how it works. Note that
|
||||
an empty string is returned to avoid a zero being inserted.
|
||||
|
||||
Can also be used as a |method|, the second argument is passed
|
||||
in: >
|
||||
Can also be used as a |method|, the base is passed as the
|
||||
second argument: >
|
||||
GetMatches()->complete(col('.'))
|
||||
|
||||
complete_add({expr}) *complete_add()*
|
||||
@@ -3688,7 +3691,7 @@ confirm({msg} [, {choices} [, {default} [, {type}]]])
|
||||
|
||||
Can also be used as a |method|in: >
|
||||
BuildMessage()->confirm("&Yes\n&No")
|
||||
|
||||
<
|
||||
*copy()*
|
||||
copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't
|
||||
different from using {expr} directly.
|
||||
@@ -3883,6 +3886,9 @@ deletebufline({expr}, {first} [, {last}]) *deletebufline()*
|
||||
If {last} is omitted then delete line {first} only.
|
||||
On success 0 is returned, on failure 1 is returned.
|
||||
|
||||
This function works only for loaded buffers. First call
|
||||
|bufload()| if needed.
|
||||
|
||||
For the use of {expr}, see |bufname()| above.
|
||||
|
||||
{first} and {last} are used like with |getline()|. Note that
|
||||
@@ -3891,7 +3897,7 @@ deletebufline({expr}, {first} [, {last}]) *deletebufline()*
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetBuffer()->deletebufline(1)
|
||||
|
||||
<
|
||||
*did_filetype()*
|
||||
did_filetype() Returns |TRUE| when autocommands are being executed and the
|
||||
FileType event has been triggered at least once. Can be used
|
||||
@@ -4052,7 +4058,7 @@ exepath({expr}) *exepath()*
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetCommand()->exepath()
|
||||
|
||||
<
|
||||
*exists()*
|
||||
exists({expr}) The result is a Number, which is |TRUE| if {expr} is defined,
|
||||
zero otherwise.
|
||||
@@ -4578,7 +4584,7 @@ foldlevel({lnum}) *foldlevel()*
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetLnum()->foldlevel()
|
||||
|
||||
<
|
||||
*foldtext()*
|
||||
foldtext() Returns a String, to be displayed for a closed fold. This is
|
||||
the default function used for the 'foldtext' option and should
|
||||
@@ -5860,7 +5866,7 @@ histadd({history}, {item}) *histadd()*
|
||||
:let date=input("Enter date: ")
|
||||
< This function is not available in the |sandbox|.
|
||||
|
||||
Can also be used as a |method|, the base is used for the
|
||||
Can also be used as a |method|, the base is passed as the
|
||||
second argument: >
|
||||
GetHistory()->histadd('search')
|
||||
|
||||
@@ -6388,8 +6394,8 @@ libcall({libname}, {funcname}, {argument})
|
||||
Examples: >
|
||||
:echo libcall("libc.so", "getenv", "HOME")
|
||||
|
||||
< Can also be used as a |method|, where the base is passed as
|
||||
the argument to the called function: >
|
||||
< Can also be used as a |method|, the base is passed as the
|
||||
third argument: >
|
||||
GetValue()->libcall("libc.so", "getenv")
|
||||
<
|
||||
*libcallnr()*
|
||||
@@ -6403,8 +6409,8 @@ libcallnr({libname}, {funcname}, {argument})
|
||||
:call libcallnr("libc.so", "printf", "Hello World!\n")
|
||||
:call libcallnr("libc.so", "sleep", 10)
|
||||
<
|
||||
Can also be used as a |method|, where the base is passed as
|
||||
the argument to the called function: >
|
||||
Can also be used as a |method|, the base is passed as the
|
||||
third argument: >
|
||||
GetValue()->libcallnr("libc.so", "printf")
|
||||
<
|
||||
|
||||
@@ -6555,8 +6561,8 @@ listener_add({callback} [, {buf}]) *listener_add()*
|
||||
The {callback} is also not invoked when the buffer is
|
||||
unloaded, use the |BufUnload| autocmd event for that.
|
||||
|
||||
Can also be used as a |method|, where the base is passed as
|
||||
the second argument, the buffer: >
|
||||
Can also be used as a |method|, the base is passed as the
|
||||
second argument: >
|
||||
GetBuffer()->listener_add(callback)
|
||||
|
||||
listener_flush([{buf}]) *listener_flush()*
|
||||
@@ -7026,6 +7032,7 @@ matchstrpos({expr}, {pat} [, {start} [, {count}]]) *matchstrpos()*
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetText()->matchstrpos('word')
|
||||
<
|
||||
*max()*
|
||||
max({expr}) Return the maximum value of all items in {expr}.
|
||||
{expr} can be a list or a dictionary. For a dictionary,
|
||||
@@ -8282,20 +8289,31 @@ serverlist() *serverlist()*
|
||||
:echo serverlist()
|
||||
<
|
||||
setbufline({expr}, {lnum}, {text}) *setbufline()*
|
||||
Set line {lnum} to {text} in buffer {expr}. To insert
|
||||
lines use |append()|. Any text properties in {lnum} are
|
||||
cleared.
|
||||
Set line {lnum} to {text} in buffer {expr}. This works like
|
||||
|setline()| for the specified buffer.
|
||||
|
||||
This function works only for loaded buffers. First call
|
||||
|bufload()| if needed.
|
||||
|
||||
To insert lines use |appendbufline()|.
|
||||
Any text properties in {lnum} are cleared.
|
||||
|
||||
{text} can be a string to set one line, or a list of strings
|
||||
to set multiple lines. If the list extends below the last
|
||||
line then those lines are added.
|
||||
|
||||
For the use of {expr}, see |bufname()| above.
|
||||
|
||||
{lnum} is used like with |setline()|.
|
||||
This works like |setline()| for the specified buffer.
|
||||
When {lnum} is just below the last line the {text} will be
|
||||
added below the last line.
|
||||
|
||||
When {expr} is not a valid buffer, the buffer is not loaded or
|
||||
{lnum} is not valid then 1 is returned. On success 0 is
|
||||
returned.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
Can also be used as a |method|, the base is passed as the
|
||||
third argument: >
|
||||
GetText()->setbufline(buf, lnum)
|
||||
|
||||
setbufvar({expr}, {varname}, {val}) *setbufvar()*
|
||||
@@ -8311,7 +8329,8 @@ setbufvar({expr}, {varname}, {val}) *setbufvar()*
|
||||
:call setbufvar("todo", "myvar", "foobar")
|
||||
< This function is not available in the |sandbox|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
Can also be used as a |method|, the base is passed as the
|
||||
third argument: >
|
||||
GetValue()->setbufvar(buf, varname)
|
||||
|
||||
setcharsearch({dict}) *setcharsearch()*
|
||||
@@ -8360,7 +8379,8 @@ setenv({name}, {val}) *setenv()*
|
||||
When {val} is |v:null| the environment variable is deleted.
|
||||
See also |expr-env|.
|
||||
|
||||
Can also be used as a |method|, passing the value as the base: >
|
||||
Can also be used as a |method|, the base is passed as the
|
||||
second argument: >
|
||||
GetPath()->setenv('PATH')
|
||||
|
||||
setfperm({fname}, {mode}) *setfperm()* *chmod*
|
||||
@@ -8391,7 +8411,7 @@ setline({lnum}, {text}) *setline()*
|
||||
|
||||
{lnum} is used like with |getline()|.
|
||||
When {lnum} is just below the last line the {text} will be
|
||||
added as a new line.
|
||||
added below the last line.
|
||||
|
||||
If this succeeds, 0 is returned. If this fails (most likely
|
||||
because {lnum} is invalid) 1 is returned.
|
||||
@@ -8409,7 +8429,8 @@ setline({lnum}, {text}) *setline()*
|
||||
|
||||
< Note: The '[ and '] marks are not set.
|
||||
|
||||
Can also be used as a |method|, passing the text as the base: >
|
||||
Can also be used as a |method|, the base is passed as the
|
||||
second argument: >
|
||||
GetText()->setline(lnum)
|
||||
|
||||
setloclist({nr}, {list} [, {action} [, {what}]]) *setloclist()*
|
||||
@@ -8658,7 +8679,8 @@ settabvar({tabnr}, {varname}, {val}) *settabvar()*
|
||||
Tabs are numbered starting with one.
|
||||
This function is not available in the |sandbox|.
|
||||
|
||||
Can also be used as a |method|, the base is used as the value: >
|
||||
Can also be used as a |method|, the base is passed as the
|
||||
third argument: >
|
||||
GetValue()->settabvar(tab, name)
|
||||
|
||||
settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()*
|
||||
@@ -8679,7 +8701,8 @@ settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()*
|
||||
:call settabwinvar(3, 2, "myvar", "foobar")
|
||||
< This function is not available in the |sandbox|.
|
||||
|
||||
Can also be used as a |method|, the base is used as the value: >
|
||||
Can also be used as a |method|, the base is passed as the
|
||||
fourth argument: >
|
||||
GetValue()->settabvar(tab, winnr, name)
|
||||
|
||||
settagstack({nr}, {dict} [, {action}]) *settagstack()*
|
||||
@@ -8713,7 +8736,8 @@ settagstack({nr}, {dict} [, {action}]) *settagstack()*
|
||||
call settagstack(1003, stack)
|
||||
unlet stack
|
||||
<
|
||||
Can also be used as a |method|, the base is used as the Dict: >
|
||||
Can also be used as a |method|, the base is passed as the
|
||||
second argument: >
|
||||
GetStack()->settagstack(winnr)
|
||||
|
||||
setwinvar({winnr}, {varname}, {val}) *setwinvar()*
|
||||
@@ -8722,7 +8746,8 @@ setwinvar({winnr}, {varname}, {val}) *setwinvar()*
|
||||
:call setwinvar(1, "&list", 0)
|
||||
:call setwinvar(2, "myvar", "foobar")
|
||||
|
||||
< Can also be used as a |method|, the base is used as the value: >
|
||||
< Can also be used as a |method|, the base is passed as the
|
||||
third argument: >
|
||||
GetValue()->setwinvar(winnr, name)
|
||||
|
||||
sha256({string}) *sha256()*
|
||||
@@ -9090,8 +9115,8 @@ state([{what}]) *state()*
|
||||
e.g. after |f|
|
||||
a Insert mode autocomplete active
|
||||
x executing an autocommand
|
||||
w blocked on waiting, e.g. ch_evalexpr() and
|
||||
ch_read(), ch_readraw() when reading json.
|
||||
w blocked on waiting, e.g. ch_evalexpr(), ch_read() and
|
||||
ch_readraw() when reading json.
|
||||
S not triggering SafeState or SafeStateAgain
|
||||
c callback invoked, including timer (repeats for
|
||||
recursiveness up to "ccc")
|
||||
@@ -9142,7 +9167,7 @@ str2nr({expr} [, {base} [, {quoted}]]) *str2nr()*
|
||||
When {base} is omitted base 10 is used. This also means that
|
||||
a leading zero doesn't cause octal conversion to be used, as
|
||||
with the default String to Number conversion. Example: >
|
||||
let nr = str2nr('123')
|
||||
let nr = str2nr('0123')
|
||||
<
|
||||
When {base} is 16 a leading "0x" or "0X" is ignored. With a
|
||||
different base the result will be zero. Similarly, when
|
||||
@@ -9259,6 +9284,7 @@ stridx({haystack}, {needle} [, {start}]) *stridx()*
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetHaystack()->stridx(needle)
|
||||
<
|
||||
*string()*
|
||||
string({expr}) Return {expr} converted to a String. If {expr} is a Number,
|
||||
Float, String, Blob or a composition of them, then the result
|
||||
@@ -10154,8 +10180,8 @@ win_execute({id}, {command} [, {silent}]) *win_execute()*
|
||||
Not all commands are allowed in popup windows.
|
||||
When window {id} does not exist then no error is given.
|
||||
|
||||
Can also be used as a |method|, the base is used for the
|
||||
command: >
|
||||
Can also be used as a |method|, the base is passed as the
|
||||
second argument: >
|
||||
GetCommand()->win_execute(winid)
|
||||
|
||||
win_findbuf({bufnr}) *win_findbuf()*
|
||||
@@ -10473,11 +10499,11 @@ xor({expr}, {expr}) *xor()*
|
||||
to a number. A List, Dict or Float argument causes an error.
|
||||
Example: >
|
||||
:let bits = xor(bits, 0x80)
|
||||
< Can also be used as a |method|: >
|
||||
<
|
||||
Can also be used as a |method|: >
|
||||
:let bits = bits->xor(0x80)
|
||||
<
|
||||
|
||||
|
||||
*feature-list*
|
||||
There are four types of features:
|
||||
1. Features that are only supported when they have been enabled when Vim
|
||||
@@ -11355,21 +11381,22 @@ This does NOT work: >
|
||||
|
||||
*:let=<<* *:let-heredoc*
|
||||
*E990* *E991* *E172* *E221*
|
||||
:let {var-name} =<< [trim] {marker}
|
||||
:let {var-name} =<< [trim] {endmarker}
|
||||
text...
|
||||
text...
|
||||
{marker}
|
||||
{endmarker}
|
||||
Set internal variable {var-name} to a List containing
|
||||
the lines of text bounded by the string {marker}.
|
||||
{marker} must not contain white space.
|
||||
{marker} cannot start with a lower case character.
|
||||
The last line should end only with the {marker} string
|
||||
without any other character. Watch out for white
|
||||
space after {marker}!
|
||||
the lines of text bounded by the string {endmarker}.
|
||||
{endmarker} must not contain white space.
|
||||
{endmarker} cannot start with a lower case character.
|
||||
The last line should end only with the {endmarker}
|
||||
string without any other character. Watch out for
|
||||
white space after {endmarker}!
|
||||
|
||||
Without "trim" any white space characters in the lines
|
||||
of text are preserved. If "trim" is specified before
|
||||
{marker}, then indentation is stripped so you can do: >
|
||||
{endmarker}, then indentation is stripped so you can
|
||||
do: >
|
||||
let text =<< trim END
|
||||
if ok
|
||||
echo 'done'
|
||||
@@ -11383,23 +11410,31 @@ text...
|
||||
non-empty text line is stripped from the input lines.
|
||||
All leading indentation exactly matching the leading
|
||||
indentation before `let` is stripped from the line
|
||||
containing {marker}. Note that the difference between
|
||||
space and tab matters here.
|
||||
containing {endmarker}. Note that the difference
|
||||
between space and tab matters here.
|
||||
|
||||
If {var-name} didn't exist yet, it is created.
|
||||
Cannot be followed by another command, but can be
|
||||
followed by a comment.
|
||||
|
||||
To avoid line continuation to be applied, consider
|
||||
adding 'C' to 'cpoptions': >
|
||||
set cpo+=C
|
||||
let var =<< END
|
||||
\ leading backslash
|
||||
END
|
||||
set cpo-=C
|
||||
<
|
||||
Examples: >
|
||||
let var1 =<< END
|
||||
Sample text 1
|
||||
Sample text 2
|
||||
Sample text 3
|
||||
END
|
||||
Sample text 1
|
||||
Sample text 2
|
||||
Sample text 3
|
||||
END
|
||||
|
||||
let data =<< trim DATA
|
||||
1 2 3 4
|
||||
5 6 7 8
|
||||
1 2 3 4
|
||||
5 6 7 8
|
||||
DATA
|
||||
<
|
||||
*E121*
|
||||
|
||||
@@ -55,14 +55,14 @@ The ActiveState one should work, Strawberry Perl is a good alternative.
|
||||
working: >
|
||||
:perl VIM::Msg("Hello")
|
||||
|
||||
:pe[rl] << [endpattern]
|
||||
:pe[rl] << [endmarker]
|
||||
{script}
|
||||
{endpattern}
|
||||
{endmarker}
|
||||
Execute Perl script {script}.
|
||||
The {endpattern} after {script} must NOT be preceded
|
||||
by any white space.
|
||||
The {endmarker} after {script} must NOT be preceded by
|
||||
any white space.
|
||||
|
||||
If [endpattern] is omitted, it defaults to a dot '.'
|
||||
If [endmarker] is omitted, it defaults to a dot '.'
|
||||
like for the |:append| and |:insert| commands. Using
|
||||
'.' helps when inside a function, because "$i;" looks
|
||||
like the start of an |:insert| command to Vim.
|
||||
|
||||
@@ -28,14 +28,14 @@ downloading Ruby there.
|
||||
:rub[y] {cmd} Execute Ruby command {cmd}. A command to try it out: >
|
||||
:ruby print "Hello"
|
||||
|
||||
:rub[y] << [endpattern]
|
||||
:rub[y] << [endmarker]
|
||||
{script}
|
||||
{endpattern}
|
||||
{endmarker}
|
||||
Execute Ruby script {script}.
|
||||
The {endpattern} after {script} must NOT be preceded
|
||||
by any white space.
|
||||
The {endmarker} after {script} must NOT be preceded by
|
||||
any white space.
|
||||
|
||||
If [endpattern] is omitted, it defaults to a dot '.'
|
||||
If [endmarker] is omitted, it defaults to a dot '.'
|
||||
like for the |:append| and |:insert| commands.
|
||||
|
||||
This form of the |:ruby| command is mainly useful for
|
||||
|
||||
@@ -949,10 +949,12 @@ Function call arguments will indent 1 extra level. For two-space indentation: >
|
||||
-------------
|
||||
|
||||
*PHP_IndentFunctionDeclarationParameters*
|
||||
Extra indentation levels to add to arguments in multi-line function definitions. >
|
||||
Extra indentation levels to add to arguments in multi-line function
|
||||
definitions. >
|
||||
let g:PHP_IndentFunctionDeclarationParameters = 1
|
||||
|
||||
Function arguments in declarations will indent 1 extra level. For two-space indentation: >
|
||||
Function arguments in declarations will indent 1 extra level. For two-space
|
||||
indentation: >
|
||||
|
||||
function call_the_thing(
|
||||
$with_this,
|
||||
|
||||
@@ -480,7 +480,7 @@ try to solve the memory shortage. To stay on the safe side, exit Vim and
|
||||
start again.
|
||||
|
||||
If this happens while Vim is still initializing, editing files is very
|
||||
unlikely to work, therefore Vim will exit with value 123.
|
||||
unlikely to work, therefore Vim will exit with value 123.
|
||||
|
||||
Buffers are only partly kept in memory, thus editing a very large file is
|
||||
unlikely to cause an out-of-memory situation. Undo information is completely
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*options.txt* For Vim version 8.1. Last change: 2019 Sep 26
|
||||
*options.txt* For Vim version 8.1. Last change: 2019 Sep 28
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -861,7 +861,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
:set background&
|
||||
< Vim will guess the value. In the GUI this should work correctly,
|
||||
in other cases Vim might not be able to guess the right value.
|
||||
If the GUI supports a dark them, you can use the "d" flag in
|
||||
If the GUI supports a dark theme, you can use the "d" flag in
|
||||
'guioptions', see 'go-d'.
|
||||
|
||||
When the |t_RB| option is set, Vim will use it to request the background
|
||||
@@ -1900,7 +1900,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
*'completeslash'* *'csl'*
|
||||
'completeslash' 'csl' string (default: "")
|
||||
local to buffer
|
||||
{not in Vi} {only for MS-Windows}
|
||||
{only for MS-Windows}
|
||||
When this option is set it overrules 'shellslash' for completion:
|
||||
- When this option is set to "slash", a forward slash is used for path
|
||||
completion in insert mode. This is useful when editing HTML tag, or
|
||||
@@ -1940,7 +1940,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
completion in a popup window. Only works in combination
|
||||
with "menu" or "menuone". Overrides "preview".
|
||||
See |'completepopup'| for specifying properties.
|
||||
{only works when compiled with the +textprop feature}
|
||||
{only works when compiled with the |+textprop| feature}
|
||||
|
||||
noinsert Do not insert any text for a match until the user selects
|
||||
a match from the menu. Only works in combination with
|
||||
@@ -2493,7 +2493,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
*'cursorlineopt'* *'culopt'*
|
||||
'cursorlineopt' 'culopt' string (default: "number,line")
|
||||
local to window
|
||||
{not in Vi}
|
||||
{not available when compiled without the |+syntax|
|
||||
feature}
|
||||
Comma separated list of settings for how 'cursorline' is displayed.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*pi_netrw.txt* For Vim version 8.1. Last change: 2019 Jul 17
|
||||
*pi_netrw.txt* For Vim version 8.1. Last change: 2019 Oct 10
|
||||
|
||||
------------------------------------------------
|
||||
NETRW REFERENCE MANUAL by Charles E. Campbell
|
||||
@@ -3512,7 +3512,7 @@ Example: Clear netrw's marked file list via a mapping on gu >
|
||||
- Click "Add..."
|
||||
- Set External Editor (adjust path as needed, include
|
||||
the quotes and !.! at the end):
|
||||
"c:\Program Files\Vim\vim70\gvim.exe" !.!
|
||||
"c:\Program Files\Vim\vim81\gvim.exe" !.!
|
||||
- Check that the filetype in the box below is
|
||||
{asterisk}.{asterisk} (all files), or whatever types
|
||||
you want (cec: change {asterisk} to * ; I had to
|
||||
@@ -3762,8 +3762,8 @@ by obtaining a copy of the latest (often developmental) netrw at:
|
||||
|
||||
The <netrw.vim> script is typically installed on systems as something like:
|
||||
>
|
||||
/usr/local/share/vim/vim7x/plugin/netrwPlugin.vim
|
||||
/usr/local/share/vim/vim7x/autoload/netrw.vim
|
||||
/usr/local/share/vim/vim8x/plugin/netrwPlugin.vim
|
||||
/usr/local/share/vim/vim8x/autoload/netrw.vim
|
||||
(see output of :echo &rtp)
|
||||
<
|
||||
which is loaded automatically at startup (assuming :set nocp). If you
|
||||
|
||||
@@ -361,7 +361,7 @@ popup_getpos({id}) *popup_getpos()*
|
||||
core_width width of the text box in screen cells
|
||||
core_height height of the text box in screen cells
|
||||
firstline line of the buffer at top (1 unless scrolled)
|
||||
(not the value of the "firstline" property)
|
||||
(not the value of the "firstline" property)
|
||||
scrollbar non-zero if a scrollbar is displayed
|
||||
visible one if the popup is displayed, zero if hidden
|
||||
Note that these are the actual screen positions. They differ
|
||||
@@ -744,22 +744,22 @@ is inserted or deleted. The popup functions like a tooltip.
|
||||
These steps are needed to make this work:
|
||||
|
||||
- Define a text property type, it defines the name. >
|
||||
call prop_type_add('popupMarker', {})
|
||||
call prop_type_add('popupMarker', {})
|
||||
|
||||
- Place a text property at the desired text: >
|
||||
let lnum = {line of the text}
|
||||
let col = {start column of the text}
|
||||
let len = {length of the text}
|
||||
let propId = {arbitrary but unique number}
|
||||
call prop_add(lnum, col, #{
|
||||
call prop_add(lnum, col, #{
|
||||
\ length: len,
|
||||
\ type: 'popupMarker',
|
||||
\ id: propId,
|
||||
\ })
|
||||
|
||||
- Create a popup: >
|
||||
let winid = popup_create('the text', #{
|
||||
\ pos: 'botleft',
|
||||
let winid = popup_create('the text', #{
|
||||
\ pos: 'botleft',
|
||||
\ textprop: 'popupMarker',
|
||||
\ textpropid: propId,
|
||||
\ border: [],
|
||||
@@ -799,7 +799,7 @@ Some hints:
|
||||
a click, as in the example above, helps for that.
|
||||
- If the text property is removed the popup is closed. Use something like
|
||||
this: >
|
||||
call prop_remove(#{type: 'popupMarker', id: propId})
|
||||
call prop_remove(#{type: 'popupMarker', id: propId})
|
||||
|
||||
|
||||
POPUP FILTER *popup-filter*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*syntax.txt* For Vim version 8.1. Last change: 2019 Sep 19
|
||||
*syntax.txt* For Vim version 8.1. Last change: 2019 Oct 04
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -60,8 +60,8 @@ If the VIM environment variable is not set, Vim will try to find
|
||||
the path in another way (see |$VIMRUNTIME|). Usually this works just
|
||||
fine. If it doesn't, try setting the VIM environment variable to the
|
||||
directory where the Vim stuff is located. For example, if your syntax files
|
||||
are in the "/usr/vim/vim50/syntax" directory, set $VIMRUNTIME to
|
||||
"/usr/vim/vim50". You must do this in the shell, before starting Vim.
|
||||
are in the "/usr/vim/vim81/syntax" directory, set $VIMRUNTIME to
|
||||
"/usr/vim/vim81". You must do this in the shell, before starting Vim.
|
||||
This command also sources the |menu.vim| script when the GUI is running or
|
||||
will start soon. See |'go-M'| about avoiding that.
|
||||
|
||||
|
||||
+5
-1
@@ -1034,6 +1034,8 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
't_Sb' term.txt /*'t_Sb'*
|
||||
't_Sf' term.txt /*'t_Sf'*
|
||||
't_Si' term.txt /*'t_Si'*
|
||||
't_TE' term.txt /*'t_TE'*
|
||||
't_TI' term.txt /*'t_TI'*
|
||||
't_Te' term.txt /*'t_Te'*
|
||||
't_Ts' term.txt /*'t_Ts'*
|
||||
't_VS' term.txt /*'t_VS'*
|
||||
@@ -7661,6 +7663,7 @@ mac-vimfile os_mac.txt /*mac-vimfile*
|
||||
macintosh os_mac.txt /*macintosh*
|
||||
macro map.txt /*macro*
|
||||
macvim gui_mac.txt /*macvim*
|
||||
macvim-autocommands gui_mac.txt /*macvim-autocommands*
|
||||
macvim-backspace gui_mac.txt /*macvim-backspace*
|
||||
macvim-clientserver remote.txt /*macvim-clientserver*
|
||||
macvim-colors gui_mac.txt /*macvim-colors*
|
||||
@@ -8210,7 +8213,6 @@ new-vimgrep version7.txt /*new-vimgrep*
|
||||
new-virtedit version6.txt /*new-virtedit*
|
||||
news intro.txt /*news*
|
||||
nextnonblank() eval.txt /*nextnonblank()*
|
||||
nice todo.txt /*nice*
|
||||
no-eval-feature eval.txt /*no-eval-feature*
|
||||
no-type-checking eval.txt /*no-type-checking*
|
||||
no_buffers_menu gui.txt /*no_buffers_menu*
|
||||
@@ -9229,6 +9231,8 @@ t_ST term.txt /*t_ST*
|
||||
t_Sb term.txt /*t_Sb*
|
||||
t_Sf term.txt /*t_Sf*
|
||||
t_Si term.txt /*t_Si*
|
||||
t_TE term.txt /*t_TE*
|
||||
t_TI term.txt /*t_TI*
|
||||
t_Te term.txt /*t_Te*
|
||||
t_Ts term.txt /*t_Ts*
|
||||
t_VS term.txt /*t_VS*
|
||||
|
||||
+18
-11
@@ -1,4 +1,4 @@
|
||||
*term.txt* For Vim version 8.1. Last change: 2019 May 07
|
||||
*term.txt* For Vim version 8.1. Last change: 2019 Oct 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -80,14 +80,19 @@ can do this best in your .vimrc. Example: >
|
||||
<
|
||||
*raw-terminal-mode*
|
||||
For normal editing the terminal will be put into "raw" mode. The strings
|
||||
defined with 't_ti' and 't_ks' will be sent to the terminal. Normally this
|
||||
puts the terminal in a state where the termcap codes are valid and activates
|
||||
the cursor and function keys. When Vim exits the terminal will be put back
|
||||
into the mode it was before Vim started. The strings defined with 't_te' and
|
||||
't_ke' will be sent to the terminal. On the Amiga, with commands that execute
|
||||
an external command (e.g., "!!"), the terminal will be put into Normal mode
|
||||
for a moment. This means that you can stop the output to the screen by
|
||||
hitting a printing key. Output resumes when you hit <BS>.
|
||||
defined with 't_ti', 't_TI' and 't_ks' will be sent to the terminal. Normally
|
||||
this puts the terminal in a state where the termcap codes are valid and
|
||||
activates the cursor and function keys.
|
||||
When Vim exits the terminal will be put back into the mode it was before Vim
|
||||
started. The strings defined with 't_te', 't_TE' and 't_ke' will be sent to
|
||||
the terminal. On the Amiga, with commands that execute an external command
|
||||
(e.g., "!!"), the terminal will be put into Normal mode for a moment. This
|
||||
means that you can stop the output to the screen by hitting a printing key.
|
||||
Output resumes when you hit <BS>.
|
||||
|
||||
Note: When 't_ti' is not empty, Vim assumes that it causes switching to the
|
||||
alternate screen. This may slightly change what happens when executing a
|
||||
shell command or exiting Vim. To avoid this use 't_TI' and 't_TE'.
|
||||
|
||||
*xterm-bracketed-paste*
|
||||
When the 't_BE' option is set then 't_BE' will be sent to the
|
||||
@@ -297,8 +302,8 @@ OUTPUT CODES *terminal-output-codes*
|
||||
t_se standout end *t_se* *'t_se'*
|
||||
t_so standout mode *t_so* *'t_so'*
|
||||
t_sr scroll reverse (backward) *t_sr* *'t_sr'*
|
||||
t_te out of "termcap" mode *t_te* *'t_te'*
|
||||
t_ti put terminal in "termcap" mode *t_ti* *'t_ti'*
|
||||
t_te end of "termcap" mode *t_te* *'t_te'*
|
||||
t_ti put terminal into "termcap" mode *t_ti* *'t_ti'*
|
||||
t_ts set window title start (to status line) *t_ts* *'t_ts'*
|
||||
t_ue underline end *t_ue* *'t_ue'*
|
||||
t_us underline mode *t_us* *'t_us'*
|
||||
@@ -359,6 +364,8 @@ Added by Vim (there are no standard codes for these):
|
||||
t_RT restore window title from stack *t_RT* *'t_RT'*
|
||||
t_Si save icon text to stack *t_Si* *'t_Si'*
|
||||
t_Ri restore icon text from stack *t_Ri* *'t_Ri'*
|
||||
t_TE end of "raw" mode *t_TE* *'t_TE'*
|
||||
t_TI put terminal into "raw" mode *t_TI* *'t_TI'*
|
||||
|
||||
Some codes have a start, middle and end part. The start and end are defined
|
||||
by the termcap option, the middle part is text.
|
||||
|
||||
@@ -496,7 +496,7 @@ term_dumpload({filename} [, {options}])
|
||||
For {options} see |term_dumpdiff()|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetFilename()-> term_dumpload()
|
||||
GetFilename()->term_dumpload()
|
||||
<
|
||||
*term_dumpwrite()*
|
||||
term_dumpwrite({buf}, {filename} [, {options}])
|
||||
@@ -514,7 +514,7 @@ term_dumpwrite({buf}, {filename} [, {options}])
|
||||
|
||||
Can also be used as a |method|, the base is used for the file
|
||||
name: >
|
||||
GetFilename()-> term_dumpwrite(bufnr)
|
||||
GetFilename()->term_dumpwrite(bufnr)
|
||||
|
||||
term_getaltscreen({buf}) *term_getaltscreen()*
|
||||
Returns 1 if the terminal of {buf} is using the alternate
|
||||
@@ -863,8 +863,6 @@ term_start({cmd} [, {options}]) *term_start()*
|
||||
Can also be used as a |method|: >
|
||||
GetCommand()->term_start()
|
||||
|
||||
< {only available when compiled with the |+terminal| feature}
|
||||
|
||||
|
||||
term_wait({buf} [, {time}]) *term_wait()*
|
||||
Wait for pending updates of {buf} to be handled.
|
||||
@@ -1243,7 +1241,7 @@ gdb:
|
||||
|
||||
*:Break* set a breakpoint at the cursor position
|
||||
:Break {position}
|
||||
set a breakpoint at the specified position
|
||||
set a breakpoint at the specified position
|
||||
*:Clear* delete the breakpoint at the cursor position
|
||||
|
||||
*:Step* execute the gdb "step" command
|
||||
|
||||
+46
-50
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 8.1. Last change: 2019 Sep 27
|
||||
*todo.txt* For Vim version 8.1. Last change: 2019 Oct 16
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -47,7 +47,10 @@ Popup windows:
|
||||
- Use popup (or popup menu) for command line completion
|
||||
- Implement flip option
|
||||
- Why does 'nrformats' leak from the popup window buffer???
|
||||
Happens in Test_simple_popup() at the second screendump.
|
||||
Happens in Test_simple_popup() at:
|
||||
call VerifyScreenDump(buf, 'Test_popupwin_04a', {})
|
||||
Only when this line is in defaults.vim:
|
||||
set nrformats-=octal
|
||||
- For the "moved" property also include mouse movement?
|
||||
- Make redrawing more efficient and avoid flicker:
|
||||
- put popup menu also in popup_mask?
|
||||
@@ -76,7 +79,7 @@ Text properties: See comment at top of src/textprop.c.
|
||||
Then :%s?foo should take the first match above the cursor line.
|
||||
|
||||
Prompt buffer:
|
||||
- Add a command line history.
|
||||
- Add a command line history, using up/down keys. #5010
|
||||
- delay next prompt until plugin gives OK?
|
||||
- add prompt_addtext({buf}, {expr}) none add text to a prompt buffer
|
||||
|
||||
@@ -134,6 +137,21 @@ E279, E290, E292, E362, E366, E450, E451, E452,
|
||||
E453, E454, E460, E489, E491, E565, E578, E610, E611, E653,
|
||||
E654, E856, E857, E860, E861, E863, E889, E900
|
||||
|
||||
Try out enabling modifyOtherKeys in xterm:
|
||||
CSI > 4 ; 2 m
|
||||
Need to disable when going to cooked mode:
|
||||
CSI > 4 ; m
|
||||
Known problems:
|
||||
- CTRL-V key inserts Esc sequence
|
||||
|
||||
Patch to skip tests that don't work when run as root. (James McCoy, #5020)
|
||||
Or just bail out completely?
|
||||
|
||||
Patch to test right click. (Dominique Pelle, #5018)
|
||||
|
||||
Python output doesn't stop when got_int is set. #5053
|
||||
Check got_int in write_output() in if_py_both.h?
|
||||
|
||||
Running test_gui and test_gui_init with Motif sometimes kills the window
|
||||
manager. Problem with Motif? Now test_gui crashes in submenu_change().
|
||||
Athena is OK.
|
||||
@@ -141,8 +159,13 @@ Motif: Build on Ubuntu can't enter any text in dialog text fields.
|
||||
|
||||
Improve running tests on MS-Windows: #4922
|
||||
|
||||
Patch to properly break CJK lines: #3875
|
||||
Ready to include now?
|
||||
In a function these two lines are different:
|
||||
let [a, b, c] =<< trim END fails
|
||||
let [a,b,c] =<< trim END works
|
||||
issue #5051
|
||||
|
||||
Patch to properly break CJK lines: Anton Kochkov, #3875
|
||||
Should be ready to include now.
|
||||
|
||||
Remove check for cmd_silent when calling search_stat()? (Gary Johnson)
|
||||
|
||||
@@ -159,10 +182,13 @@ Patch to sort buffers on b_last_used time. (Andy Massimino, #4722)
|
||||
Patch to highlight the line number differently below the cursor line. (Shaun
|
||||
Brady, #624)
|
||||
|
||||
Patch to add more tests for cmd.exe: #4928
|
||||
|
||||
Patch to fix session file when using multiple tabs. (Jason Franklin, 2019 May
|
||||
20)
|
||||
Also put :argadd commands at the start for all buffers, so that their order
|
||||
remains equal? Then %argdel to clean it up. Do try this with 'hidden' set.
|
||||
Also #4994: window-local options not always restored, related to using :badd.
|
||||
|
||||
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
|
||||
@@ -176,12 +202,17 @@ Ready to include now?
|
||||
Adding "10" to 'spellsuggest' causes spell suggestions to become very slow.
|
||||
(#4087)
|
||||
|
||||
":helptags ALL" should skip directories where "tags" cannot be written.
|
||||
(Matěj Cepl, #5026)
|
||||
|
||||
":bnext" in a help buffer is supposed to go to the next help buffer, but it
|
||||
goes to any buffer, and then :bnext skips help buffers, since they are
|
||||
unlisted. (#4478)
|
||||
|
||||
Patch to fix using zero sc_sid. (#4877)
|
||||
|
||||
Enable 'termbidi' if $VTE_VERSION >= 5703 ?
|
||||
|
||||
Universal solution to detect if t_RS is working, using cursor position.
|
||||
Koichi Iwamoto, #2126
|
||||
|
||||
@@ -212,8 +243,6 @@ Patch to remove FORTIFY_SOURCE also from CPPFLAGS. (Benedikt Morbach, #2786)
|
||||
|
||||
Patch from Namsh to allow building with both XIM and hangulin. (2019 Aug 29)
|
||||
|
||||
Patch to fix redirect of shell on MS-Windows. (Yasuhiro Matsumoto, #2054)
|
||||
|
||||
When using :packadd files under "later" are not used, which is inconsistent
|
||||
with packages under "start". (xtal8, #1994)
|
||||
|
||||
@@ -243,6 +272,14 @@ Patch to configure BUILD_DATE for reproducible builds. (James McCoy, #513)
|
||||
|
||||
Patch to add MODIFIED_BY to MSVC build file. (Chen Lei, 2016 Nov 24, #1275)
|
||||
|
||||
xterm should be able to pass focus changes to Vim, so that Vim can check for
|
||||
buffers that changed. Perhaps in misc.c, function selectwindow().
|
||||
Xterm 224 supports it!
|
||||
Patch to make FocusGained and FocusLost work in modern terminals. (Hayaki
|
||||
Saito, 2013 Apr 24) Update 2016 Aug 12.
|
||||
Also see issue #609.
|
||||
We could add the enable/disable sequences to t_ti/t_te or t_ks/t_ke.
|
||||
|
||||
Check_external_diff() is used too often. (Daniel Hahler, #4800)
|
||||
|
||||
Incorrect formatting with autoindent. (Sebastian Gniazdowski, #4909)
|
||||
@@ -297,6 +334,8 @@ Williams, 2018 Oct 30)
|
||||
"exepath('bin/cmd')" does not work while ":!bin/cmd" does work.
|
||||
(Daniel Hahler, #4710) and executable('bin/cmd') returns 1
|
||||
|
||||
Error drawing the number column when 'cursorline' is set. (#3893)
|
||||
|
||||
Problem with :tlmenu: Detach item added with all modes? Issue #3563.
|
||||
|
||||
The quoting of the [command] argument of :terminal is not clearly documented.
|
||||
@@ -1604,14 +1643,6 @@ compatible with Vim spell files. The old files can no longer be downloaded.
|
||||
Spell checking: Add a feature to only consider two spaces after a dot to start
|
||||
a new sentence. Don't give the capitalization error when there is one space.
|
||||
|
||||
xterm should be able to pass focus changes to Vim, so that Vim can check for
|
||||
buffers that changed. Perhaps in misc.c, function selectwindow().
|
||||
Xterm 224 supports it!
|
||||
Patch to make FocusGained and FocusLost work in modern terminals. (Hayaki
|
||||
Saito, 2013 Apr 24) Update 2016 Aug 12.
|
||||
Also see issue #609.
|
||||
We could add the enable/disable sequences to t_ti/t_te or t_ks/t_ke.
|
||||
|
||||
Idea: For a window in the middle (has window above and below it), use
|
||||
right-mouse-drag on the status line to move a window up/down without changing
|
||||
its height? It's like dragging the status bar above it at the same time.
|
||||
@@ -2155,10 +2186,6 @@ Looks like only bash can do it. (Yakov Lerner)
|
||||
Cscope "cs add" stopped working somewhat before 7.2.438. (Gary Johnson, 2010
|
||||
Jun 29) Caused by 7.2.433?
|
||||
|
||||
I often see pasted text (from Firefox, to Vim in xterm) appear twice.
|
||||
Also, Vim in xterm sometimes loses copy/paste ability (probably after running
|
||||
an external command).
|
||||
|
||||
Jumplist doesn't work properly in Insert mode? (Jean Johner, 2010 Mar 20)
|
||||
|
||||
Problem with transparent cmdline. Also: Terminal title is wrong with
|
||||
@@ -2754,10 +2781,6 @@ If the variable "g:x#y#z" exists completion after ":echo g:x#" doesn't work.
|
||||
Feature request: Command to go to previous tab, like what CTRL-W p does for
|
||||
windows. (Adam George)
|
||||
|
||||
F1 - F4 in an xterm produce a different escape sequence when used with a
|
||||
modifier key. Need to catch three different sequences. Use K_ZF1, like
|
||||
K_ZHOME? (Dickey, 2007 Dec 2)
|
||||
|
||||
In debug mode, using CTRL-R = to evaluate a function causes stepping through
|
||||
the function. (Hari Krishna Dara, 2006 Jun 28)
|
||||
|
||||
@@ -2892,12 +2915,6 @@ Setting 'background' resets the Normal background color:
|
||||
This is undesired, 'background' is supposed to tell Vim what the background
|
||||
color is, not reset it.
|
||||
|
||||
Linux distributions:
|
||||
- Suggest compiling xterm with --enable-tcap-query, so that nr of colors is
|
||||
known to Vim. 88 colors instead of 16 works better. See ":help
|
||||
xfree-xterm".
|
||||
- Suggest including bare "vi" and "vim" with X11, syntax, etc.
|
||||
|
||||
Completion menu: For a wrapping line, completing a long file name, only the
|
||||
start of the path is shown in the menu. Should move the menu to the right to
|
||||
show more text of the completions. Shorten the items that don't fit in the
|
||||
@@ -2912,12 +2929,6 @@ the buffer is displayed. (Antonios Tsakiridis)
|
||||
When ":cn" moves to an error in the same line the message isn't shortened.
|
||||
Only skip shortening for ":cc"?
|
||||
|
||||
Write "making vim work better" for the docs (mostly pointers): *nice*
|
||||
- sourcing $VIMRUNTIME/vimrc_example.vim
|
||||
- setting 'mouse' to "a"
|
||||
- getting colors in xterm
|
||||
- compiling Vim with X11, GUI, etc.
|
||||
|
||||
Problem with ":call" and dictionary function. Hari Krishna Dara, Charles
|
||||
Campbell 2006 Jul 06.
|
||||
|
||||
@@ -3011,11 +3022,6 @@ When 'encoding' is utf-8 typing text at the end of the line causes previously
|
||||
typed characters to be redrawn. Caused by patch 7.1.329. (Tyler Spivey, 2008
|
||||
Sep 3, 11)
|
||||
|
||||
When Vim in an xterm owns the selection and the user does ":shell" Vim doesn't
|
||||
respond to selection requests. Invoking XtDisownSelection() before executing
|
||||
the shell doesn't help. Would require forking and doing a message loop, like
|
||||
what happens for the GUI.
|
||||
|
||||
":vimgrep" does not recognize a recursive symlink. Is it possible to detect
|
||||
this, at least for Unix (using device/inode)?
|
||||
|
||||
@@ -3104,11 +3110,6 @@ Awaiting updated patches:
|
||||
use the patch that keeps using HLF_8 if HLF_WS has not
|
||||
been given values.
|
||||
Add section in help files for these highlight groups?
|
||||
8 "fg" and "bg" don't work in an xterm. Get default colors from xterm
|
||||
with an ESC sequence.
|
||||
xterm can send colors for many things. E.g. for the cursor:
|
||||
<Esc>]12;?<Bel>
|
||||
Can use this to get the background color and restore the colors on exit.
|
||||
7 Add "DefaultFG" and "DefaultBG" for the colors of the menu. (Marcin
|
||||
Dalecki has a patch for Motif and Carbon)
|
||||
- Add possibility to highlight specific columns (for Fortran). Or put a
|
||||
@@ -3702,7 +3703,6 @@ Macintosh:
|
||||
8 Xterm sends ^[[H for <Home> and ^[[F for <End> in some mode. Also
|
||||
recognize these keys? Mostly useful for xterm simulators, like gnometerm.
|
||||
See http://dickey.his.com/xterm/xterm.faq.html#xterm_pc_style.
|
||||
8 For xterm also recognize keypad up/down/left/right and insert.
|
||||
8 '[ and '] should be set to start/end of line when using a linewise operator
|
||||
(e.g., ":w").
|
||||
8 CTRL-A can't handle big "long" numbers, they become negative. Check for
|
||||
@@ -3717,10 +3717,6 @@ Macintosh:
|
||||
filesystem, an illegal file name may be created: ".vim".
|
||||
8 For each buffer that is opened, the viminfo file is opened and read to
|
||||
check for file marks. This can be slow.
|
||||
7 In xterm, recognize both vt100 and vt220 cursor keys. Change
|
||||
add_termcode() to not remove an existing entry for a name, when it's
|
||||
needed.
|
||||
Need a generic solution to recognize different codes for the same key.
|
||||
8 Core dump within signal function: gdb doesn't show stack backtrace! Option
|
||||
to skip catch_signals()?
|
||||
9 Repeating a "cw" with "." doesn't work if the text was pasted from the
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*vi_diff.txt* For Vim version 8.1. Last change: 2019 Sep 27
|
||||
*vi_diff.txt* For Vim version 8.1. Last change: 2019 Oct 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -64,6 +64,9 @@ w300 number (default 23) *'w300'*
|
||||
w1200 number (default 23) *'w1200'*
|
||||
w9600 number (default 23) *'w9600'*
|
||||
|
||||
Vi did not allow for changing the termcap entries, you would have to exit Vi,
|
||||
edit the termcap entry and try again. Vim has the |terminal-options|.
|
||||
|
||||
==============================================================================
|
||||
3. Limits *limits*
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim support file to detect file types
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2019 Sep 27
|
||||
" Last Change: 2019 Oct 04
|
||||
|
||||
" Listen very carefully, I will say this only once
|
||||
if exists("did_load_filetypes")
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# vim: set ft=yaml sw=2 et :
|
||||
|
||||
# START_INDENT
|
||||
map1:
|
||||
sub1:
|
||||
- list item
|
||||
map2:
|
||||
- another list
|
||||
# END_INDENT
|
||||
|
||||
# START_INDENT
|
||||
map: &anchor
|
||||
map: val
|
||||
# END_INDENT
|
||||
@@ -0,0 +1,14 @@
|
||||
# vim: set ft=yaml sw=2 et :
|
||||
|
||||
# START_INDENT
|
||||
map1:
|
||||
sub1:
|
||||
- list item
|
||||
map2:
|
||||
- another list
|
||||
# END_INDENT
|
||||
|
||||
# START_INDENT
|
||||
map: &anchor
|
||||
map: val
|
||||
# END_INDENT
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim indent file
|
||||
" Language: YAML
|
||||
" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
|
||||
" Last Change: 2017 Jun 13
|
||||
" Last Change: 2019 Sep 28
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists('b:did_indent')
|
||||
@@ -29,7 +29,7 @@ function s:FindPrevLessIndentedLine(lnum, ...)
|
||||
let curindent = a:0 ? a:1 : indent(a:lnum)
|
||||
while prevlnum
|
||||
\&& indent(prevlnum) >= curindent
|
||||
\&& getline(prevlnum) =~# '^\s*#'
|
||||
\&& getline(prevlnum) !~# '^\s*#'
|
||||
let prevlnum = prevnonblank(prevlnum-1)
|
||||
endwhile
|
||||
return prevlnum
|
||||
|
||||
+8
-3
@@ -65,8 +65,8 @@ command -nargs=* -complete=file -bang Termdebug call s:StartDebug(<bang>0, <f-ar
|
||||
command -nargs=+ -complete=file -bang TermdebugCommand call s:StartDebugCommand(<bang>0, <f-args>)
|
||||
|
||||
" Name of the gdb command, defaults to "gdb".
|
||||
if !exists('termdebugger')
|
||||
let termdebugger = 'gdb'
|
||||
if !exists('g:termdebugger')
|
||||
let g:termdebugger = 'gdb'
|
||||
endif
|
||||
|
||||
let s:pc_id = 12
|
||||
@@ -104,9 +104,14 @@ endfunc
|
||||
|
||||
func s:StartDebug_internal(dict)
|
||||
if exists('s:gdbwin')
|
||||
echoerr 'Terminal debugger already running'
|
||||
echoerr 'Terminal debugger already running, cannot run two'
|
||||
return
|
||||
endif
|
||||
if !executable(g:termdebugger)
|
||||
echoerr 'Cannot execute debugger program "' .. g:termdebugger .. '"'
|
||||
return
|
||||
endif
|
||||
|
||||
let s:ptywin = 0
|
||||
let s:pid = 0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim syntax file
|
||||
" Language: BIND configuration file
|
||||
" Maintainer: Nick Hibma <nick@van-laarhoven.org>
|
||||
" Last Change: 2007-01-30
|
||||
" Last Change: 2019 Oct 08
|
||||
" Filenames: named.conf, rndc.conf
|
||||
" Location: http://www.van-laarhoven.org/vim/syntax/named.vim
|
||||
"
|
||||
@@ -54,7 +54,7 @@ syn match namedIntIdent contained /"\=\k\+"\=/ nextgroup=namedIntSection skipwhi
|
||||
syn region namedSection contained start=+{+ end=+};+ contains=namedSection,namedIntKeyword
|
||||
|
||||
" --- IntSection: section that does not contain other sections
|
||||
syn region namedIntSection contained start=+{+ end=+}+ contains=namedIntKeyword,namedError
|
||||
syn region namedIntSection contained start=+{+ end=+}+ contains=namedIntKeyword,namedError,namedComment
|
||||
|
||||
" --- IntKeyword: keywords contained within `{ ... }' sections only
|
||||
" + these keywords are contained within `key' and `acl' sections
|
||||
|
||||
@@ -1255,7 +1255,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>158</string>
|
||||
<string>159</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
|
||||
@@ -2283,7 +2283,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
|
||||
mods &= ~MOD_MASK_SHIFT;
|
||||
|
||||
// Interpret the ALT key as making the key META, include SHIFT, etc.
|
||||
ch = extract_modifiers(ch, &mods);
|
||||
ch = extract_modifiers(ch, &mods, TRUE, NULL);
|
||||
if (ch == CSI)
|
||||
ch = K_CSI;
|
||||
|
||||
@@ -3189,7 +3189,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
|
||||
char_u *ptr = NULL;
|
||||
char_u *cpo_save = p_cpo;
|
||||
p_cpo = (char_u *)"Bk";
|
||||
char_u *str = replace_termcodes((char_u *)string, &ptr, FALSE, TRUE, FALSE);
|
||||
char_u *str = replace_termcodes((char_u *)string, &ptr, REPTERM_DO_LT, NULL);
|
||||
p_cpo = cpo_save;
|
||||
|
||||
if (*ptr != NUL) /* trailing CTRL-V results in nothing */
|
||||
|
||||
+11
-10
@@ -712,6 +712,7 @@ OBJ = \
|
||||
$(OUTDIR)/bufwrite.o \
|
||||
$(OUTDIR)/change.o \
|
||||
$(OUTDIR)/charset.o \
|
||||
$(OUTDIR)/cindent.o \
|
||||
$(OUTDIR)/cmdexpand.o \
|
||||
$(OUTDIR)/cmdhist.o \
|
||||
$(OUTDIR)/crypt.o \
|
||||
@@ -868,15 +869,15 @@ endif
|
||||
|
||||
ifeq ($(TERMINAL),yes)
|
||||
OBJ += $(OUTDIR)/terminal.o \
|
||||
$(OUTDIR)/encoding.o \
|
||||
$(OUTDIR)/keyboard.o \
|
||||
$(OUTDIR)/termmouse.o \
|
||||
$(OUTDIR)/parser.o \
|
||||
$(OUTDIR)/pen.o \
|
||||
$(OUTDIR)/termscreen.o \
|
||||
$(OUTDIR)/state.o \
|
||||
$(OUTDIR)/unicode.o \
|
||||
$(OUTDIR)/vterm.o
|
||||
$(OUTDIR)/vterm_encoding.o \
|
||||
$(OUTDIR)/vterm_keyboard.o \
|
||||
$(OUTDIR)/vterm_mouse.o \
|
||||
$(OUTDIR)/vterm_parser.o \
|
||||
$(OUTDIR)/vterm_pen.o \
|
||||
$(OUTDIR)/vterm_screen.o \
|
||||
$(OUTDIR)/vterm_state.o \
|
||||
$(OUTDIR)/vterm_unicode.o \
|
||||
$(OUTDIR)/vterm_vterm.o
|
||||
endif
|
||||
|
||||
ifeq ($(SOUND),yes)
|
||||
@@ -1205,7 +1206,7 @@ CCCTERM = $(CC) -c $(CFLAGS) -Ilibvterm/include -DINLINE="" \
|
||||
-DWCWIDTH_FUNCTION=utf_uint2cells \
|
||||
-DGET_SPECIAL_PTY_TYPE_FUNCTION=get_special_pty_type
|
||||
|
||||
$(OUTDIR)/%.o : libvterm/src/%.c $(TERM_DEPS)
|
||||
$(OUTDIR)/vterm_%.o : libvterm/src/%.c $(TERM_DEPS)
|
||||
$(CCCTERM) $< -o $@
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ SRC = arabic.c \
|
||||
bufwrite.c \
|
||||
change.c \
|
||||
charset.c \
|
||||
cindent.c \
|
||||
cmdexpand.c \
|
||||
cmdhist.c \
|
||||
crypt.c \
|
||||
|
||||
+31
-22
@@ -363,15 +363,15 @@ TERMINAL = no
|
||||
!if "$(TERMINAL)" == "yes"
|
||||
TERM_OBJ = \
|
||||
$(OBJDIR)/terminal.obj \
|
||||
$(OBJDIR)/encoding.obj \
|
||||
$(OBJDIR)/keyboard.obj \
|
||||
$(OBJDIR)/termmouse.obj \
|
||||
$(OBJDIR)/parser.obj \
|
||||
$(OBJDIR)/pen.obj \
|
||||
$(OBJDIR)/termscreen.obj \
|
||||
$(OBJDIR)/state.obj \
|
||||
$(OBJDIR)/unicode.obj \
|
||||
$(OBJDIR)/vterm.obj
|
||||
$(OBJDIR)/vterm_encoding.obj \
|
||||
$(OBJDIR)/vterm_keyboard.obj \
|
||||
$(OBJDIR)/vterm_mouse.obj \
|
||||
$(OBJDIR)/vterm_parser.obj \
|
||||
$(OBJDIR)/vterm_pen.obj \
|
||||
$(OBJDIR)/vterm_screen.obj \
|
||||
$(OBJDIR)/vterm_state.obj \
|
||||
$(OBJDIR)/vterm_unicode.obj \
|
||||
$(OBJDIR)/vterm_vterm.obj
|
||||
TERM_DEFS = -DFEAT_TERMINAL
|
||||
TERM_DEPS = \
|
||||
libvterm/include/vterm.h \
|
||||
@@ -719,6 +719,7 @@ OBJ = \
|
||||
$(OUTDIR)\bufwrite.obj \
|
||||
$(OUTDIR)\change.obj \
|
||||
$(OUTDIR)\charset.obj \
|
||||
$(OUTDIR)\cindent.obj \
|
||||
$(OUTDIR)\cmdexpand.obj \
|
||||
$(OUTDIR)\cmdhist.obj \
|
||||
$(OUTDIR)\crypt.obj \
|
||||
@@ -1464,6 +1465,8 @@ $(OUTDIR)/change.obj: $(OUTDIR) change.c $(INCL)
|
||||
|
||||
$(OUTDIR)/charset.obj: $(OUTDIR) charset.c $(INCL)
|
||||
|
||||
$(OUTDIR)/cindent.obj: $(OUTDIR) cindent.c $(INCL)
|
||||
|
||||
$(OUTDIR)/cmdexpand.obj: $(OUTDIR) cmdexpand.c $(INCL)
|
||||
|
||||
$(OUTDIR)/cmdhist.obj: $(OUTDIR) cmdhist.c $(INCL)
|
||||
@@ -1740,27 +1743,32 @@ CCCTERM = $(CC) $(CFLAGS) -Ilibvterm/include -DINLINE="" \
|
||||
-DGET_SPECIAL_PTY_TYPE_FUNCTION=get_special_pty_type \
|
||||
-D_CRT_SECURE_NO_WARNINGS
|
||||
|
||||
# Create a default rule for libvterm.
|
||||
{libvterm/src/}.c{$(OUTDIR)/}.obj::
|
||||
$(CCCTERM) -Fo$(OUTDIR)/ $<
|
||||
$(OUTDIR)/vterm_encoding.obj: $(OUTDIR) libvterm/src/encoding.c $(TERM_DEPS)
|
||||
$(CCCTERM) /Fo$@ libvterm/src/encoding.c
|
||||
|
||||
$(OUTDIR)/encoding.obj: $(OUTDIR) libvterm/src/encoding.c $(TERM_DEPS)
|
||||
$(OUTDIR)/vterm_keyboard.obj: $(OUTDIR) libvterm/src/keyboard.c $(TERM_DEPS)
|
||||
$(CCCTERM) /Fo$@ libvterm/src/keyboard.c
|
||||
|
||||
$(OUTDIR)/keyboard.obj: $(OUTDIR) libvterm/src/keyboard.c $(TERM_DEPS)
|
||||
$(OUTDIR)/vterm_mouse.obj: $(OUTDIR) libvterm/src/mouse.c $(TERM_DEPS)
|
||||
$(CCCTERM) /Fo$@ libvterm/src/mouse.c
|
||||
|
||||
$(OUTDIR)/termmouse.obj: $(OUTDIR) libvterm/src/termmouse.c $(TERM_DEPS)
|
||||
$(OUTDIR)/vterm_parser.obj: $(OUTDIR) libvterm/src/parser.c $(TERM_DEPS)
|
||||
$(CCCTERM) /Fo$@ libvterm/src/parser.c
|
||||
|
||||
$(OUTDIR)/parser.obj: $(OUTDIR) libvterm/src/parser.c $(TERM_DEPS)
|
||||
$(OUTDIR)/vterm_pen.obj: $(OUTDIR) libvterm/src/pen.c $(TERM_DEPS)
|
||||
$(CCCTERM) /Fo$@ libvterm/src/pen.c
|
||||
|
||||
$(OUTDIR)/pen.obj: $(OUTDIR) libvterm/src/pen.c $(TERM_DEPS)
|
||||
$(OUTDIR)/vterm_screen.obj: $(OUTDIR) libvterm/src/screen.c $(TERM_DEPS)
|
||||
$(CCCTERM) /Fo$@ libvterm/src/screen.c
|
||||
|
||||
$(OUTDIR)/termscreen.obj: $(OUTDIR) libvterm/src/termscreen.c $(TERM_DEPS)
|
||||
$(OUTDIR)/vterm_state.obj: $(OUTDIR) libvterm/src/state.c $(TERM_DEPS)
|
||||
$(CCCTERM) /Fo$@ libvterm/src/state.c
|
||||
|
||||
$(OUTDIR)/state.obj: $(OUTDIR) libvterm/src/state.c $(TERM_DEPS)
|
||||
$(OUTDIR)/vterm_unicode.obj: $(OUTDIR) libvterm/src/unicode.c $(TERM_DEPS)
|
||||
$(CCCTERM) /Fo$@ libvterm/src/unicode.c
|
||||
|
||||
$(OUTDIR)/unicode.obj: $(OUTDIR) libvterm/src/unicode.c $(TERM_DEPS)
|
||||
|
||||
$(OUTDIR)/vterm.obj: $(OUTDIR) libvterm/src/vterm.c $(TERM_DEPS)
|
||||
$(OUTDIR)/vterm_vterm.obj: $(OUTDIR) libvterm/src/vterm.c $(TERM_DEPS)
|
||||
$(CCCTERM) /Fo$@ libvterm/src/vterm.c
|
||||
|
||||
|
||||
# $CFLAGS may contain backslashes and double quotes, escape them both.
|
||||
@@ -1794,6 +1802,7 @@ proto.h: \
|
||||
proto/bufwrite.pro \
|
||||
proto/change.pro \
|
||||
proto/charset.pro \
|
||||
proto/cindent.pro \
|
||||
proto/cmdexpand.pro \
|
||||
proto/cmdhist.pro \
|
||||
proto/crypt.pro \
|
||||
|
||||
@@ -318,6 +318,7 @@ SRC = \
|
||||
bufwrite.c \
|
||||
change.c \
|
||||
charset.c \
|
||||
cindent.c \
|
||||
cmdexpand.c \
|
||||
cmdhist.c \
|
||||
crypt.c \
|
||||
@@ -420,6 +421,7 @@ OBJ = \
|
||||
bufwrite.obj \
|
||||
change.obj \
|
||||
charset.obj \
|
||||
cindent.obj \
|
||||
cmdexpand.obj \
|
||||
cmdhist.obj \
|
||||
crypt.obj \
|
||||
@@ -700,6 +702,10 @@ charset.obj : charset.c vim.h [.auto]config.h feature.h os_unix.h \
|
||||
ascii.h keymap.h term.h macros.h structs.h regexp.h \
|
||||
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
|
||||
globals.h
|
||||
cindent.obj : cindent.c vim.h [.auto]config.h feature.h os_unix.h \
|
||||
ascii.h keymap.h term.h macros.h structs.h regexp.h \
|
||||
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
|
||||
globals.h
|
||||
cmdexpand.obj : cmdexpand.c vim.h [.auto]config.h feature.h os_unix.h \
|
||||
ascii.h keymap.h term.h macros.h structs.h regexp.h \
|
||||
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
|
||||
|
||||
+34
-20
@@ -1602,6 +1602,7 @@ BASIC_SRC = \
|
||||
buffer.c \
|
||||
change.c \
|
||||
charset.c \
|
||||
cindent.c \
|
||||
cmdexpand.c \
|
||||
cmdhist.c \
|
||||
crypt.c \
|
||||
@@ -1742,6 +1743,7 @@ OBJ_COMMON = \
|
||||
objects/change.o \
|
||||
objects/blob.o \
|
||||
objects/blowfish.o \
|
||||
objects/cindent.o \
|
||||
objects/cmdexpand.o \
|
||||
objects/cmdhist.o \
|
||||
objects/crypt.o \
|
||||
@@ -1895,6 +1897,7 @@ PRO_AUTO = \
|
||||
buffer.pro \
|
||||
change.pro \
|
||||
charset.pro \
|
||||
cindent.pro \
|
||||
cmdexpand.pro \
|
||||
cmdhist.pro \
|
||||
crypt.pro \
|
||||
@@ -2874,6 +2877,7 @@ clean celan: testclean macvimclean
|
||||
-rm -f runtime pixmaps
|
||||
-rm -rf $(APPDIR)
|
||||
-rm -rf mzscheme_base.c
|
||||
-rm -rf libvterm/.libs libterm/t/.libs libvterm/src/*.o libvterm/src/*.lo libvterm/t/*.o libvterm/t/*.lo libvterm/t/harness libvterm/libvterm.la
|
||||
if test -d $(PODIR); then \
|
||||
cd $(PODIR); $(MAKE) prefix=$(DESTDIR)$(prefix) clean; \
|
||||
fi
|
||||
@@ -3104,6 +3108,9 @@ objects/change.o: change.c
|
||||
objects/charset.o: charset.c
|
||||
$(CCC) -o $@ charset.c
|
||||
|
||||
objects/cindent.o: cindent.c
|
||||
$(CCC) -o $@ cindent.c
|
||||
|
||||
objects/cmdexpand.o: cmdexpand.c
|
||||
$(CCC) -o $@ cmdexpand.c
|
||||
|
||||
@@ -3473,36 +3480,39 @@ objects/channel.o: channel.c
|
||||
Makefile:
|
||||
@echo The name of the makefile MUST be "Makefile" (with capital M)!!!!
|
||||
|
||||
# Build rules for libvterm. Putting them here allows for adding compilation
|
||||
# options specific for Vim. Since the .o files go into objects/ we do need to
|
||||
# prefix vterm_ to avoid name clashes.
|
||||
CCCTERM = $(CCC_NF) $(VTERM_CFLAGS) $(ALL_CFLAGS) -DINLINE="" \
|
||||
-DVSNPRINTF=vim_vsnprintf \
|
||||
-DIS_COMBINING_FUNCTION=utf_iscomposing_uint \
|
||||
-DWCWIDTH_FUNCTION=utf_uint2cells
|
||||
|
||||
objects/encoding.o: libvterm/src/encoding.c $(TERM_DEPS)
|
||||
objects/vterm_encoding.o: libvterm/src/encoding.c $(TERM_DEPS)
|
||||
$(CCCTERM) -o $@ libvterm/src/encoding.c
|
||||
|
||||
objects/keyboard.o: libvterm/src/keyboard.c $(TERM_DEPS)
|
||||
objects/vterm_keyboard.o: libvterm/src/keyboard.c $(TERM_DEPS)
|
||||
$(CCCTERM) -o $@ libvterm/src/keyboard.c
|
||||
|
||||
objects/termmouse.o: libvterm/src/termmouse.c $(TERM_DEPS)
|
||||
$(CCCTERM) -o $@ libvterm/src/termmouse.c
|
||||
objects/vterm_mouse.o: libvterm/src/mouse.c $(TERM_DEPS)
|
||||
$(CCCTERM) -o $@ libvterm/src/mouse.c
|
||||
|
||||
objects/parser.o: libvterm/src/parser.c $(TERM_DEPS)
|
||||
objects/vterm_parser.o: libvterm/src/parser.c $(TERM_DEPS)
|
||||
$(CCCTERM) -o $@ libvterm/src/parser.c
|
||||
|
||||
objects/pen.o: libvterm/src/pen.c $(TERM_DEPS)
|
||||
objects/vterm_pen.o: libvterm/src/pen.c $(TERM_DEPS)
|
||||
$(CCCTERM) -o $@ libvterm/src/pen.c
|
||||
|
||||
objects/termscreen.o: libvterm/src/termscreen.c $(TERM_DEPS)
|
||||
$(CCCTERM) -o $@ libvterm/src/termscreen.c
|
||||
objects/vterm_screen.o: libvterm/src/screen.c $(TERM_DEPS)
|
||||
$(CCCTERM) -o $@ libvterm/src/screen.c
|
||||
|
||||
objects/state.o: libvterm/src/state.c $(TERM_DEPS)
|
||||
objects/vterm_state.o: libvterm/src/state.c $(TERM_DEPS)
|
||||
$(CCCTERM) -o $@ libvterm/src/state.c
|
||||
|
||||
objects/unicode.o: libvterm/src/unicode.c $(TERM_DEPS)
|
||||
objects/vterm_unicode.o: libvterm/src/unicode.c $(TERM_DEPS)
|
||||
$(CCCTERM) -o $@ libvterm/src/unicode.c
|
||||
|
||||
objects/vterm.o: libvterm/src/vterm.c $(TERM_DEPS)
|
||||
objects/vterm_vterm.o: libvterm/src/vterm.c $(TERM_DEPS)
|
||||
$(CCCTERM) -o $@ libvterm/src/vterm.c
|
||||
|
||||
CCCDIFF = $(CCC_NF) $(ALL_CFLAGS)
|
||||
@@ -3678,6 +3688,10 @@ objects/charset.o: charset.c vim.h protodef.h auto/config.h feature.h os_unix.h
|
||||
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||
proto.h globals.h
|
||||
objects/cindent.o: cindent.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
||||
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||
proto.h globals.h
|
||||
objects/cmdexpand.o: cmdexpand.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
||||
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||
@@ -4158,27 +4172,27 @@ objects/channel.o: channel.c vim.h protodef.h auto/config.h feature.h os_unix.h
|
||||
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||
proto.h globals.h
|
||||
objects/gui_gtk_gresources.o: auto/gui_gtk_gresources.c
|
||||
objects/encoding.o: libvterm/src/encoding.c libvterm/src/vterm_internal.h \
|
||||
objects/vterm_encoding.o: libvterm/src/encoding.c libvterm/src/vterm_internal.h \
|
||||
libvterm/include/vterm.h libvterm/include/vterm_keycodes.h \
|
||||
libvterm/src/encoding/DECdrawing.inc libvterm/src/encoding/uk.inc
|
||||
objects/keyboard.o: libvterm/src/keyboard.c libvterm/src/vterm_internal.h \
|
||||
objects/vterm_keyboard.o: libvterm/src/keyboard.c libvterm/src/vterm_internal.h \
|
||||
libvterm/include/vterm.h libvterm/include/vterm_keycodes.h \
|
||||
libvterm/src/utf8.h
|
||||
objects/termmouse.o: libvterm/src/termmouse.c libvterm/src/vterm_internal.h \
|
||||
objects/vterm_mouse.o: libvterm/src/mouse.c libvterm/src/vterm_internal.h \
|
||||
libvterm/include/vterm.h libvterm/include/vterm_keycodes.h \
|
||||
libvterm/src/utf8.h
|
||||
objects/parser.o: libvterm/src/parser.c libvterm/src/vterm_internal.h \
|
||||
objects/vterm_parser.o: libvterm/src/parser.c libvterm/src/vterm_internal.h \
|
||||
libvterm/include/vterm.h libvterm/include/vterm_keycodes.h
|
||||
objects/pen.o: libvterm/src/pen.c libvterm/src/vterm_internal.h \
|
||||
objects/vterm_pen.o: libvterm/src/pen.c libvterm/src/vterm_internal.h \
|
||||
libvterm/include/vterm.h libvterm/include/vterm_keycodes.h
|
||||
objects/state.o: libvterm/src/state.c libvterm/src/vterm_internal.h \
|
||||
objects/vterm_state.o: libvterm/src/state.c libvterm/src/vterm_internal.h \
|
||||
libvterm/include/vterm.h libvterm/include/vterm_keycodes.h
|
||||
objects/termscreen.o: libvterm/src/termscreen.c libvterm/src/vterm_internal.h \
|
||||
objects/vterm_screen.o: libvterm/src/screen.c libvterm/src/vterm_internal.h \
|
||||
libvterm/include/vterm.h libvterm/include/vterm_keycodes.h \
|
||||
libvterm/src/rect.h libvterm/src/utf8.h
|
||||
objects/unicode.o: libvterm/src/unicode.c libvterm/src/vterm_internal.h \
|
||||
objects/vterm_unicode.o: libvterm/src/unicode.c libvterm/src/vterm_internal.h \
|
||||
libvterm/include/vterm.h libvterm/include/vterm_keycodes.h
|
||||
objects/vterm.o: libvterm/src/vterm.c libvterm/src/vterm_internal.h \
|
||||
objects/vterm_vterm.o: libvterm/src/vterm.c libvterm/src/vterm_internal.h \
|
||||
libvterm/include/vterm.h libvterm/include/vterm_keycodes.h \
|
||||
libvterm/src/utf8.h
|
||||
objects/xdiffi.o: xdiff/xdiffi.c xdiff/xinclude.h auto/config.h \
|
||||
|
||||
+2
-1
@@ -29,6 +29,7 @@ blob.c | blob data type
|
||||
buffer.c | manipulating buffers (loaded files)
|
||||
bufwrite.c | writing a buffer to file
|
||||
change.c | handling changes to text
|
||||
cindent.c | C and Lisp indentation
|
||||
cmdexpand.c | command-line completion
|
||||
cmdhist.c | command-line history
|
||||
debugger.c | vim script debugger
|
||||
@@ -46,7 +47,7 @@ findfile.c | search for files in 'path'
|
||||
fold.c | folding
|
||||
getchar.c | getting characters and key mapping
|
||||
highlight.c | syntax highlighting
|
||||
indent.c | C and Lisp indentation
|
||||
indent.c | text indentation
|
||||
insexpand.c | Insert mode completion
|
||||
mark.c | marks
|
||||
map.c | mapping and abbreviations
|
||||
|
||||
Vendored
+2
-2
@@ -7991,9 +7991,9 @@ fi
|
||||
if test "$enable_terminal" = "yes" -a "$enable_channel" = "yes"; then
|
||||
$as_echo "#define FEAT_TERMINAL 1" >>confdefs.h
|
||||
|
||||
TERM_SRC="libvterm/src/encoding.c libvterm/src/keyboard.c libvterm/src/mouse.c libvterm/src/parser.c libvterm/src/pen.c libvterm/src/termscreen.c libvterm/src/state.c libvterm/src/unicode.c libvterm/src/vterm.c"
|
||||
TERM_SRC="libvterm/src/encoding.c libvterm/src/keyboard.c libvterm/src/mouse.c libvterm/src/parser.c libvterm/src/pen.c libvterm/src/creen.c libvterm/src/state.c libvterm/src/unicode.c libvterm/src/vterm.c"
|
||||
|
||||
TERM_OBJ="objects/encoding.o objects/keyboard.o objects/termmouse.o objects/parser.o objects/pen.o objects/termscreen.o objects/state.o objects/unicode.o objects/vterm.o"
|
||||
TERM_OBJ="objects/vterm_encoding.o objects/vterm_keyboard.o objects/vterm_mouse.o objects/vterm_parser.o objects/vterm_pen.o objects/vterm_screen.o objects/vterm_state.o objects/vterm_unicode.o objects/vterm_vterm.o"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ find_word_under_cursor(
|
||||
lbuf = ml_get_buf(curwin->w_buffer, VIsual.lnum, FALSE);
|
||||
len = epos->col - spos->col;
|
||||
if (*p_sel != 'e')
|
||||
len += MB_PTR2LEN(lbuf + epos->col);
|
||||
len += mb_ptr2len(lbuf + epos->col);
|
||||
lbuf = vim_strnsave(lbuf + spos->col, len);
|
||||
lnum = spos->lnum;
|
||||
col = spos->col;
|
||||
|
||||
@@ -884,6 +884,7 @@ free_buffer(buf_T *buf)
|
||||
/* b:changedtick uses an item in buf_T, remove it now */
|
||||
dictitem_remove(buf->b_vars, (dictitem_T *)&buf->b_ct_di);
|
||||
unref_var_dict(buf->b_vars);
|
||||
remove_listeners(buf);
|
||||
#endif
|
||||
#ifdef FEAT_LUA
|
||||
lua_buffer_free(buf);
|
||||
@@ -912,6 +913,7 @@ free_buffer(buf_T *buf)
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
vim_free(buf->b_prompt_text);
|
||||
free_callback(&buf->b_prompt_callback);
|
||||
free_callback(&buf->b_prompt_interrupt);
|
||||
#endif
|
||||
|
||||
buf_hashtab_remove(buf);
|
||||
|
||||
+19
-146
@@ -300,7 +300,7 @@ f_listener_remove(typval_T *argvars, typval_T *rettv)
|
||||
int id = tv_get_number(argvars);
|
||||
buf_T *buf;
|
||||
|
||||
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
||||
FOR_ALL_BUFFERS(buf)
|
||||
{
|
||||
prev = NULL;
|
||||
for (lnr = buf->b_listener; lnr != NULL; lnr = next)
|
||||
@@ -402,6 +402,24 @@ invoke_listeners(buf_T *buf)
|
||||
after_updating_screen(TRUE);
|
||||
recursive = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove all listeners associated with "buf".
|
||||
*/
|
||||
void
|
||||
remove_listeners(buf_T *buf)
|
||||
{
|
||||
listener_T *lnr;
|
||||
listener_T *next;
|
||||
|
||||
for (lnr = buf->b_listener; lnr != NULL; lnr = next)
|
||||
{
|
||||
next = lnr->lr_next;
|
||||
free_callback(&lnr->lr_callback);
|
||||
vim_free(lnr);
|
||||
}
|
||||
buf->b_listener = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -1232,151 +1250,6 @@ del_bytes(
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the indent from ptr to the current line (and fill to size)
|
||||
* Leaves the cursor on the first non-blank in the line.
|
||||
* Returns TRUE if the line was changed.
|
||||
*/
|
||||
static int
|
||||
copy_indent(int size, char_u *src)
|
||||
{
|
||||
char_u *p = NULL;
|
||||
char_u *line = NULL;
|
||||
char_u *s;
|
||||
int todo;
|
||||
int ind_len;
|
||||
int line_len = 0;
|
||||
int tab_pad;
|
||||
int ind_done;
|
||||
int round;
|
||||
#ifdef FEAT_VARTABS
|
||||
int ind_col;
|
||||
#endif
|
||||
|
||||
// Round 1: compute the number of characters needed for the indent
|
||||
// Round 2: copy the characters.
|
||||
for (round = 1; round <= 2; ++round)
|
||||
{
|
||||
todo = size;
|
||||
ind_len = 0;
|
||||
ind_done = 0;
|
||||
#ifdef FEAT_VARTABS
|
||||
ind_col = 0;
|
||||
#endif
|
||||
s = src;
|
||||
|
||||
// Count/copy the usable portion of the source line
|
||||
while (todo > 0 && VIM_ISWHITE(*s))
|
||||
{
|
||||
if (*s == TAB)
|
||||
{
|
||||
#ifdef FEAT_VARTABS
|
||||
tab_pad = tabstop_padding(ind_done, curbuf->b_p_ts,
|
||||
curbuf->b_p_vts_array);
|
||||
#else
|
||||
tab_pad = (int)curbuf->b_p_ts
|
||||
- (ind_done % (int)curbuf->b_p_ts);
|
||||
#endif
|
||||
// Stop if this tab will overshoot the target
|
||||
if (todo < tab_pad)
|
||||
break;
|
||||
todo -= tab_pad;
|
||||
ind_done += tab_pad;
|
||||
#ifdef FEAT_VARTABS
|
||||
ind_col += tab_pad;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
--todo;
|
||||
++ind_done;
|
||||
#ifdef FEAT_VARTABS
|
||||
++ind_col;
|
||||
#endif
|
||||
}
|
||||
++ind_len;
|
||||
if (p != NULL)
|
||||
*p++ = *s;
|
||||
++s;
|
||||
}
|
||||
|
||||
// Fill to next tabstop with a tab, if possible
|
||||
#ifdef FEAT_VARTABS
|
||||
tab_pad = tabstop_padding(ind_done, curbuf->b_p_ts,
|
||||
curbuf->b_p_vts_array);
|
||||
#else
|
||||
tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts);
|
||||
#endif
|
||||
if (todo >= tab_pad && !curbuf->b_p_et)
|
||||
{
|
||||
todo -= tab_pad;
|
||||
++ind_len;
|
||||
#ifdef FEAT_VARTABS
|
||||
ind_col += tab_pad;
|
||||
#endif
|
||||
if (p != NULL)
|
||||
*p++ = TAB;
|
||||
}
|
||||
|
||||
// Add tabs required for indent
|
||||
if (!curbuf->b_p_et)
|
||||
{
|
||||
#ifdef FEAT_VARTABS
|
||||
for (;;)
|
||||
{
|
||||
tab_pad = tabstop_padding(ind_col, curbuf->b_p_ts,
|
||||
curbuf->b_p_vts_array);
|
||||
if (todo < tab_pad)
|
||||
break;
|
||||
todo -= tab_pad;
|
||||
++ind_len;
|
||||
ind_col += tab_pad;
|
||||
if (p != NULL)
|
||||
*p++ = TAB;
|
||||
}
|
||||
#else
|
||||
while (todo >= (int)curbuf->b_p_ts)
|
||||
{
|
||||
todo -= (int)curbuf->b_p_ts;
|
||||
++ind_len;
|
||||
if (p != NULL)
|
||||
*p++ = TAB;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Count/add spaces required for indent
|
||||
while (todo > 0)
|
||||
{
|
||||
--todo;
|
||||
++ind_len;
|
||||
if (p != NULL)
|
||||
*p++ = ' ';
|
||||
}
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
// Allocate memory for the result: the copied indent, new indent
|
||||
// and the rest of the line.
|
||||
line_len = (int)STRLEN(ml_get_curline()) + 1;
|
||||
line = alloc(ind_len + line_len);
|
||||
if (line == NULL)
|
||||
return FALSE;
|
||||
p = line;
|
||||
}
|
||||
}
|
||||
|
||||
// Append the original line
|
||||
mch_memmove(p, ml_get_curline(), (size_t)line_len);
|
||||
|
||||
// Replace the line
|
||||
ml_replace(curwin->w_cursor.lnum, line, FALSE);
|
||||
|
||||
// Put the cursor after the indent.
|
||||
curwin->w_cursor.col = ind_len;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* open_line: Add a new line below or above the current line.
|
||||
*
|
||||
|
||||
+4133
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -2168,9 +2168,9 @@ else
|
||||
fi
|
||||
if test "$enable_terminal" = "yes" -a "$enable_channel" = "yes"; then
|
||||
AC_DEFINE(FEAT_TERMINAL)
|
||||
TERM_SRC="libvterm/src/encoding.c libvterm/src/keyboard.c libvterm/src/mouse.c libvterm/src/parser.c libvterm/src/pen.c libvterm/src/termscreen.c libvterm/src/state.c libvterm/src/unicode.c libvterm/src/vterm.c"
|
||||
TERM_SRC="libvterm/src/encoding.c libvterm/src/keyboard.c libvterm/src/mouse.c libvterm/src/parser.c libvterm/src/pen.c libvterm/src/creen.c libvterm/src/state.c libvterm/src/unicode.c libvterm/src/vterm.c"
|
||||
AC_SUBST(TERM_SRC)
|
||||
TERM_OBJ="objects/encoding.o objects/keyboard.o objects/termmouse.o objects/parser.o objects/pen.o objects/termscreen.o objects/state.o objects/unicode.o objects/vterm.o"
|
||||
TERM_OBJ="objects/vterm_encoding.o objects/vterm_keyboard.o objects/vterm_mouse.o objects/vterm_parser.o objects/vterm_pen.o objects/vterm_screen.o objects/vterm_state.o objects/vterm_unicode.o objects/vterm_vterm.o"
|
||||
AC_SUBST(TERM_OBJ)
|
||||
fi
|
||||
|
||||
|
||||
+1
-1
@@ -744,7 +744,7 @@ diff_write_buffer(buf_T *buf, diffin_T *din)
|
||||
// xdiff doesn't support ignoring case, fold-case the text.
|
||||
c = PTR2CHAR(s);
|
||||
c = enc_utf8 ? utf_fold(c) : MB_TOLOWER(c);
|
||||
orig_len = MB_PTR2LEN(s);
|
||||
orig_len = mb_ptr2len(s);
|
||||
if (mb_char2bytes(c, cbuf) != orig_len)
|
||||
// TODO: handle byte length difference
|
||||
mch_memmove(ptr + len, s, orig_len);
|
||||
|
||||
+91
-105
@@ -289,6 +289,8 @@ win_line(
|
||||
#ifdef FEAT_SYN_HL
|
||||
int vcol_save_attr = 0; // saved attr for 'cursorcolumn'
|
||||
int syntax_attr = 0; // attributes desired by syntax
|
||||
int prev_syntax_col = -1; // column of prev_syntax_attr
|
||||
int prev_syntax_attr = 0; // syntax_attr at prev_syntax_col
|
||||
int has_syntax = FALSE; // this buffer has syntax highl.
|
||||
int save_did_emsg;
|
||||
int draw_color_col = FALSE; // highlight colorcolumn
|
||||
@@ -307,6 +309,7 @@ win_line(
|
||||
#endif
|
||||
#ifdef FEAT_SPELL
|
||||
int has_spell = FALSE; // this buffer has spell checking
|
||||
int can_spell;
|
||||
# define SPWORDLEN 150
|
||||
char_u nextline[SPWORDLEN * 2];// text with start of the next line
|
||||
int nextlinecol = 0; // column where nextline[] starts
|
||||
@@ -747,6 +750,9 @@ win_line(
|
||||
win_attr = wcr_attr;
|
||||
area_highlighting = TRUE;
|
||||
}
|
||||
if (vi_attr != 0 && win_attr != 0)
|
||||
vi_attr = hl_combine_attr(win_attr, vi_attr);
|
||||
|
||||
#ifdef FEAT_TEXT_PROP
|
||||
if (WIN_IS_POPUP(wp))
|
||||
screen_line_flags |= SLF_POPUP;
|
||||
@@ -1113,11 +1119,11 @@ win_line(
|
||||
// the line number itself.
|
||||
// TODO: Can we use CursorLine instead of CursorLineNr
|
||||
// when CursorLineNr isn't set?
|
||||
if ((wp->w_p_cul || wp->w_p_rnu)
|
||||
if (wp->w_p_cul
|
||||
&& lnum == wp->w_cursor.lnum
|
||||
&& (wp->w_p_culopt_flags & CULOPT_NBR)
|
||||
&& (row == startrow
|
||||
|| wp->w_p_culopt_flags & CULOPT_LINE)
|
||||
&& lnum == wp->w_cursor.lnum)
|
||||
|| wp->w_p_culopt_flags & CULOPT_LINE))
|
||||
char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_CLN));
|
||||
#endif
|
||||
}
|
||||
@@ -1281,11 +1287,7 @@ win_line(
|
||||
break;
|
||||
}
|
||||
|
||||
if (draw_state == WL_LINE && (area_highlighting
|
||||
#ifdef FEAT_SPELL
|
||||
|| has_spell
|
||||
#endif
|
||||
))
|
||||
if (draw_state == WL_LINE && (area_highlighting || extra_check))
|
||||
{
|
||||
// handle Visual or match highlighting in this line
|
||||
if (vcol == fromcol
|
||||
@@ -1397,6 +1399,73 @@ win_line(
|
||||
}
|
||||
#endif
|
||||
|
||||
if (extra_check)
|
||||
{
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (get_term_attr)
|
||||
syntax_attr = term_get_attr(wp->w_buffer, lnum, vcol);
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_SYN_HL
|
||||
// Get syntax attribute.
|
||||
if (has_syntax)
|
||||
{
|
||||
// Get the syntax attribute for the character. If there
|
||||
// is an error, disable syntax highlighting.
|
||||
save_did_emsg = did_emsg;
|
||||
did_emsg = FALSE;
|
||||
|
||||
v = (long)(ptr - line);
|
||||
if (v == prev_syntax_col)
|
||||
// at same column again
|
||||
syntax_attr = prev_syntax_attr;
|
||||
else
|
||||
{
|
||||
# ifdef FEAT_SPELL
|
||||
can_spell = TRUE;
|
||||
# endif
|
||||
syntax_attr = get_syntax_attr((colnr_T)v,
|
||||
# ifdef FEAT_SPELL
|
||||
has_spell ? &can_spell :
|
||||
# endif
|
||||
NULL, FALSE);
|
||||
prev_syntax_col = v;
|
||||
prev_syntax_attr = syntax_attr;
|
||||
}
|
||||
|
||||
// combine syntax attribute with 'wincolor'
|
||||
if (syntax_attr != 0 && win_attr != 0)
|
||||
syntax_attr = hl_combine_attr(win_attr, syntax_attr);
|
||||
|
||||
if (did_emsg)
|
||||
{
|
||||
wp->w_s->b_syn_error = TRUE;
|
||||
has_syntax = FALSE;
|
||||
syntax_attr = 0;
|
||||
}
|
||||
else
|
||||
did_emsg = save_did_emsg;
|
||||
# ifdef SYN_TIME_LIMIT
|
||||
if (wp->w_s->b_syn_slow)
|
||||
has_syntax = FALSE;
|
||||
# endif
|
||||
|
||||
// Need to get the line again, a multi-line regexp may
|
||||
// have made it invalid.
|
||||
line = ml_get_buf(wp->w_buffer, lnum, FALSE);
|
||||
ptr = line + v;
|
||||
# ifdef FEAT_CONCEAL
|
||||
// no concealing past the end of the line, it interferes
|
||||
// with line highlighting
|
||||
if (*ptr == NUL)
|
||||
syntax_flags = 0;
|
||||
else
|
||||
syntax_flags = get_syntax_info(&syntax_seqnr);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Decide which of the highlight attributes to use.
|
||||
attr_pri = TRUE;
|
||||
#ifdef LINE_ATTR
|
||||
@@ -1420,7 +1489,12 @@ win_line(
|
||||
{
|
||||
// Use line_attr when not in the Visual or 'incsearch' area
|
||||
// (area_attr may be 0 when "noinvcur" is set).
|
||||
char_attr = line_attr;
|
||||
# ifdef FEAT_SYN_HL
|
||||
if (has_syntax)
|
||||
char_attr = hl_combine_attr(syntax_attr, line_attr);
|
||||
else
|
||||
# endif
|
||||
char_attr = line_attr;
|
||||
attr_pri = FALSE;
|
||||
}
|
||||
#else
|
||||
@@ -1445,8 +1519,12 @@ win_line(
|
||||
else
|
||||
#endif
|
||||
#ifdef FEAT_SYN_HL
|
||||
if (has_syntax)
|
||||
char_attr = syntax_attr;
|
||||
if (has_syntax
|
||||
# ifdef FEAT_TERMINAL
|
||||
|| get_term_attr
|
||||
# endif
|
||||
)
|
||||
char_attr = syntax_attr;
|
||||
else
|
||||
#endif
|
||||
char_attr = 0;
|
||||
@@ -1741,99 +1819,6 @@ win_line(
|
||||
|
||||
if (extra_check)
|
||||
{
|
||||
#ifdef FEAT_SPELL
|
||||
int can_spell = TRUE;
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (get_term_attr)
|
||||
{
|
||||
syntax_attr = term_get_attr(wp->w_buffer, lnum, vcol);
|
||||
|
||||
if (!attr_pri)
|
||||
char_attr = syntax_attr;
|
||||
else
|
||||
char_attr = hl_combine_attr(syntax_attr, char_attr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_SYN_HL
|
||||
// Get syntax attribute, unless still at the start of the line
|
||||
// (double-wide char that doesn't fit).
|
||||
v = (long)(ptr - line);
|
||||
if (has_syntax && v > 0)
|
||||
{
|
||||
// Get the syntax attribute for the character. If there
|
||||
// is an error, disable syntax highlighting.
|
||||
save_did_emsg = did_emsg;
|
||||
did_emsg = FALSE;
|
||||
|
||||
syntax_attr = get_syntax_attr((colnr_T)v - 1,
|
||||
# ifdef FEAT_SPELL
|
||||
has_spell ? &can_spell :
|
||||
# endif
|
||||
NULL, FALSE);
|
||||
|
||||
if (did_emsg)
|
||||
{
|
||||
wp->w_s->b_syn_error = TRUE;
|
||||
has_syntax = FALSE;
|
||||
syntax_attr = 0;
|
||||
}
|
||||
else
|
||||
did_emsg = save_did_emsg;
|
||||
|
||||
// combine syntax attribute with 'wincolor'
|
||||
if (win_attr != 0)
|
||||
syntax_attr = hl_combine_attr(win_attr, syntax_attr);
|
||||
|
||||
# ifdef SYN_TIME_LIMIT
|
||||
if (wp->w_s->b_syn_slow)
|
||||
has_syntax = FALSE;
|
||||
# endif
|
||||
|
||||
// Need to get the line again, a multi-line regexp may
|
||||
// have made it invalid.
|
||||
line = ml_get_buf(wp->w_buffer, lnum, FALSE);
|
||||
ptr = line + v;
|
||||
|
||||
# ifdef FEAT_TEXT_PROP
|
||||
// Text properties overrule syntax highlighting or combine.
|
||||
if (text_prop_attr == 0 || text_prop_combine)
|
||||
# endif
|
||||
{
|
||||
int comb_attr = syntax_attr;
|
||||
# ifdef FEAT_TEXT_PROP
|
||||
comb_attr = hl_combine_attr(text_prop_attr, comb_attr);
|
||||
# endif
|
||||
if (!attr_pri)
|
||||
{
|
||||
#ifdef FEAT_SYN_HL
|
||||
if (cul_attr)
|
||||
char_attr = hl_combine_attr(
|
||||
comb_attr, cul_attr);
|
||||
else
|
||||
#endif
|
||||
if (line_attr)
|
||||
char_attr = hl_combine_attr(
|
||||
comb_attr, line_attr);
|
||||
else
|
||||
char_attr = comb_attr;
|
||||
}
|
||||
else
|
||||
char_attr = hl_combine_attr(comb_attr, char_attr);
|
||||
}
|
||||
# ifdef FEAT_CONCEAL
|
||||
// no concealing past the end of the line, it interferes
|
||||
// with line highlighting
|
||||
if (c == NUL)
|
||||
syntax_flags = 0;
|
||||
else
|
||||
syntax_flags = get_syntax_info(&syntax_seqnr);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_SPELL
|
||||
// Check spelling (unless at the end of the line).
|
||||
// Only do this when there is no syntax highlighting, the
|
||||
@@ -2319,7 +2304,8 @@ win_line(
|
||||
if (win_attr != 0)
|
||||
{
|
||||
char_attr = win_attr;
|
||||
if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
|
||||
if (wp->w_p_cul && lnum == wp->w_cursor.lnum
|
||||
&& wp->w_p_culopt_flags != CULOPT_NBR)
|
||||
{
|
||||
if (!cul_screenline || (vcol >= left_curline_col
|
||||
&& vcol <= right_curline_col))
|
||||
|
||||
+1
-340
@@ -37,7 +37,6 @@ static void check_spell_redraw(void);
|
||||
#endif
|
||||
static void stop_insert(pos_T *end_insert_pos, int esc, int nomove);
|
||||
static int echeck_abbr(int);
|
||||
static void replace_join(int off);
|
||||
static void mb_replace_pop_ins(int cc);
|
||||
static void replace_flush(void);
|
||||
static void replace_do_bs(int limit_col);
|
||||
@@ -76,9 +75,6 @@ static int ins_tab(void);
|
||||
static int ins_digraph(void);
|
||||
#endif
|
||||
static int ins_ctrl_ey(int tc);
|
||||
#ifdef FEAT_SMARTINDENT
|
||||
static void ins_try_si(int c);
|
||||
#endif
|
||||
#if defined(FEAT_EVAL)
|
||||
static char_u *do_insert_char_pre(int c);
|
||||
#endif
|
||||
@@ -97,8 +93,6 @@ static int did_restart_edit; /* "restart_edit" when calling edit() */
|
||||
static int can_cindent; /* may do cindenting on this line */
|
||||
#endif
|
||||
|
||||
static int old_indent = 0; /* for ^^D command in insert mode */
|
||||
|
||||
#ifdef FEAT_RIGHTLEFT
|
||||
static int revins_on; /* reverse insert mode on */
|
||||
static int revins_chars; /* how much to skip after edit */
|
||||
@@ -1772,248 +1766,6 @@ undisplay_dollar(void)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert an indent (for <Tab> or CTRL-T) or delete an indent (for CTRL-D).
|
||||
* Keep the cursor on the same character.
|
||||
* type == INDENT_INC increase indent (for CTRL-T or <Tab>)
|
||||
* type == INDENT_DEC decrease indent (for CTRL-D)
|
||||
* type == INDENT_SET set indent to "amount"
|
||||
* if round is TRUE, round the indent to 'shiftwidth' (only with _INC and _Dec).
|
||||
*/
|
||||
void
|
||||
change_indent(
|
||||
int type,
|
||||
int amount,
|
||||
int round,
|
||||
int replaced, /* replaced character, put on replace stack */
|
||||
int call_changed_bytes) /* call changed_bytes() */
|
||||
{
|
||||
int vcol;
|
||||
int last_vcol;
|
||||
int insstart_less; /* reduction for Insstart.col */
|
||||
int new_cursor_col;
|
||||
int i;
|
||||
char_u *ptr;
|
||||
int save_p_list;
|
||||
int start_col;
|
||||
colnr_T vc;
|
||||
colnr_T orig_col = 0; /* init for GCC */
|
||||
char_u *new_line, *orig_line = NULL; /* init for GCC */
|
||||
|
||||
/* VREPLACE mode needs to know what the line was like before changing */
|
||||
if (State & VREPLACE_FLAG)
|
||||
{
|
||||
orig_line = vim_strsave(ml_get_curline()); /* Deal with NULL below */
|
||||
orig_col = curwin->w_cursor.col;
|
||||
}
|
||||
|
||||
/* for the following tricks we don't want list mode */
|
||||
save_p_list = curwin->w_p_list;
|
||||
curwin->w_p_list = FALSE;
|
||||
vc = getvcol_nolist(&curwin->w_cursor);
|
||||
vcol = vc;
|
||||
|
||||
/*
|
||||
* For Replace mode we need to fix the replace stack later, which is only
|
||||
* possible when the cursor is in the indent. Remember the number of
|
||||
* characters before the cursor if it's possible.
|
||||
*/
|
||||
start_col = curwin->w_cursor.col;
|
||||
|
||||
/* determine offset from first non-blank */
|
||||
new_cursor_col = curwin->w_cursor.col;
|
||||
beginline(BL_WHITE);
|
||||
new_cursor_col -= curwin->w_cursor.col;
|
||||
|
||||
insstart_less = curwin->w_cursor.col;
|
||||
|
||||
/*
|
||||
* If the cursor is in the indent, compute how many screen columns the
|
||||
* cursor is to the left of the first non-blank.
|
||||
*/
|
||||
if (new_cursor_col < 0)
|
||||
vcol = get_indent() - vcol;
|
||||
|
||||
if (new_cursor_col > 0) /* can't fix replace stack */
|
||||
start_col = -1;
|
||||
|
||||
/*
|
||||
* Set the new indent. The cursor will be put on the first non-blank.
|
||||
*/
|
||||
if (type == INDENT_SET)
|
||||
(void)set_indent(amount, call_changed_bytes ? SIN_CHANGED : 0);
|
||||
else
|
||||
{
|
||||
int save_State = State;
|
||||
|
||||
/* Avoid being called recursively. */
|
||||
if (State & VREPLACE_FLAG)
|
||||
State = INSERT;
|
||||
shift_line(type == INDENT_DEC, round, 1, call_changed_bytes);
|
||||
State = save_State;
|
||||
}
|
||||
insstart_less -= curwin->w_cursor.col;
|
||||
|
||||
/*
|
||||
* Try to put cursor on same character.
|
||||
* If the cursor is at or after the first non-blank in the line,
|
||||
* compute the cursor column relative to the column of the first
|
||||
* non-blank character.
|
||||
* If we are not in insert mode, leave the cursor on the first non-blank.
|
||||
* If the cursor is before the first non-blank, position it relative
|
||||
* to the first non-blank, counted in screen columns.
|
||||
*/
|
||||
if (new_cursor_col >= 0)
|
||||
{
|
||||
/*
|
||||
* When changing the indent while the cursor is touching it, reset
|
||||
* Insstart_col to 0.
|
||||
*/
|
||||
if (new_cursor_col == 0)
|
||||
insstart_less = MAXCOL;
|
||||
new_cursor_col += curwin->w_cursor.col;
|
||||
}
|
||||
else if (!(State & INSERT))
|
||||
new_cursor_col = curwin->w_cursor.col;
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Compute the screen column where the cursor should be.
|
||||
*/
|
||||
vcol = get_indent() - vcol;
|
||||
curwin->w_virtcol = (colnr_T)((vcol < 0) ? 0 : vcol);
|
||||
|
||||
/*
|
||||
* Advance the cursor until we reach the right screen column.
|
||||
*/
|
||||
vcol = last_vcol = 0;
|
||||
new_cursor_col = -1;
|
||||
ptr = ml_get_curline();
|
||||
while (vcol <= (int)curwin->w_virtcol)
|
||||
{
|
||||
last_vcol = vcol;
|
||||
if (has_mbyte && new_cursor_col >= 0)
|
||||
new_cursor_col += (*mb_ptr2len)(ptr + new_cursor_col);
|
||||
else
|
||||
++new_cursor_col;
|
||||
vcol += lbr_chartabsize(ptr, ptr + new_cursor_col, (colnr_T)vcol);
|
||||
}
|
||||
vcol = last_vcol;
|
||||
|
||||
/*
|
||||
* May need to insert spaces to be able to position the cursor on
|
||||
* the right screen column.
|
||||
*/
|
||||
if (vcol != (int)curwin->w_virtcol)
|
||||
{
|
||||
curwin->w_cursor.col = (colnr_T)new_cursor_col;
|
||||
i = (int)curwin->w_virtcol - vcol;
|
||||
ptr = alloc(i + 1);
|
||||
if (ptr != NULL)
|
||||
{
|
||||
new_cursor_col += i;
|
||||
ptr[i] = NUL;
|
||||
while (--i >= 0)
|
||||
ptr[i] = ' ';
|
||||
ins_str(ptr);
|
||||
vim_free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* When changing the indent while the cursor is in it, reset
|
||||
* Insstart_col to 0.
|
||||
*/
|
||||
insstart_less = MAXCOL;
|
||||
}
|
||||
|
||||
curwin->w_p_list = save_p_list;
|
||||
|
||||
if (new_cursor_col <= 0)
|
||||
curwin->w_cursor.col = 0;
|
||||
else
|
||||
curwin->w_cursor.col = (colnr_T)new_cursor_col;
|
||||
curwin->w_set_curswant = TRUE;
|
||||
changed_cline_bef_curs();
|
||||
|
||||
/*
|
||||
* May have to adjust the start of the insert.
|
||||
*/
|
||||
if (State & INSERT)
|
||||
{
|
||||
if (curwin->w_cursor.lnum == Insstart.lnum && Insstart.col != 0)
|
||||
{
|
||||
if ((int)Insstart.col <= insstart_less)
|
||||
Insstart.col = 0;
|
||||
else
|
||||
Insstart.col -= insstart_less;
|
||||
}
|
||||
if ((int)ai_col <= insstart_less)
|
||||
ai_col = 0;
|
||||
else
|
||||
ai_col -= insstart_less;
|
||||
}
|
||||
|
||||
/*
|
||||
* For REPLACE mode, may have to fix the replace stack, if it's possible.
|
||||
* If the number of characters before the cursor decreased, need to pop a
|
||||
* few characters from the replace stack.
|
||||
* If the number of characters before the cursor increased, need to push a
|
||||
* few NULs onto the replace stack.
|
||||
*/
|
||||
if (REPLACE_NORMAL(State) && start_col >= 0)
|
||||
{
|
||||
while (start_col > (int)curwin->w_cursor.col)
|
||||
{
|
||||
replace_join(0); /* remove a NUL from the replace stack */
|
||||
--start_col;
|
||||
}
|
||||
while (start_col < (int)curwin->w_cursor.col || replaced)
|
||||
{
|
||||
replace_push(NUL);
|
||||
if (replaced)
|
||||
{
|
||||
replace_push(replaced);
|
||||
replaced = NUL;
|
||||
}
|
||||
++start_col;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* For VREPLACE mode, we also have to fix the replace stack. In this case
|
||||
* it is always possible because we backspace over the whole line and then
|
||||
* put it back again the way we wanted it.
|
||||
*/
|
||||
if (State & VREPLACE_FLAG)
|
||||
{
|
||||
/* If orig_line didn't allocate, just return. At least we did the job,
|
||||
* even if you can't backspace. */
|
||||
if (orig_line == NULL)
|
||||
return;
|
||||
|
||||
/* Save new line */
|
||||
new_line = vim_strsave(ml_get_curline());
|
||||
if (new_line == NULL)
|
||||
return;
|
||||
|
||||
/* We only put back the new line up to the cursor */
|
||||
new_line[curwin->w_cursor.col] = NUL;
|
||||
|
||||
/* Put back original line */
|
||||
ml_replace(curwin->w_cursor.lnum, orig_line, FALSE);
|
||||
curwin->w_cursor.col = orig_col;
|
||||
|
||||
/* Backspace from cursor to start of line */
|
||||
backspace_until_column(0);
|
||||
|
||||
/* Insert new stuff into line again */
|
||||
ins_bytes(new_line);
|
||||
|
||||
vim_free(new_line);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Truncate the space at the end of a line. This is to be used only in an
|
||||
* insert mode. It handles fixing the replace stack for REPLACE and VREPLACE
|
||||
@@ -3850,7 +3602,7 @@ replace_pop(void)
|
||||
* Join the top two items on the replace stack. This removes to "off"'th NUL
|
||||
* encountered.
|
||||
*/
|
||||
static void
|
||||
void
|
||||
replace_join(
|
||||
int off) /* offset for which NUL to remove */
|
||||
{
|
||||
@@ -6080,97 +5832,6 @@ ins_ctrl_ey(int tc)
|
||||
return c;
|
||||
}
|
||||
|
||||
#ifdef FEAT_SMARTINDENT
|
||||
/*
|
||||
* Try to do some very smart auto-indenting.
|
||||
* Used when inserting a "normal" character.
|
||||
*/
|
||||
static void
|
||||
ins_try_si(int c)
|
||||
{
|
||||
pos_T *pos, old_pos;
|
||||
char_u *ptr;
|
||||
int i;
|
||||
int temp;
|
||||
|
||||
/*
|
||||
* do some very smart indenting when entering '{' or '}'
|
||||
*/
|
||||
if (((did_si || can_si_back) && c == '{') || (can_si && c == '}'))
|
||||
{
|
||||
/*
|
||||
* for '}' set indent equal to indent of line containing matching '{'
|
||||
*/
|
||||
if (c == '}' && (pos = findmatch(NULL, '{')) != NULL)
|
||||
{
|
||||
old_pos = curwin->w_cursor;
|
||||
/*
|
||||
* If the matching '{' has a ')' immediately before it (ignoring
|
||||
* white-space), then line up with the start of the line
|
||||
* containing the matching '(' if there is one. This handles the
|
||||
* case where an "if (..\n..) {" statement continues over multiple
|
||||
* lines -- webb
|
||||
*/
|
||||
ptr = ml_get(pos->lnum);
|
||||
i = pos->col;
|
||||
if (i > 0) /* skip blanks before '{' */
|
||||
while (--i > 0 && VIM_ISWHITE(ptr[i]))
|
||||
;
|
||||
curwin->w_cursor.lnum = pos->lnum;
|
||||
curwin->w_cursor.col = i;
|
||||
if (ptr[i] == ')' && (pos = findmatch(NULL, '(')) != NULL)
|
||||
curwin->w_cursor = *pos;
|
||||
i = get_indent();
|
||||
curwin->w_cursor = old_pos;
|
||||
if (State & VREPLACE_FLAG)
|
||||
change_indent(INDENT_SET, i, FALSE, NUL, TRUE);
|
||||
else
|
||||
(void)set_indent(i, SIN_CHANGED);
|
||||
}
|
||||
else if (curwin->w_cursor.col > 0)
|
||||
{
|
||||
/*
|
||||
* when inserting '{' after "O" reduce indent, but not
|
||||
* more than indent of previous line
|
||||
*/
|
||||
temp = TRUE;
|
||||
if (c == '{' && can_si_back && curwin->w_cursor.lnum > 1)
|
||||
{
|
||||
old_pos = curwin->w_cursor;
|
||||
i = get_indent();
|
||||
while (curwin->w_cursor.lnum > 1)
|
||||
{
|
||||
ptr = skipwhite(ml_get(--(curwin->w_cursor.lnum)));
|
||||
|
||||
/* ignore empty lines and lines starting with '#'. */
|
||||
if (*ptr != '#' && *ptr != NUL)
|
||||
break;
|
||||
}
|
||||
if (get_indent() >= i)
|
||||
temp = FALSE;
|
||||
curwin->w_cursor = old_pos;
|
||||
}
|
||||
if (temp)
|
||||
shift_line(TRUE, FALSE, 1, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* set indent of '#' always to 0
|
||||
*/
|
||||
if (curwin->w_cursor.col > 0 && can_si && c == '#')
|
||||
{
|
||||
/* remember current indent for next line */
|
||||
old_indent = get_indent();
|
||||
(void)set_indent(0, SIN_CHANGED);
|
||||
}
|
||||
|
||||
/* Adjust ai_col, the char at this position can be deleted. */
|
||||
if (ai_col > curwin->w_cursor.col)
|
||||
ai_col = curwin->w_cursor.col;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Get the value that w_virtcol would have when 'list' is off.
|
||||
* Unless 'cpo' contains the 'L' flag.
|
||||
|
||||
+13
-4
@@ -2914,9 +2914,17 @@ eval_lambda(
|
||||
semsg(_(e_missingparen), "lambda");
|
||||
}
|
||||
clear_tv(rettv);
|
||||
return FAIL;
|
||||
ret = FAIL;
|
||||
}
|
||||
return call_func_rettv(arg, rettv, evaluate, NULL, &base);
|
||||
else
|
||||
ret = call_func_rettv(arg, rettv, evaluate, NULL, &base);
|
||||
|
||||
// Clear the funcref afterwards, so that deleting it while
|
||||
// evaluating the arguments is possible (see test55).
|
||||
if (evaluate)
|
||||
clear_tv(&base);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3518,7 +3526,8 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
|
||||
break;
|
||||
|
||||
/* Special key, e.g.: "\<C-W>" */
|
||||
case '<': extra = trans_special(&p, name, TRUE, TRUE);
|
||||
case '<': extra = trans_special(&p, name, TRUE, TRUE,
|
||||
TRUE, NULL);
|
||||
if (extra != 0)
|
||||
{
|
||||
name += extra;
|
||||
@@ -6438,7 +6447,7 @@ do_string_sub(
|
||||
if (zero_width == regmatch.startp[0])
|
||||
{
|
||||
/* avoid getting stuck on a match with an empty string */
|
||||
i = MB_PTR2LEN(tail);
|
||||
i = mb_ptr2len(tail);
|
||||
mch_memmove((char_u *)ga.ga_data + ga.ga_len, tail,
|
||||
(size_t)i);
|
||||
ga.ga_len += i;
|
||||
|
||||
+2
-67
@@ -51,7 +51,6 @@ static void f_ceil(typval_T *argvars, typval_T *rettv);
|
||||
#endif
|
||||
static void f_changenr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_char2nr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_cindent(typval_T *argvars, typval_T *rettv);
|
||||
static void f_col(typval_T *argvars, typval_T *rettv);
|
||||
static void f_confirm(typval_T *argvars, typval_T *rettv);
|
||||
static void f_copy(typval_T *argvars, typval_T *rettv);
|
||||
@@ -108,7 +107,6 @@ static void f_hlID(typval_T *argvars, typval_T *rettv);
|
||||
static void f_hlexists(typval_T *argvars, typval_T *rettv);
|
||||
static void f_hostname(typval_T *argvars, typval_T *rettv);
|
||||
static void f_iconv(typval_T *argvars, typval_T *rettv);
|
||||
static void f_indent(typval_T *argvars, typval_T *rettv);
|
||||
static void f_index(typval_T *argvars, typval_T *rettv);
|
||||
static void f_input(typval_T *argvars, typval_T *rettv);
|
||||
static void f_inputdialog(typval_T *argvars, typval_T *rettv);
|
||||
@@ -128,7 +126,6 @@ static void f_libcall(typval_T *argvars, typval_T *rettv);
|
||||
static void f_libcallnr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_line(typval_T *argvars, typval_T *rettv);
|
||||
static void f_line2byte(typval_T *argvars, typval_T *rettv);
|
||||
static void f_lispindent(typval_T *argvars, typval_T *rettv);
|
||||
static void f_localtime(typval_T *argvars, typval_T *rettv);
|
||||
#ifdef FEAT_FLOAT
|
||||
static void f_log(typval_T *argvars, typval_T *rettv);
|
||||
@@ -1491,29 +1488,6 @@ f_char2nr(typval_T *argvars, typval_T *rettv)
|
||||
rettv->vval.v_number = tv_get_string(&argvars[0])[0];
|
||||
}
|
||||
|
||||
/*
|
||||
* "cindent(lnum)" function
|
||||
*/
|
||||
static void
|
||||
f_cindent(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
{
|
||||
#ifdef FEAT_CINDENT
|
||||
pos_T pos;
|
||||
linenr_T lnum;
|
||||
|
||||
pos = curwin->w_cursor;
|
||||
lnum = tv_get_lnum(argvars);
|
||||
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
|
||||
{
|
||||
curwin->w_cursor.lnum = lnum;
|
||||
rettv->vval.v_number = get_c_indent();
|
||||
curwin->w_cursor = pos;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
rettv->vval.v_number = -1;
|
||||
}
|
||||
|
||||
win_T *
|
||||
get_optional_window(typval_T *argvars, int idx)
|
||||
{
|
||||
@@ -2213,8 +2187,7 @@ f_expand(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
if (rettv_list_alloc(rettv) != FAIL && result != NULL)
|
||||
list_append_string(rettv->vval.v_list, result, -1);
|
||||
else
|
||||
vim_free(result);
|
||||
vim_free(result);
|
||||
}
|
||||
else
|
||||
rettv->vval.v_string = result;
|
||||
@@ -3961,21 +3934,6 @@ f_iconv(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
vim_free(to);
|
||||
}
|
||||
|
||||
/*
|
||||
* "indent()" function
|
||||
*/
|
||||
static void
|
||||
f_indent(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
linenr_T lnum;
|
||||
|
||||
lnum = tv_get_lnum(argvars);
|
||||
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
|
||||
rettv->vval.v_number = get_indent_lnum(lnum);
|
||||
else
|
||||
rettv->vval.v_number = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* "index()" function
|
||||
*/
|
||||
@@ -4466,29 +4424,6 @@ f_line2byte(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* "lispindent(lnum)" function
|
||||
*/
|
||||
static void
|
||||
f_lispindent(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
{
|
||||
#ifdef FEAT_LISP
|
||||
pos_T pos;
|
||||
linenr_T lnum;
|
||||
|
||||
pos = curwin->w_cursor;
|
||||
lnum = tv_get_lnum(argvars);
|
||||
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
|
||||
{
|
||||
curwin->w_cursor.lnum = lnum;
|
||||
rettv->vval.v_number = get_lisp_indent();
|
||||
curwin->w_cursor = pos;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
rettv->vval.v_number = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* "localtime()" function
|
||||
*/
|
||||
@@ -6478,7 +6413,7 @@ f_setcharsearch(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
}
|
||||
else
|
||||
set_last_csearch(PTR2CHAR(csearch),
|
||||
csearch, MB_PTR2LEN(csearch));
|
||||
csearch, mb_ptr2len(csearch));
|
||||
}
|
||||
|
||||
di = dict_find(d, (char_u *)"forward", -1);
|
||||
|
||||
+6
-3
@@ -757,10 +757,13 @@ ex_let_const(exarg_T *eap, int is_const)
|
||||
if (l != NULL)
|
||||
{
|
||||
rettv_list_set(&rettv, l);
|
||||
op[0] = '=';
|
||||
op[1] = NUL;
|
||||
(void)ex_let_vars(eap->arg, &rettv, FALSE, semicolon, var_count,
|
||||
if (!eap->skip)
|
||||
{
|
||||
op[0] = '=';
|
||||
op[1] = NUL;
|
||||
(void)ex_let_vars(eap->arg, &rettv, FALSE, semicolon, var_count,
|
||||
is_const, op);
|
||||
}
|
||||
clear_tv(&rettv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -655,12 +655,18 @@ f_win_execute(typval_T *argvars, typval_T *rettv)
|
||||
|
||||
if (wp != NULL && tp != NULL)
|
||||
{
|
||||
pos_T curpos = wp->w_cursor;
|
||||
|
||||
if (switch_win_noblock(&save_curwin, &save_curtab, wp, tp, TRUE) == OK)
|
||||
{
|
||||
check_cursor();
|
||||
execute_common(argvars, rettv, 1);
|
||||
}
|
||||
restore_win_noblock(save_curwin, save_curtab, TRUE);
|
||||
|
||||
// Update the status line if the cursor moved.
|
||||
if (win_valid(wp) && !EQUAL_POS(curpos, wp->w_cursor))
|
||||
wp->w_redr_status = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+35
-238
@@ -660,221 +660,6 @@ sortend:
|
||||
emsg(_(e_interr));
|
||||
}
|
||||
|
||||
/*
|
||||
* ":retab".
|
||||
*/
|
||||
void
|
||||
ex_retab(exarg_T *eap)
|
||||
{
|
||||
linenr_T lnum;
|
||||
int got_tab = FALSE;
|
||||
long num_spaces = 0;
|
||||
long num_tabs;
|
||||
long len;
|
||||
long col;
|
||||
long vcol;
|
||||
long start_col = 0; /* For start of white-space string */
|
||||
long start_vcol = 0; /* For start of white-space string */
|
||||
long old_len;
|
||||
char_u *ptr;
|
||||
char_u *new_line = (char_u *)1; /* init to non-NULL */
|
||||
int did_undo; /* called u_save for current line */
|
||||
#ifdef FEAT_VARTABS
|
||||
int *new_vts_array = NULL;
|
||||
char_u *new_ts_str; /* string value of tab argument */
|
||||
#else
|
||||
int temp;
|
||||
int new_ts;
|
||||
#endif
|
||||
int save_list;
|
||||
linenr_T first_line = 0; /* first changed line */
|
||||
linenr_T last_line = 0; /* last changed line */
|
||||
|
||||
save_list = curwin->w_p_list;
|
||||
curwin->w_p_list = 0; /* don't want list mode here */
|
||||
|
||||
#ifdef FEAT_VARTABS
|
||||
new_ts_str = eap->arg;
|
||||
if (!tabstop_set(eap->arg, &new_vts_array))
|
||||
return;
|
||||
while (vim_isdigit(*(eap->arg)) || *(eap->arg) == ',')
|
||||
++(eap->arg);
|
||||
|
||||
// This ensures that either new_vts_array and new_ts_str are freshly
|
||||
// allocated, or new_vts_array points to an existing array and new_ts_str
|
||||
// is null.
|
||||
if (new_vts_array == NULL)
|
||||
{
|
||||
new_vts_array = curbuf->b_p_vts_array;
|
||||
new_ts_str = NULL;
|
||||
}
|
||||
else
|
||||
new_ts_str = vim_strnsave(new_ts_str, eap->arg - new_ts_str);
|
||||
#else
|
||||
new_ts = getdigits(&(eap->arg));
|
||||
if (new_ts < 0)
|
||||
{
|
||||
emsg(_(e_positive));
|
||||
return;
|
||||
}
|
||||
if (new_ts == 0)
|
||||
new_ts = curbuf->b_p_ts;
|
||||
#endif
|
||||
for (lnum = eap->line1; !got_int && lnum <= eap->line2; ++lnum)
|
||||
{
|
||||
ptr = ml_get(lnum);
|
||||
col = 0;
|
||||
vcol = 0;
|
||||
did_undo = FALSE;
|
||||
for (;;)
|
||||
{
|
||||
if (VIM_ISWHITE(ptr[col]))
|
||||
{
|
||||
if (!got_tab && num_spaces == 0)
|
||||
{
|
||||
/* First consecutive white-space */
|
||||
start_vcol = vcol;
|
||||
start_col = col;
|
||||
}
|
||||
if (ptr[col] == ' ')
|
||||
num_spaces++;
|
||||
else
|
||||
got_tab = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (got_tab || (eap->forceit && num_spaces > 1))
|
||||
{
|
||||
/* Retabulate this string of white-space */
|
||||
|
||||
/* len is virtual length of white string */
|
||||
len = num_spaces = vcol - start_vcol;
|
||||
num_tabs = 0;
|
||||
if (!curbuf->b_p_et)
|
||||
{
|
||||
#ifdef FEAT_VARTABS
|
||||
int t, s;
|
||||
|
||||
tabstop_fromto(start_vcol, vcol,
|
||||
curbuf->b_p_ts, new_vts_array, &t, &s);
|
||||
num_tabs = t;
|
||||
num_spaces = s;
|
||||
#else
|
||||
temp = new_ts - (start_vcol % new_ts);
|
||||
if (num_spaces >= temp)
|
||||
{
|
||||
num_spaces -= temp;
|
||||
num_tabs++;
|
||||
}
|
||||
num_tabs += num_spaces / new_ts;
|
||||
num_spaces -= (num_spaces / new_ts) * new_ts;
|
||||
#endif
|
||||
}
|
||||
if (curbuf->b_p_et || got_tab ||
|
||||
(num_spaces + num_tabs < len))
|
||||
{
|
||||
if (did_undo == FALSE)
|
||||
{
|
||||
did_undo = TRUE;
|
||||
if (u_save((linenr_T)(lnum - 1),
|
||||
(linenr_T)(lnum + 1)) == FAIL)
|
||||
{
|
||||
new_line = NULL; /* flag out-of-memory */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* len is actual number of white characters used */
|
||||
len = num_spaces + num_tabs;
|
||||
old_len = (long)STRLEN(ptr);
|
||||
new_line = alloc(old_len - col + start_col + len + 1);
|
||||
if (new_line == NULL)
|
||||
break;
|
||||
if (start_col > 0)
|
||||
mch_memmove(new_line, ptr, (size_t)start_col);
|
||||
mch_memmove(new_line + start_col + len,
|
||||
ptr + col, (size_t)(old_len - col + 1));
|
||||
ptr = new_line + start_col;
|
||||
for (col = 0; col < len; col++)
|
||||
ptr[col] = (col < num_tabs) ? '\t' : ' ';
|
||||
ml_replace(lnum, new_line, FALSE);
|
||||
if (first_line == 0)
|
||||
first_line = lnum;
|
||||
last_line = lnum;
|
||||
ptr = new_line;
|
||||
col = start_col + len;
|
||||
}
|
||||
}
|
||||
got_tab = FALSE;
|
||||
num_spaces = 0;
|
||||
}
|
||||
if (ptr[col] == NUL)
|
||||
break;
|
||||
vcol += chartabsize(ptr + col, (colnr_T)vcol);
|
||||
if (has_mbyte)
|
||||
col += (*mb_ptr2len)(ptr + col);
|
||||
else
|
||||
++col;
|
||||
}
|
||||
if (new_line == NULL) /* out of memory */
|
||||
break;
|
||||
line_breakcheck();
|
||||
}
|
||||
if (got_int)
|
||||
emsg(_(e_interr));
|
||||
|
||||
#ifdef FEAT_VARTABS
|
||||
// If a single value was given then it can be considered equal to
|
||||
// either the value of 'tabstop' or the value of 'vartabstop'.
|
||||
if (tabstop_count(curbuf->b_p_vts_array) == 0
|
||||
&& tabstop_count(new_vts_array) == 1
|
||||
&& curbuf->b_p_ts == tabstop_first(new_vts_array))
|
||||
; /* not changed */
|
||||
else if (tabstop_count(curbuf->b_p_vts_array) > 0
|
||||
&& tabstop_eq(curbuf->b_p_vts_array, new_vts_array))
|
||||
; /* not changed */
|
||||
else
|
||||
redraw_curbuf_later(NOT_VALID);
|
||||
#else
|
||||
if (curbuf->b_p_ts != new_ts)
|
||||
redraw_curbuf_later(NOT_VALID);
|
||||
#endif
|
||||
if (first_line != 0)
|
||||
changed_lines(first_line, 0, last_line + 1, 0L);
|
||||
|
||||
curwin->w_p_list = save_list; /* restore 'list' */
|
||||
|
||||
#ifdef FEAT_VARTABS
|
||||
if (new_ts_str != NULL) /* set the new tabstop */
|
||||
{
|
||||
// If 'vartabstop' is in use or if the value given to retab has more
|
||||
// than one tabstop then update 'vartabstop'.
|
||||
int *old_vts_ary = curbuf->b_p_vts_array;
|
||||
|
||||
if (tabstop_count(old_vts_ary) > 0 || tabstop_count(new_vts_array) > 1)
|
||||
{
|
||||
set_string_option_direct((char_u *)"vts", -1, new_ts_str,
|
||||
OPT_FREE|OPT_LOCAL, 0);
|
||||
curbuf->b_p_vts_array = new_vts_array;
|
||||
vim_free(old_vts_ary);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 'vartabstop' wasn't in use and a single value was given to
|
||||
// retab then update 'tabstop'.
|
||||
curbuf->b_p_ts = tabstop_first(new_vts_array);
|
||||
vim_free(new_vts_array);
|
||||
}
|
||||
vim_free(new_ts_str);
|
||||
}
|
||||
#else
|
||||
curbuf->b_p_ts = new_ts;
|
||||
#endif
|
||||
coladvance(curwin->w_curswant);
|
||||
|
||||
u_clearline();
|
||||
}
|
||||
|
||||
/*
|
||||
* :move command - move lines line1-line2 to line dest
|
||||
*
|
||||
@@ -1778,28 +1563,30 @@ make_filter_cmd(
|
||||
}
|
||||
else
|
||||
{
|
||||
char_u *p;
|
||||
STRCPY(buf, cmd);
|
||||
if (itmp != NULL)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
/*
|
||||
* If there is a pipe, we have to put the '<' in front of it.
|
||||
* Don't do this when 'shellquote' is not empty, otherwise the
|
||||
* redirection would be inside the quotes.
|
||||
*/
|
||||
if (*p_shq == NUL)
|
||||
{
|
||||
p = find_pipe(buf);
|
||||
if (p != NULL)
|
||||
*p = NUL;
|
||||
}
|
||||
STRCAT(buf, " <"); /* " < " causes problems on Amiga */
|
||||
STRCAT(buf, itmp);
|
||||
if (*p_shq == NUL)
|
||||
{
|
||||
p = find_pipe(cmd);
|
||||
if (p != NULL)
|
||||
// If there is a pipe, we have to put the '<' in front of it.
|
||||
// Don't do this when 'shellquote' is not empty, otherwise the
|
||||
// redirection would be inside the quotes.
|
||||
if (*p_shq == NUL)
|
||||
{
|
||||
STRCAT(buf, " "); /* insert a space before the '|' for DOS */
|
||||
STRCAT(buf, p);
|
||||
p = find_pipe(buf);
|
||||
if (p != NULL)
|
||||
*p = NUL;
|
||||
}
|
||||
STRCAT(buf, " <"); // " < " causes problems on Amiga
|
||||
STRCAT(buf, itmp);
|
||||
if (*p_shq == NUL)
|
||||
{
|
||||
p = find_pipe(cmd);
|
||||
if (p != NULL)
|
||||
{
|
||||
STRCAT(buf, " "); // insert a space before the '|' for DOS
|
||||
STRCAT(buf, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5545,12 +5332,22 @@ find_help_tags(
|
||||
if (STRNICMP(arg, "expr-", 5) == 0)
|
||||
{
|
||||
// When the string starting with "expr-" and containing '?' and matches
|
||||
// the table, it is taken literally. Otherwise '?' is recognized as a
|
||||
// wildcard.
|
||||
// the table, it is taken literally (but ~ is escaped). Otherwise '?'
|
||||
// is recognized as a wildcard.
|
||||
for (i = (int)(sizeof(expr_table) / sizeof(char *)); --i >= 0; )
|
||||
if (STRCMP(arg + 5, expr_table[i]) == 0)
|
||||
{
|
||||
STRCPY(d, arg);
|
||||
int si = 0, di = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (arg[si] == '~')
|
||||
d[di++] = '\\';
|
||||
d[di++] = arg[si];
|
||||
if (arg[si] == NUL)
|
||||
break;
|
||||
++si;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+30
-17
@@ -564,6 +564,27 @@ do_exmode(
|
||||
msg_scroll = save_msg_scroll;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the executed command for when 'verbose' is set.
|
||||
* When "lnum" is 0 only print the command.
|
||||
*/
|
||||
static void
|
||||
msg_verbose_cmd(linenr_T lnum, char_u *cmd)
|
||||
{
|
||||
++no_wait_return;
|
||||
verbose_enter_scroll();
|
||||
|
||||
if (lnum == 0)
|
||||
smsg(_("Executing: %s"), cmd);
|
||||
else
|
||||
smsg(_("line %ld: %s"), (long)lnum, cmd);
|
||||
if (msg_silent == 0)
|
||||
msg_puts("\n"); // don't overwrite this
|
||||
|
||||
verbose_leave_scroll();
|
||||
--no_wait_return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Execute a simple command line. Used for translated commands like "*".
|
||||
*/
|
||||
@@ -950,18 +971,7 @@ do_cmdline(
|
||||
}
|
||||
|
||||
if (p_verbose >= 15 && sourcing_name != NULL)
|
||||
{
|
||||
++no_wait_return;
|
||||
verbose_enter_scroll();
|
||||
|
||||
smsg(_("line %ld: %s"),
|
||||
(long)sourcing_lnum, cmdline_copy);
|
||||
if (msg_silent == 0)
|
||||
msg_puts("\n"); /* don't overwrite this */
|
||||
|
||||
verbose_leave_scroll();
|
||||
--no_wait_return;
|
||||
}
|
||||
msg_verbose_cmd(sourcing_lnum, cmdline_copy);
|
||||
|
||||
/*
|
||||
* 2. Execute one '|' separated command.
|
||||
@@ -1672,6 +1682,9 @@ do_one_cmd(
|
||||
if ((*cmdlinep)[0] == '#' && (*cmdlinep)[1] == '!')
|
||||
goto doend;
|
||||
|
||||
if (p_verbose >= 16)
|
||||
msg_verbose_cmd(0, *cmdlinep);
|
||||
|
||||
/*
|
||||
* 1. Skip comment lines and leading white space and colons.
|
||||
* 2. Handle command modifiers.
|
||||
@@ -8550,9 +8563,9 @@ ex_folddo(exarg_T *eap)
|
||||
{
|
||||
linenr_T lnum;
|
||||
|
||||
#ifdef FEAT_CLIPBOARD
|
||||
# ifdef FEAT_CLIPBOARD
|
||||
start_global_changes();
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* First set the marks for all lines closed/open. */
|
||||
for (lnum = eap->line1; lnum <= eap->line2; ++lnum)
|
||||
@@ -8562,9 +8575,9 @@ ex_folddo(exarg_T *eap)
|
||||
/* Execute the command on the marked lines. */
|
||||
global_exe(eap->arg);
|
||||
ml_clearmarked(); /* clear rest of the marks */
|
||||
#ifdef FEAT_CLIPBOARD
|
||||
# ifdef FEAT_CLIPBOARD
|
||||
end_global_changes();
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -8582,7 +8595,7 @@ is_loclist_cmd(int cmdidx)
|
||||
}
|
||||
#endif
|
||||
|
||||
# if defined(FEAT_TIMERS) || defined(PROTO)
|
||||
#if defined(FEAT_TIMERS) || defined(PROTO)
|
||||
int
|
||||
get_pressedreturn(void)
|
||||
{
|
||||
|
||||
+8
-6
@@ -136,11 +136,11 @@ restore_viewstate(viewstate_T *vs)
|
||||
// Struct to store the state of 'incsearch' highlighting.
|
||||
typedef struct {
|
||||
pos_T search_start; // where 'incsearch' starts searching
|
||||
pos_T save_cursor;
|
||||
pos_T save_cursor;
|
||||
viewstate_T init_viewstate;
|
||||
viewstate_T old_viewstate;
|
||||
pos_T match_start;
|
||||
pos_T match_end;
|
||||
pos_T match_start;
|
||||
pos_T match_end;
|
||||
int did_incsearch;
|
||||
int incsearch_postponed;
|
||||
int magic_save;
|
||||
@@ -2790,7 +2790,7 @@ redraw:
|
||||
}
|
||||
else
|
||||
{
|
||||
len = MB_PTR2LEN(p);
|
||||
len = mb_ptr2len(p);
|
||||
msg_outtrans_len(p, len);
|
||||
vcol += ptr2cells(p);
|
||||
p += len;
|
||||
@@ -4164,12 +4164,15 @@ open_cmdwin(void)
|
||||
invalidate_botline();
|
||||
redraw_later(SOME_VALID);
|
||||
|
||||
/* No Ex mode here! */
|
||||
// No Ex mode here!
|
||||
exmode_active = 0;
|
||||
|
||||
State = NORMAL;
|
||||
setmouse();
|
||||
|
||||
// Reset here so it can be set by a CmdWinEnter autocommand.
|
||||
cmdwin_result = 0;
|
||||
|
||||
// Trigger CmdwinEnter autocommands.
|
||||
trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINENTER);
|
||||
if (restart_edit != 0) // autocmd with ":startinsert"
|
||||
@@ -4181,7 +4184,6 @@ open_cmdwin(void)
|
||||
/*
|
||||
* Call the main loop until <CR> or CTRL-C is typed.
|
||||
*/
|
||||
cmdwin_result = 0;
|
||||
main_loop(TRUE, FALSE);
|
||||
|
||||
RedrawingDisabled = i;
|
||||
|
||||
+11
-7
@@ -563,7 +563,11 @@ repeat:
|
||||
}
|
||||
else // :r
|
||||
{
|
||||
if (s > tail) // remove one extension
|
||||
char_u *limit = *fnamep;
|
||||
|
||||
if (limit < tail)
|
||||
limit = tail;
|
||||
if (s > limit) // remove one extension
|
||||
*fnamelen = (int)(s - *fnamep);
|
||||
}
|
||||
*usedlen += 2;
|
||||
@@ -2613,9 +2617,9 @@ vim_fnamencmp(char_u *x, char_u *y, size_t len)
|
||||
&& !(cx == '/' && cy == '\\')
|
||||
&& !(cx == '\\' && cy == '/')))
|
||||
break;
|
||||
len -= MB_PTR2LEN(px);
|
||||
px += MB_PTR2LEN(px);
|
||||
py += MB_PTR2LEN(py);
|
||||
len -= mb_ptr2len(px);
|
||||
px += mb_ptr2len(px);
|
||||
py += mb_ptr2len(py);
|
||||
}
|
||||
if (len == 0)
|
||||
return 0;
|
||||
@@ -3769,14 +3773,14 @@ pathcmp(const char *p, const char *q, int maxlen)
|
||||
: c1 - c2; // no match
|
||||
}
|
||||
|
||||
i += MB_PTR2LEN((char_u *)p + i);
|
||||
j += MB_PTR2LEN((char_u *)q + j);
|
||||
i += mb_ptr2len((char_u *)p + i);
|
||||
j += mb_ptr2len((char_u *)q + j);
|
||||
}
|
||||
if (s == NULL) // "i" or "j" ran into "maxlen"
|
||||
return 0;
|
||||
|
||||
c1 = PTR2CHAR((char_u *)s + i);
|
||||
c2 = PTR2CHAR((char_u *)s + i + MB_PTR2LEN((char_u *)s + i));
|
||||
c2 = PTR2CHAR((char_u *)s + i + mb_ptr2len((char_u *)s + i));
|
||||
// ignore a trailing slash, but not "//" or ":/"
|
||||
if (c2 == NUL
|
||||
&& i > 0
|
||||
|
||||
+2
-2
@@ -1337,8 +1337,8 @@ ff_wc_equal(char_u *s1, char_u *s2)
|
||||
prev2 = prev1;
|
||||
prev1 = c1;
|
||||
|
||||
i += MB_PTR2LEN(s1 + i);
|
||||
j += MB_PTR2LEN(s2 + j);
|
||||
i += mb_ptr2len(s1 + i);
|
||||
j += mb_ptr2len(s2 + j);
|
||||
}
|
||||
return s1[i] == s2[j];
|
||||
}
|
||||
|
||||
+26
-2
@@ -52,7 +52,7 @@ static int typeahead_char = 0; /* typeahead char that's not flushed */
|
||||
*/
|
||||
static int block_redo = FALSE;
|
||||
|
||||
static int KeyNoremap = 0; /* remapping flags */
|
||||
static int KeyNoremap = 0; // remapping flags
|
||||
|
||||
/*
|
||||
* Variables used by vgetorpeek() and flush_buffers().
|
||||
@@ -1768,6 +1768,25 @@ vgetc(void)
|
||||
c = (*mb_ptr2char)(buf);
|
||||
}
|
||||
|
||||
if (!no_reduce_keys)
|
||||
{
|
||||
// A modifier was not used for a mapping, apply it to ASCII
|
||||
// keys. Shift would already have been applied.
|
||||
if ((mod_mask & MOD_MASK_CTRL)
|
||||
&& ((c >= '`' && c <= 0x7f)
|
||||
|| (c >= '@' && c <= '_')))
|
||||
{
|
||||
c &= 0x1f;
|
||||
mod_mask &= ~MOD_MASK_CTRL;
|
||||
}
|
||||
if ((mod_mask & (MOD_MASK_META | MOD_MASK_ALT))
|
||||
&& c >= 0 && c <= 127)
|
||||
{
|
||||
c += 0x80;
|
||||
mod_mask &= ~(MOD_MASK_META|MOD_MASK_ALT);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1791,7 +1810,11 @@ vgetc(void)
|
||||
#endif
|
||||
#ifdef FEAT_TEXT_PROP
|
||||
if (popup_do_filter(c))
|
||||
{
|
||||
if (c == Ctrl_C)
|
||||
got_int = FALSE; // avoid looping
|
||||
c = K_IGNORE;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Need to process the character before we know it's safe to do something
|
||||
@@ -2230,6 +2253,7 @@ handle_mapping(
|
||||
// Skip ":lmap" mappings if keys were mapped.
|
||||
if (mp->m_keys[0] == tb_c1
|
||||
&& (mp->m_mode & local_State)
|
||||
&& !(mp->m_simplified && seenModifyOtherKeys)
|
||||
&& ((mp->m_mode & LANGMAP) == 0 || typebuf.tb_maplen == 0))
|
||||
{
|
||||
#ifdef FEAT_LANGMAP
|
||||
@@ -2263,7 +2287,7 @@ handle_mapping(
|
||||
char_u *p2 = mb_unescape(&p1);
|
||||
|
||||
if (has_mbyte && p2 != NULL
|
||||
&& MB_BYTE2LEN(tb_c1) > MB_PTR2LEN(p2))
|
||||
&& MB_BYTE2LEN(tb_c1) > mb_ptr2len(p2))
|
||||
mlen = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -778,6 +778,13 @@ EXTERN int VIsual_mode INIT(= 'v');
|
||||
EXTERN int redo_VIsual_busy INIT(= FALSE);
|
||||
// TRUE when redoing Visual
|
||||
|
||||
/*
|
||||
* The Visual area is remembered for reselection.
|
||||
*/
|
||||
EXTERN int resel_VIsual_mode INIT(= NUL); // 'v', 'V', or Ctrl-V
|
||||
EXTERN linenr_T resel_VIsual_line_count; // number of lines
|
||||
EXTERN colnr_T resel_VIsual_vcol; // nr of cols or end col
|
||||
|
||||
#ifdef FEAT_MOUSE
|
||||
/*
|
||||
* When pasting text with the middle mouse button in visual mode with
|
||||
@@ -836,6 +843,8 @@ EXTERN int can_si INIT(= FALSE);
|
||||
EXTERN int can_si_back INIT(= FALSE);
|
||||
#endif
|
||||
|
||||
EXTERN int old_indent INIT(= 0); // for ^^D command in insert mode
|
||||
|
||||
EXTERN pos_T saved_cursor // w_cursor before formatting text.
|
||||
#ifdef DO_INIT
|
||||
= {0, 0, 0}
|
||||
@@ -995,10 +1004,16 @@ EXTERN int ex_no_reprint INIT(= FALSE); // no need to print after z or p
|
||||
EXTERN int reg_recording INIT(= 0); // register for recording or zero
|
||||
EXTERN int reg_executing INIT(= 0); // register being executed or zero
|
||||
|
||||
// Set when a modifyOtherKeys sequence was seen, then simplified mappings will
|
||||
// no longer be used.
|
||||
EXTERN int seenModifyOtherKeys INIT(= FALSE);
|
||||
|
||||
EXTERN int no_mapping INIT(= FALSE); // currently no mapping allowed
|
||||
EXTERN int no_zero_mapping INIT(= 0); // mapping zero not allowed
|
||||
EXTERN int allow_keys INIT(= FALSE); // allow key codes when no_mapping
|
||||
// is set
|
||||
EXTERN int no_reduce_keys INIT(= FALSE); // do not apply Ctrl, Shift and Alt
|
||||
// to the key
|
||||
EXTERN int no_u_sync INIT(= 0); // Don't call u_sync()
|
||||
#ifdef FEAT_EVAL
|
||||
EXTERN int u_sync_once INIT(= 0); // Call u_sync() once when evaluating
|
||||
|
||||
+4
-2
@@ -2177,7 +2177,8 @@ gui_mac_unicode_key_event(
|
||||
key_char = simplify_key(key_char, (int *)&vimModifiers);
|
||||
|
||||
/* Interpret META, include SHIFT, etc. */
|
||||
key_char = extract_modifiers(key_char, (int *)&vimModifiers);
|
||||
key_char = extract_modifiers(key_char, (int *)&vimModifiers,
|
||||
TRUE, NULL);
|
||||
if (key_char == CSI)
|
||||
key_char = K_CSI;
|
||||
|
||||
@@ -4782,7 +4783,8 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
|
||||
char_u *p_actext;
|
||||
|
||||
p_actext = menu->actext;
|
||||
key = find_special_key(&p_actext, &modifiers, FALSE, FALSE, FALSE);
|
||||
key = find_special_key(&p_actext, &modifiers, FALSE, FALSE, FALSE,
|
||||
TRUE, NULL);
|
||||
if (*p_actext != 0)
|
||||
key = 0; /* error: trailing text */
|
||||
/* find_special_key() returns a keycode with as many of the
|
||||
|
||||
+1
-1
@@ -850,7 +850,7 @@ _OnSysChar(
|
||||
modifiers &= ~MOD_MASK_SHIFT;
|
||||
|
||||
/* Interpret the ALT key as making the key META, include SHIFT, etc. */
|
||||
ch = extract_modifiers(ch, &modifiers);
|
||||
ch = extract_modifiers(ch, &modifiers, TRUE, NULL);
|
||||
if (ch == CSI)
|
||||
ch = K_CSI;
|
||||
|
||||
|
||||
+3
-2
@@ -1418,7 +1418,8 @@ do_highlight(
|
||||
*/
|
||||
for (p = arg, off = 0; off < 100 - 6 && *p; )
|
||||
{
|
||||
len = trans_special(&p, buf + off, FALSE, FALSE);
|
||||
len = trans_special(&p, buf + off, FALSE, FALSE,
|
||||
TRUE, NULL);
|
||||
if (len > 0) // recognized special char
|
||||
off += len;
|
||||
else // copy as normal char
|
||||
@@ -4393,7 +4394,7 @@ update_search_hl(
|
||||
&& col >= shl->startcol
|
||||
&& col < shl->endcol)
|
||||
{
|
||||
int next_col = col + MB_PTR2LEN(*line + col);
|
||||
int next_col = col + mb_ptr2len(*line + col);
|
||||
|
||||
if (shl->endcol < next_col)
|
||||
shl->endcol = next_col;
|
||||
|
||||
+1
-1
@@ -330,7 +330,7 @@ CVim::SendKeys(BSTR keys)
|
||||
}
|
||||
|
||||
/* Translate key codes like <Esc> */
|
||||
str = replace_termcodes((char_u *)buffer, &ptr, FALSE, TRUE, FALSE);
|
||||
str = replace_termcodes((char_u *)buffer, &ptr, REPTERM_DO_LT, NULL);
|
||||
|
||||
/* If ptr was set, then a new buffer was allocated,
|
||||
* so we can free the old one.
|
||||
|
||||
+1681
-4451
File diff suppressed because it is too large
Load Diff
@@ -200,6 +200,7 @@ size_t vterm_output_get_buffer_remaining(const VTerm *vt);
|
||||
|
||||
size_t vterm_output_read(VTerm *vt, char *buffer, size_t len);
|
||||
|
||||
int vterm_is_modify_other_keys(VTerm *vt);
|
||||
void vterm_keyboard_unichar(VTerm *vt, uint32_t c, VTermModifier mod);
|
||||
void vterm_keyboard_key(VTerm *vt, VTermKey key, VTermModifier mod);
|
||||
|
||||
|
||||
@@ -4,10 +4,21 @@
|
||||
|
||||
#include "utf8.h"
|
||||
|
||||
int vterm_is_modify_other_keys(VTerm *vt)
|
||||
{
|
||||
return vt->state->mode.modify_other_keys;
|
||||
}
|
||||
|
||||
|
||||
void vterm_keyboard_unichar(VTerm *vt, uint32_t c, VTermModifier mod)
|
||||
{
|
||||
int needs_CSIu;
|
||||
|
||||
if (vt->state->mode.modify_other_keys && mod != 0) {
|
||||
vterm_push_output_sprintf_ctrl(vt, C1_CSI, "27;%d;%d~", mod+1, c);
|
||||
return;
|
||||
}
|
||||
|
||||
// The shift modifier is never important for Unicode characters
|
||||
// apart from Space
|
||||
if(c != ' ')
|
||||
|
||||
@@ -1334,6 +1334,11 @@ static int on_csi(const char *leader, const long args[], int argcount, const cha
|
||||
vterm_state_setpen(state, args, argcount);
|
||||
break;
|
||||
|
||||
case LEADER('>', 0x6d): // xterm resource modifyOtherKeys
|
||||
if (argcount == 2 && args[0] == 4)
|
||||
state->mode.modify_other_keys = args[1] == 2;
|
||||
break;
|
||||
|
||||
case 0x6e: // DSR - ECMA-48 8.3.35
|
||||
case LEADER('?', 0x6e): // DECDSR
|
||||
val = CSI_ARG_OR(args[0], 0);
|
||||
|
||||
@@ -124,6 +124,7 @@ struct VTermState
|
||||
unsigned int leftrightmargin:1;
|
||||
unsigned int bracketpaste:1;
|
||||
unsigned int report_focus:1;
|
||||
unsigned int modify_other_keys:1;
|
||||
} mode;
|
||||
|
||||
VTermEncodingInstance encoding[4], encoding_utf8;
|
||||
|
||||
+2
-4
@@ -229,12 +229,10 @@
|
||||
* MB_COPY_CHAR(f, t): copy one char from "f" to "t" and advance the pointers.
|
||||
* PTR2CHAR(): get character from pointer.
|
||||
*/
|
||||
/* Get the length of the character p points to, including composing chars */
|
||||
#define MB_PTR2LEN(p) (has_mbyte ? (*mb_ptr2len)(p) : 1)
|
||||
/* Advance multi-byte pointer, skip over composing chars. */
|
||||
#define MB_PTR_ADV(p) p += has_mbyte ? (*mb_ptr2len)(p) : 1
|
||||
#define MB_PTR_ADV(p) p += (*mb_ptr2len)(p)
|
||||
/* Advance multi-byte pointer, do not skip over composing chars. */
|
||||
#define MB_CPTR_ADV(p) p += enc_utf8 ? utf_ptr2len(p) : has_mbyte ? (*mb_ptr2len)(p) : 1
|
||||
#define MB_CPTR_ADV(p) p += enc_utf8 ? utf_ptr2len(p) : (*mb_ptr2len)(p)
|
||||
/* Backup multi-byte pointer. Only use with "p" > "s" ! */
|
||||
#define MB_PTR_BACK(s, p) p -= has_mbyte ? ((*mb_head_off)(s, p - 1) + 1) : 1
|
||||
/* get length of multi-byte char, not including composing chars */
|
||||
|
||||
+1
-1
@@ -4429,7 +4429,7 @@ server_to_input_buf(char_u *str)
|
||||
* <lt> sequence is recognised - needed for a real backslash.
|
||||
*/
|
||||
p_cpo = (char_u *)"Bk";
|
||||
str = replace_termcodes((char_u *)str, &ptr, FALSE, TRUE, FALSE);
|
||||
str = replace_termcodes((char_u *)str, &ptr, REPTERM_DO_LT, NULL);
|
||||
p_cpo = cpo_save;
|
||||
|
||||
if (*ptr != NUL) /* trailing CTRL-V results in nothing */
|
||||
|
||||
@@ -256,18 +256,15 @@ do_map(
|
||||
char_u *p;
|
||||
int n;
|
||||
int len = 0; // init for GCC
|
||||
char_u *newstr;
|
||||
int hasarg;
|
||||
int haskey;
|
||||
int did_it = FALSE;
|
||||
int did_local = FALSE;
|
||||
int round;
|
||||
int do_print;
|
||||
int keyround;
|
||||
char_u *keys_buf = NULL;
|
||||
char_u *alt_keys_buf = NULL;
|
||||
char_u *arg_buf = NULL;
|
||||
int retval = 0;
|
||||
int do_backslash;
|
||||
int hash;
|
||||
int new_hash;
|
||||
mapblock_T **abbr_table;
|
||||
mapblock_T **map_table;
|
||||
int unique = FALSE;
|
||||
@@ -277,6 +274,7 @@ do_map(
|
||||
#ifdef FEAT_EVAL
|
||||
int expr = FALSE;
|
||||
#endif
|
||||
int did_simplify = FALSE;
|
||||
int noremap;
|
||||
char_u *orig_rhs;
|
||||
|
||||
@@ -375,6 +373,7 @@ do_map(
|
||||
rhs = p;
|
||||
hasarg = (*rhs != NUL);
|
||||
haskey = (*keys != NUL);
|
||||
do_print = !haskey || (maptype != 1 && !hasarg);
|
||||
|
||||
// check for :unmap without argument
|
||||
if (maptype == 1 && !haskey)
|
||||
@@ -389,373 +388,434 @@ do_map(
|
||||
// replace_termcodes() may move the result to allocated memory, which
|
||||
// needs to be freed later (*keys_buf and *arg_buf).
|
||||
// replace_termcodes() also removes CTRL-Vs and sometimes backslashes.
|
||||
// If something like <C-H> is simplified to 0x08 then mark it as simplified
|
||||
// and also add a n entry with a modifier, which will work when
|
||||
// modifyOtherKeys is working.
|
||||
if (haskey)
|
||||
keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE, special);
|
||||
{
|
||||
char_u *new_keys;
|
||||
int flags = REPTERM_FROM_PART | REPTERM_DO_LT;
|
||||
|
||||
if (special)
|
||||
flags |= REPTERM_SPECIAL;
|
||||
new_keys = replace_termcodes(keys, &keys_buf, flags, &did_simplify);
|
||||
if (did_simplify)
|
||||
(void)replace_termcodes(keys, &alt_keys_buf,
|
||||
flags | REPTERM_NO_SIMPLIFY, NULL);
|
||||
keys = new_keys;
|
||||
}
|
||||
orig_rhs = rhs;
|
||||
if (hasarg)
|
||||
{
|
||||
if (STRICMP(rhs, "<nop>") == 0) // "<Nop>" means nothing
|
||||
rhs = (char_u *)"";
|
||||
else
|
||||
rhs = replace_termcodes(rhs, &arg_buf, FALSE, TRUE, special);
|
||||
rhs = replace_termcodes(rhs, &arg_buf,
|
||||
REPTERM_DO_LT | (special ? REPTERM_SPECIAL : 0), NULL);
|
||||
}
|
||||
|
||||
// check arguments and translate function keys
|
||||
if (haskey)
|
||||
/*
|
||||
* The following is done twice if we have two versions of keys:
|
||||
* "alt_keys_buf" is not NULL.
|
||||
*/
|
||||
for (keyround = 1; keyround <= 2; ++keyround)
|
||||
{
|
||||
len = (int)STRLEN(keys);
|
||||
if (len > MAXMAPLEN) // maximum length of MAXMAPLEN chars
|
||||
int did_it = FALSE;
|
||||
int did_local = FALSE;
|
||||
int round;
|
||||
int hash;
|
||||
int new_hash;
|
||||
|
||||
if (keyround == 2)
|
||||
{
|
||||
retval = 1;
|
||||
goto theend;
|
||||
if (alt_keys_buf == NULL)
|
||||
break;
|
||||
keys = alt_keys_buf;
|
||||
}
|
||||
else if (alt_keys_buf != NULL && do_print)
|
||||
// when printing always use the not-simplified map
|
||||
keys = alt_keys_buf;
|
||||
|
||||
if (abbrev && maptype != 1)
|
||||
// check arguments and translate function keys
|
||||
if (haskey)
|
||||
{
|
||||
// If an abbreviation ends in a keyword character, the
|
||||
// rest must be all keyword-char or all non-keyword-char.
|
||||
// Otherwise we won't be able to find the start of it in a
|
||||
// vi-compatible way.
|
||||
if (has_mbyte)
|
||||
len = (int)STRLEN(keys);
|
||||
if (len > MAXMAPLEN) // maximum length of MAXMAPLEN chars
|
||||
{
|
||||
int first, last;
|
||||
int same = -1;
|
||||
|
||||
first = vim_iswordp(keys);
|
||||
last = first;
|
||||
p = keys + (*mb_ptr2len)(keys);
|
||||
n = 1;
|
||||
while (p < keys + len)
|
||||
{
|
||||
++n; // nr of (multi-byte) chars
|
||||
last = vim_iswordp(p); // type of last char
|
||||
if (same == -1 && last != first)
|
||||
same = n - 1; // count of same char type
|
||||
p += (*mb_ptr2len)(p);
|
||||
}
|
||||
if (last && n > 2 && same >= 0 && same < n - 1)
|
||||
{
|
||||
retval = 1;
|
||||
goto theend;
|
||||
}
|
||||
retval = 1;
|
||||
goto theend;
|
||||
}
|
||||
else if (vim_iswordc(keys[len - 1])) // ends in keyword char
|
||||
|
||||
if (abbrev && maptype != 1)
|
||||
{
|
||||
// If an abbreviation ends in a keyword character, the
|
||||
// rest must be all keyword-char or all non-keyword-char.
|
||||
// Otherwise we won't be able to find the start of it in a
|
||||
// vi-compatible way.
|
||||
if (has_mbyte)
|
||||
{
|
||||
int first, last;
|
||||
int same = -1;
|
||||
|
||||
first = vim_iswordp(keys);
|
||||
last = first;
|
||||
p = keys + (*mb_ptr2len)(keys);
|
||||
n = 1;
|
||||
while (p < keys + len)
|
||||
{
|
||||
++n; // nr of (multi-byte) chars
|
||||
last = vim_iswordp(p); // type of last char
|
||||
if (same == -1 && last != first)
|
||||
same = n - 1; // count of same char type
|
||||
p += (*mb_ptr2len)(p);
|
||||
}
|
||||
if (last && n > 2 && same >= 0 && same < n - 1)
|
||||
{
|
||||
retval = 1;
|
||||
goto theend;
|
||||
}
|
||||
}
|
||||
else if (vim_iswordc(keys[len - 1]))
|
||||
// ends in keyword char
|
||||
for (n = 0; n < len - 2; ++n)
|
||||
if (vim_iswordc(keys[n]) != vim_iswordc(keys[len - 2]))
|
||||
{
|
||||
retval = 1;
|
||||
goto theend;
|
||||
}
|
||||
// An abbreviation cannot contain white space.
|
||||
for (n = 0; n < len; ++n)
|
||||
if (VIM_ISWHITE(keys[n]))
|
||||
{
|
||||
retval = 1;
|
||||
goto theend;
|
||||
}
|
||||
// An abbreviation cannot contain white space.
|
||||
for (n = 0; n < len; ++n)
|
||||
if (VIM_ISWHITE(keys[n]))
|
||||
{
|
||||
retval = 1;
|
||||
goto theend;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (haskey && hasarg && abbrev) // if we will add an abbreviation
|
||||
no_abbr = FALSE; // reset flag that indicates there are
|
||||
if (haskey && hasarg && abbrev) // if we will add an abbreviation
|
||||
no_abbr = FALSE; // reset flag that indicates there are
|
||||
// no abbreviations
|
||||
|
||||
if (!haskey || (maptype != 1 && !hasarg))
|
||||
msg_start();
|
||||
if (do_print)
|
||||
msg_start();
|
||||
|
||||
// Check if a new local mapping wasn't already defined globally.
|
||||
if (map_table == curbuf->b_maphash && haskey && hasarg && maptype != 1)
|
||||
{
|
||||
// need to loop over all global hash lists
|
||||
for (hash = 0; hash < 256 && !got_int; ++hash)
|
||||
// Check if a new local mapping wasn't already defined globally.
|
||||
if (map_table == curbuf->b_maphash && haskey && hasarg && maptype != 1)
|
||||
{
|
||||
if (abbrev)
|
||||
// need to loop over all global hash lists
|
||||
for (hash = 0; hash < 256 && !got_int; ++hash)
|
||||
{
|
||||
if (hash != 0) // there is only one abbreviation list
|
||||
break;
|
||||
mp = first_abbr;
|
||||
}
|
||||
else
|
||||
mp = maphash[hash];
|
||||
for ( ; mp != NULL && !got_int; mp = mp->m_next)
|
||||
{
|
||||
// check entries with the same mode
|
||||
if ((mp->m_mode & mode) != 0
|
||||
&& mp->m_keylen == len
|
||||
&& unique
|
||||
&& STRNCMP(mp->m_keys, keys, (size_t)len) == 0)
|
||||
if (abbrev)
|
||||
{
|
||||
if (abbrev)
|
||||
semsg(_("E224: global abbreviation already exists for %s"),
|
||||
mp->m_keys);
|
||||
else
|
||||
semsg(_("E225: global mapping already exists for %s"),
|
||||
mp->m_keys);
|
||||
retval = 5;
|
||||
goto theend;
|
||||
if (hash != 0) // there is only one abbreviation list
|
||||
break;
|
||||
mp = first_abbr;
|
||||
}
|
||||
else
|
||||
mp = maphash[hash];
|
||||
for ( ; mp != NULL && !got_int; mp = mp->m_next)
|
||||
{
|
||||
// check entries with the same mode
|
||||
if ((mp->m_mode & mode) != 0
|
||||
&& mp->m_keylen == len
|
||||
&& unique
|
||||
&& STRNCMP(mp->m_keys, keys, (size_t)len) == 0)
|
||||
{
|
||||
if (abbrev)
|
||||
semsg(_(
|
||||
"E224: global abbreviation already exists for %s"),
|
||||
mp->m_keys);
|
||||
else
|
||||
semsg(_(
|
||||
"E225: global mapping already exists for %s"),
|
||||
mp->m_keys);
|
||||
retval = 5;
|
||||
goto theend;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// When listing global mappings, also list buffer-local ones here.
|
||||
if (map_table != curbuf->b_maphash && !hasarg && maptype != 1)
|
||||
{
|
||||
// need to loop over all global hash lists
|
||||
for (hash = 0; hash < 256 && !got_int; ++hash)
|
||||
// When listing global mappings, also list buffer-local ones here.
|
||||
if (map_table != curbuf->b_maphash && !hasarg && maptype != 1)
|
||||
{
|
||||
if (abbrev)
|
||||
// need to loop over all global hash lists
|
||||
for (hash = 0; hash < 256 && !got_int; ++hash)
|
||||
{
|
||||
if (hash != 0) // there is only one abbreviation list
|
||||
break;
|
||||
mp = curbuf->b_first_abbr;
|
||||
}
|
||||
else
|
||||
mp = curbuf->b_maphash[hash];
|
||||
for ( ; mp != NULL && !got_int; mp = mp->m_next)
|
||||
{
|
||||
// check entries with the same mode
|
||||
if ((mp->m_mode & mode) != 0)
|
||||
if (abbrev)
|
||||
{
|
||||
if (!haskey) // show all entries
|
||||
if (hash != 0) // there is only one abbreviation list
|
||||
break;
|
||||
mp = curbuf->b_first_abbr;
|
||||
}
|
||||
else
|
||||
mp = curbuf->b_maphash[hash];
|
||||
for ( ; mp != NULL && !got_int; mp = mp->m_next)
|
||||
{
|
||||
// check entries with the same mode
|
||||
if (!mp->m_simplified && (mp->m_mode & mode) != 0)
|
||||
{
|
||||
showmap(mp, TRUE);
|
||||
did_local = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
n = mp->m_keylen;
|
||||
if (STRNCMP(mp->m_keys, keys,
|
||||
(size_t)(n < len ? n : len)) == 0)
|
||||
if (!haskey) // show all entries
|
||||
{
|
||||
showmap(mp, TRUE);
|
||||
did_local = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
n = mp->m_keylen;
|
||||
if (STRNCMP(mp->m_keys, keys,
|
||||
(size_t)(n < len ? n : len)) == 0)
|
||||
{
|
||||
showmap(mp, TRUE);
|
||||
did_local = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find an entry in the maphash[] list that matches.
|
||||
// For :unmap we may loop two times: once to try to unmap an entry with a
|
||||
// matching 'from' part, a second time, if the first fails, to unmap an
|
||||
// entry with a matching 'to' part. This was done to allow ":ab foo bar"
|
||||
// to be unmapped by typing ":unab foo", where "foo" will be replaced by
|
||||
// "bar" because of the abbreviation.
|
||||
for (round = 0; (round == 0 || maptype == 1) && round <= 1
|
||||
&& !did_it && !got_int; ++round)
|
||||
{
|
||||
// need to loop over all hash lists
|
||||
for (hash = 0; hash < 256 && !got_int; ++hash)
|
||||
// Find an entry in the maphash[] list that matches.
|
||||
// For :unmap we may loop two times: once to try to unmap an entry with
|
||||
// a matching 'from' part, a second time, if the first fails, to unmap
|
||||
// an entry with a matching 'to' part. This was done to allow ":ab foo
|
||||
// bar" to be unmapped by typing ":unab foo", where "foo" will be
|
||||
// replaced by "bar" because of the abbreviation.
|
||||
for (round = 0; (round == 0 || maptype == 1) && round <= 1
|
||||
&& !did_it && !got_int; ++round)
|
||||
{
|
||||
if (abbrev)
|
||||
{
|
||||
if (hash > 0) // there is only one abbreviation list
|
||||
break;
|
||||
mpp = abbr_table;
|
||||
}
|
||||
else
|
||||
mpp = &(map_table[hash]);
|
||||
for (mp = *mpp; mp != NULL && !got_int; mp = *mpp)
|
||||
// need to loop over all hash lists
|
||||
for (hash = 0; hash < 256 && !got_int; ++hash)
|
||||
{
|
||||
if (abbrev)
|
||||
{
|
||||
if (hash > 0) // there is only one abbreviation list
|
||||
break;
|
||||
mpp = abbr_table;
|
||||
}
|
||||
else
|
||||
mpp = &(map_table[hash]);
|
||||
for (mp = *mpp; mp != NULL && !got_int; mp = *mpp)
|
||||
{
|
||||
|
||||
if (!(mp->m_mode & mode)) // skip entries with wrong mode
|
||||
{
|
||||
mpp = &(mp->m_next);
|
||||
continue;
|
||||
}
|
||||
if (!haskey) // show all entries
|
||||
{
|
||||
showmap(mp, map_table != maphash);
|
||||
did_it = TRUE;
|
||||
}
|
||||
else // do we have a match?
|
||||
{
|
||||
if (round) // second round: Try unmap "rhs" string
|
||||
if ((mp->m_mode & mode) == 0)
|
||||
{
|
||||
n = (int)STRLEN(mp->m_str);
|
||||
p = mp->m_str;
|
||||
// skip entries with wrong mode
|
||||
mpp = &(mp->m_next);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (!haskey) // show all entries
|
||||
{
|
||||
n = mp->m_keylen;
|
||||
p = mp->m_keys;
|
||||
}
|
||||
if (STRNCMP(p, keys, (size_t)(n < len ? n : len)) == 0)
|
||||
{
|
||||
if (maptype == 1) // delete entry
|
||||
{
|
||||
// Only accept a full match. For abbreviations we
|
||||
// ignore trailing space when matching with the
|
||||
// "lhs", since an abbreviation can't have
|
||||
// trailing space.
|
||||
if (n != len && (!abbrev || round || n > len
|
||||
|| *skipwhite(keys + n) != NUL))
|
||||
{
|
||||
mpp = &(mp->m_next);
|
||||
continue;
|
||||
}
|
||||
// We reset the indicated mode bits. If nothing is
|
||||
// left the entry is deleted below.
|
||||
mp->m_mode &= ~mode;
|
||||
did_it = TRUE; // remember we did something
|
||||
}
|
||||
else if (!hasarg) // show matching entry
|
||||
if (!mp->m_simplified)
|
||||
{
|
||||
showmap(mp, map_table != maphash);
|
||||
did_it = TRUE;
|
||||
}
|
||||
else if (n != len) // new entry is ambiguous
|
||||
}
|
||||
else // do we have a match?
|
||||
{
|
||||
if (round) // second round: Try unmap "rhs" string
|
||||
{
|
||||
mpp = &(mp->m_next);
|
||||
continue;
|
||||
n = (int)STRLEN(mp->m_str);
|
||||
p = mp->m_str;
|
||||
}
|
||||
else if (unique)
|
||||
else
|
||||
{
|
||||
if (abbrev)
|
||||
semsg(_("E226: abbreviation already exists for %s"),
|
||||
p);
|
||||
else
|
||||
semsg(_("E227: mapping already exists for %s"), p);
|
||||
retval = 5;
|
||||
goto theend;
|
||||
n = mp->m_keylen;
|
||||
p = mp->m_keys;
|
||||
}
|
||||
else // new rhs for existing entry
|
||||
if (STRNCMP(p, keys, (size_t)(n < len ? n : len)) == 0)
|
||||
{
|
||||
mp->m_mode &= ~mode; // remove mode bits
|
||||
if (mp->m_mode == 0 && !did_it) // reuse entry
|
||||
if (maptype == 1)
|
||||
{
|
||||
newstr = vim_strsave(rhs);
|
||||
if (newstr == NULL)
|
||||
// Delete entry.
|
||||
// Only accept a full match. For abbreviations
|
||||
// we ignore trailing space when matching with
|
||||
// the "lhs", since an abbreviation can't have
|
||||
// trailing space.
|
||||
if (n != len && (!abbrev || round || n > len
|
||||
|| *skipwhite(keys + n) != NUL))
|
||||
{
|
||||
retval = 4; // no mem
|
||||
goto theend;
|
||||
mpp = &(mp->m_next);
|
||||
continue;
|
||||
}
|
||||
vim_free(mp->m_str);
|
||||
mp->m_str = newstr;
|
||||
vim_free(mp->m_orig_str);
|
||||
mp->m_orig_str = vim_strsave(orig_rhs);
|
||||
mp->m_noremap = noremap;
|
||||
mp->m_nowait = nowait;
|
||||
mp->m_silent = silent;
|
||||
mp->m_mode = mode;
|
||||
// We reset the indicated mode bits. If nothing
|
||||
// is left the entry is deleted below.
|
||||
mp->m_mode &= ~mode;
|
||||
did_it = TRUE; // remember we did something
|
||||
}
|
||||
else if (!hasarg) // show matching entry
|
||||
{
|
||||
if (!mp->m_simplified)
|
||||
{
|
||||
showmap(mp, map_table != maphash);
|
||||
did_it = TRUE;
|
||||
}
|
||||
}
|
||||
else if (n != len) // new entry is ambiguous
|
||||
{
|
||||
mpp = &(mp->m_next);
|
||||
continue;
|
||||
}
|
||||
else if (unique)
|
||||
{
|
||||
if (abbrev)
|
||||
semsg(_(
|
||||
"E226: abbreviation already exists for %s"),
|
||||
p);
|
||||
else
|
||||
semsg(_(
|
||||
"E227: mapping already exists for %s"),
|
||||
p);
|
||||
retval = 5;
|
||||
goto theend;
|
||||
}
|
||||
else
|
||||
{
|
||||
// new rhs for existing entry
|
||||
mp->m_mode &= ~mode; // remove mode bits
|
||||
if (mp->m_mode == 0 && !did_it) // reuse entry
|
||||
{
|
||||
char_u *newstr = vim_strsave(rhs);
|
||||
|
||||
if (newstr == NULL)
|
||||
{
|
||||
retval = 4; // no mem
|
||||
goto theend;
|
||||
}
|
||||
vim_free(mp->m_str);
|
||||
mp->m_str = newstr;
|
||||
vim_free(mp->m_orig_str);
|
||||
mp->m_orig_str = vim_strsave(orig_rhs);
|
||||
mp->m_noremap = noremap;
|
||||
mp->m_nowait = nowait;
|
||||
mp->m_silent = silent;
|
||||
mp->m_mode = mode;
|
||||
mp->m_simplified =
|
||||
did_simplify && keyround == 1;
|
||||
#ifdef FEAT_EVAL
|
||||
mp->m_expr = expr;
|
||||
mp->m_script_ctx = current_sctx;
|
||||
mp->m_script_ctx.sc_lnum += sourcing_lnum;
|
||||
mp->m_expr = expr;
|
||||
mp->m_script_ctx = current_sctx;
|
||||
mp->m_script_ctx.sc_lnum += sourcing_lnum;
|
||||
#endif
|
||||
did_it = TRUE;
|
||||
did_it = TRUE;
|
||||
}
|
||||
}
|
||||
if (mp->m_mode == 0) // entry can be deleted
|
||||
{
|
||||
map_free(mpp);
|
||||
continue; // continue with *mpp
|
||||
}
|
||||
|
||||
// May need to put this entry into another hash
|
||||
// list.
|
||||
new_hash = MAP_HASH(mp->m_mode, mp->m_keys[0]);
|
||||
if (!abbrev && new_hash != hash)
|
||||
{
|
||||
*mpp = mp->m_next;
|
||||
mp->m_next = map_table[new_hash];
|
||||
map_table[new_hash] = mp;
|
||||
|
||||
continue; // continue with *mpp
|
||||
}
|
||||
}
|
||||
if (mp->m_mode == 0) // entry can be deleted
|
||||
{
|
||||
map_free(mpp);
|
||||
continue; // continue with *mpp
|
||||
}
|
||||
|
||||
// May need to put this entry into another hash list.
|
||||
new_hash = MAP_HASH(mp->m_mode, mp->m_keys[0]);
|
||||
if (!abbrev && new_hash != hash)
|
||||
{
|
||||
*mpp = mp->m_next;
|
||||
mp->m_next = map_table[new_hash];
|
||||
map_table[new_hash] = mp;
|
||||
|
||||
continue; // continue with *mpp
|
||||
}
|
||||
}
|
||||
mpp = &(mp->m_next);
|
||||
}
|
||||
mpp = &(mp->m_next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (maptype == 1) // delete entry
|
||||
{
|
||||
if (!did_it)
|
||||
retval = 2; // no match
|
||||
else if (*keys == Ctrl_C)
|
||||
if (maptype == 1)
|
||||
{
|
||||
// delete entry
|
||||
if (!did_it)
|
||||
retval = 2; // no match
|
||||
else if (*keys == Ctrl_C)
|
||||
{
|
||||
// If CTRL-C has been unmapped, reuse it for Interrupting.
|
||||
if (map_table == curbuf->b_maphash)
|
||||
curbuf->b_mapped_ctrl_c &= ~mode;
|
||||
else
|
||||
mapped_ctrl_c &= ~mode;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!haskey || !hasarg)
|
||||
{
|
||||
// print entries
|
||||
if (!did_it && !did_local)
|
||||
{
|
||||
if (abbrev)
|
||||
msg(_("No abbreviation found"));
|
||||
else
|
||||
msg(_("No mapping found"));
|
||||
}
|
||||
goto theend; // listing finished
|
||||
}
|
||||
|
||||
if (did_it)
|
||||
continue; // have added the new entry already
|
||||
|
||||
// Get here when adding a new entry to the maphash[] list or abbrlist.
|
||||
mp = ALLOC_ONE(mapblock_T);
|
||||
if (mp == NULL)
|
||||
{
|
||||
retval = 4; // no mem
|
||||
goto theend;
|
||||
}
|
||||
|
||||
// If CTRL-C has been mapped, don't always use it for Interrupting.
|
||||
if (*keys == Ctrl_C)
|
||||
{
|
||||
// If CTRL-C has been unmapped, reuse it for Interrupting.
|
||||
if (map_table == curbuf->b_maphash)
|
||||
curbuf->b_mapped_ctrl_c &= ~mode;
|
||||
curbuf->b_mapped_ctrl_c |= mode;
|
||||
else
|
||||
mapped_ctrl_c &= ~mode;
|
||||
mapped_ctrl_c |= mode;
|
||||
}
|
||||
goto theend;
|
||||
}
|
||||
|
||||
if (!haskey || !hasarg) // print entries
|
||||
{
|
||||
if (!did_it && !did_local)
|
||||
mp->m_keys = vim_strsave(keys);
|
||||
mp->m_str = vim_strsave(rhs);
|
||||
mp->m_orig_str = vim_strsave(orig_rhs);
|
||||
if (mp->m_keys == NULL || mp->m_str == NULL)
|
||||
{
|
||||
if (abbrev)
|
||||
msg(_("No abbreviation found"));
|
||||
else
|
||||
msg(_("No mapping found"));
|
||||
vim_free(mp->m_keys);
|
||||
vim_free(mp->m_str);
|
||||
vim_free(mp->m_orig_str);
|
||||
vim_free(mp);
|
||||
retval = 4; // no mem
|
||||
goto theend;
|
||||
}
|
||||
goto theend; // listing finished
|
||||
}
|
||||
|
||||
if (did_it) // have added the new entry already
|
||||
goto theend;
|
||||
|
||||
// Get here when adding a new entry to the maphash[] list or abbrlist.
|
||||
mp = ALLOC_ONE(mapblock_T);
|
||||
if (mp == NULL)
|
||||
{
|
||||
retval = 4; // no mem
|
||||
goto theend;
|
||||
}
|
||||
|
||||
// If CTRL-C has been mapped, don't always use it for Interrupting.
|
||||
if (*keys == Ctrl_C)
|
||||
{
|
||||
if (map_table == curbuf->b_maphash)
|
||||
curbuf->b_mapped_ctrl_c |= mode;
|
||||
else
|
||||
mapped_ctrl_c |= mode;
|
||||
}
|
||||
|
||||
mp->m_keys = vim_strsave(keys);
|
||||
mp->m_str = vim_strsave(rhs);
|
||||
mp->m_orig_str = vim_strsave(orig_rhs);
|
||||
if (mp->m_keys == NULL || mp->m_str == NULL)
|
||||
{
|
||||
vim_free(mp->m_keys);
|
||||
vim_free(mp->m_str);
|
||||
vim_free(mp->m_orig_str);
|
||||
vim_free(mp);
|
||||
retval = 4; // no mem
|
||||
goto theend;
|
||||
}
|
||||
mp->m_keylen = (int)STRLEN(mp->m_keys);
|
||||
mp->m_noremap = noremap;
|
||||
mp->m_nowait = nowait;
|
||||
mp->m_silent = silent;
|
||||
mp->m_mode = mode;
|
||||
mp->m_keylen = (int)STRLEN(mp->m_keys);
|
||||
mp->m_noremap = noremap;
|
||||
mp->m_nowait = nowait;
|
||||
mp->m_silent = silent;
|
||||
mp->m_mode = mode;
|
||||
mp->m_simplified = did_simplify && keyround == 1;
|
||||
#ifdef FEAT_EVAL
|
||||
mp->m_expr = expr;
|
||||
mp->m_script_ctx = current_sctx;
|
||||
mp->m_script_ctx.sc_lnum += sourcing_lnum;
|
||||
mp->m_expr = expr;
|
||||
mp->m_script_ctx = current_sctx;
|
||||
mp->m_script_ctx.sc_lnum += sourcing_lnum;
|
||||
#endif
|
||||
|
||||
// add the new entry in front of the abbrlist or maphash[] list
|
||||
if (abbrev)
|
||||
{
|
||||
mp->m_next = *abbr_table;
|
||||
*abbr_table = mp;
|
||||
}
|
||||
else
|
||||
{
|
||||
n = MAP_HASH(mp->m_mode, mp->m_keys[0]);
|
||||
mp->m_next = map_table[n];
|
||||
map_table[n] = mp;
|
||||
// add the new entry in front of the abbrlist or maphash[] list
|
||||
if (abbrev)
|
||||
{
|
||||
mp->m_next = *abbr_table;
|
||||
*abbr_table = mp;
|
||||
}
|
||||
else
|
||||
{
|
||||
n = MAP_HASH(mp->m_mode, mp->m_keys[0]);
|
||||
mp->m_next = map_table[n];
|
||||
map_table[n] = mp;
|
||||
}
|
||||
}
|
||||
|
||||
theend:
|
||||
vim_free(keys_buf);
|
||||
vim_free(alt_keys_buf);
|
||||
vim_free(arg_buf);
|
||||
return retval;
|
||||
}
|
||||
@@ -934,7 +994,7 @@ map_to_exists(char_u *str, char_u *modechars, int abbr)
|
||||
char_u *buf;
|
||||
int retval;
|
||||
|
||||
rhs = replace_termcodes(str, &buf, FALSE, TRUE, FALSE);
|
||||
rhs = replace_termcodes(str, &buf, REPTERM_DO_LT, NULL);
|
||||
|
||||
retval = map_to_exists_mode(rhs, mode_str2flags(modechars), abbr);
|
||||
vim_free(buf);
|
||||
@@ -2036,7 +2096,8 @@ get_maparg(typval_T *argvars, typval_T *rettv, int exact)
|
||||
|
||||
mode = get_map_mode(&which, 0);
|
||||
|
||||
keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE, FALSE);
|
||||
keys = replace_termcodes(keys, &keys_buf,
|
||||
REPTERM_FROM_PART | REPTERM_DO_LT, NULL);
|
||||
rhs = check_map(keys, mode, exact, FALSE, abbr, &mp, &buffer_local);
|
||||
vim_free(keys_buf);
|
||||
|
||||
|
||||
+2
-1
@@ -373,7 +373,8 @@ ex_menu(
|
||||
else if (modes & MENU_TIP_MODE)
|
||||
map_buf = NULL; /* Menu tips are plain text. */
|
||||
else
|
||||
map_to = replace_termcodes(map_to, &map_buf, FALSE, TRUE, special);
|
||||
map_to = replace_termcodes(map_to, &map_buf,
|
||||
REPTERM_DO_LT | (special ? REPTERM_SPECIAL : 0), NULL);
|
||||
menuarg.modes = modes;
|
||||
#ifdef FEAT_TOOLBAR
|
||||
menuarg.iconfile = icon;
|
||||
|
||||
+90
-37
@@ -356,34 +356,61 @@ int vim_snprintf(char *str, size_t str_m, const char *fmt, ...);
|
||||
int
|
||||
smsg(const char *s, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
if (IObuff == NULL)
|
||||
{
|
||||
// Very early in initialisation and already something wrong, just
|
||||
// give the raw message so the user at least gets a hint.
|
||||
return msg((char *)s);
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list arglist;
|
||||
|
||||
va_start(arglist, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
||||
va_end(arglist);
|
||||
return msg((char *)IObuff);
|
||||
va_start(arglist, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
||||
va_end(arglist);
|
||||
return msg((char *)IObuff);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
smsg_attr(int attr, const char *s, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
if (IObuff == NULL)
|
||||
{
|
||||
// Very early in initialisation and already something wrong, just
|
||||
// give the raw message so the user at least gets a hint.
|
||||
return msg_attr((char *)s, attr);
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list arglist;
|
||||
|
||||
va_start(arglist, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
||||
va_end(arglist);
|
||||
return msg_attr((char *)IObuff, attr);
|
||||
va_start(arglist, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
||||
va_end(arglist);
|
||||
return msg_attr((char *)IObuff, attr);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
smsg_attr_keep(int attr, const char *s, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
if (IObuff == NULL)
|
||||
{
|
||||
// Very early in initialisation and already something wrong, just
|
||||
// give the raw message so the user at least gets a hint.
|
||||
return msg_attr_keep((char *)s, attr, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list arglist;
|
||||
|
||||
va_start(arglist, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
||||
va_end(arglist);
|
||||
return msg_attr_keep((char *)IObuff, attr, TRUE);
|
||||
va_start(arglist, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
||||
va_end(arglist);
|
||||
return msg_attr_keep((char *)IObuff, attr, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -723,17 +750,26 @@ emsg(char *s)
|
||||
int
|
||||
semsg(const char *s, ...)
|
||||
{
|
||||
/* Skip this if not giving error messages at the moment. */
|
||||
// Skip this if not giving error messages at the moment.
|
||||
if (!emsg_not_now())
|
||||
{
|
||||
va_list ap;
|
||||
if (IObuff == NULL)
|
||||
{
|
||||
// Very early in initialisation and already something wrong, just
|
||||
// give the raw message so the user at least gets a hint.
|
||||
return emsg_core((char_u *)s);
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, ap);
|
||||
va_end(ap);
|
||||
return emsg_core(IObuff);
|
||||
va_start(ap, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, ap);
|
||||
va_end(ap);
|
||||
return emsg_core(IObuff);
|
||||
}
|
||||
}
|
||||
return TRUE; /* no error messages at the moment */
|
||||
return TRUE; // no error messages at the moment
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -764,12 +800,21 @@ siemsg(const char *s, ...)
|
||||
{
|
||||
if (!emsg_not_now())
|
||||
{
|
||||
va_list ap;
|
||||
if (IObuff == NULL)
|
||||
{
|
||||
// Very early in initialisation and already something wrong, just
|
||||
// give the raw message so the user at least gets a hint.
|
||||
emsg_core((char_u *)s);
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, ap);
|
||||
va_end(ap);
|
||||
emsg_core(IObuff);
|
||||
va_start(ap, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, ap);
|
||||
va_end(ap);
|
||||
emsg_core(IObuff);
|
||||
}
|
||||
}
|
||||
# ifdef ABORT_ON_INTERNAL_ERROR
|
||||
abort();
|
||||
@@ -1985,15 +2030,14 @@ msg_puts_attr_len(char *str, int maxlen, int attr)
|
||||
attr &= ~MSG_HIST;
|
||||
}
|
||||
|
||||
/*
|
||||
* When writing something to the screen after it has scrolled, requires a
|
||||
* wait-return prompt later. Needed when scrolling, resetting
|
||||
* need_wait_return after some prompt, and then outputting something
|
||||
* without scrolling
|
||||
*/
|
||||
if (msg_scrolled != 0 && !msg_scrolled_ign)
|
||||
// When writing something to the screen after it has scrolled, requires a
|
||||
// wait-return prompt later. Needed when scrolling, resetting
|
||||
// need_wait_return after some prompt, and then outputting something
|
||||
// without scrolling
|
||||
// Not needed when only using CR to move the cursor.
|
||||
if (msg_scrolled != 0 && !msg_scrolled_ign && STRCMP(str, "\r") != 0)
|
||||
need_wait_return = TRUE;
|
||||
msg_didany = TRUE; /* remember that something was outputted */
|
||||
msg_didany = TRUE; // remember that something was outputted
|
||||
|
||||
/*
|
||||
* If there is no valid screen, use fprintf so we can see error messages.
|
||||
@@ -3512,8 +3556,17 @@ give_warning(char_u *message, int hl)
|
||||
void
|
||||
give_warning2(char_u *message, char_u *a1, int hl)
|
||||
{
|
||||
vim_snprintf((char *)IObuff, IOSIZE, (char *)message, a1);
|
||||
give_warning(IObuff, hl);
|
||||
if (IObuff == NULL)
|
||||
{
|
||||
// Very early in initialisation and already something wrong, just give
|
||||
// the raw message so the user at least gets a hint.
|
||||
give_warning((char_u *)message, hl);
|
||||
}
|
||||
else
|
||||
{
|
||||
vim_snprintf((char *)IObuff, IOSIZE, (char *)message, a1);
|
||||
give_warning(IObuff, hl);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
-556
@@ -24,542 +24,6 @@
|
||||
// All user names (for ~user completion as done by shell).
|
||||
static garray_T ga_users;
|
||||
|
||||
/*
|
||||
* Count the size (in window cells) of the indent in the current line.
|
||||
*/
|
||||
int
|
||||
get_indent(void)
|
||||
{
|
||||
#ifdef FEAT_VARTABS
|
||||
return get_indent_str_vtab(ml_get_curline(), (int)curbuf->b_p_ts,
|
||||
curbuf->b_p_vts_array, FALSE);
|
||||
#else
|
||||
return get_indent_str(ml_get_curline(), (int)curbuf->b_p_ts, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Count the size (in window cells) of the indent in line "lnum".
|
||||
*/
|
||||
int
|
||||
get_indent_lnum(linenr_T lnum)
|
||||
{
|
||||
#ifdef FEAT_VARTABS
|
||||
return get_indent_str_vtab(ml_get(lnum), (int)curbuf->b_p_ts,
|
||||
curbuf->b_p_vts_array, FALSE);
|
||||
#else
|
||||
return get_indent_str(ml_get(lnum), (int)curbuf->b_p_ts, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(FEAT_FOLDING) || defined(PROTO)
|
||||
/*
|
||||
* Count the size (in window cells) of the indent in line "lnum" of buffer
|
||||
* "buf".
|
||||
*/
|
||||
int
|
||||
get_indent_buf(buf_T *buf, linenr_T lnum)
|
||||
{
|
||||
#ifdef FEAT_VARTABS
|
||||
return get_indent_str_vtab(ml_get_buf(buf, lnum, FALSE),
|
||||
(int)curbuf->b_p_ts, buf->b_p_vts_array, FALSE);
|
||||
#else
|
||||
return get_indent_str(ml_get_buf(buf, lnum, FALSE), (int)buf->b_p_ts, FALSE);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* count the size (in window cells) of the indent in line "ptr", with
|
||||
* 'tabstop' at "ts"
|
||||
*/
|
||||
int
|
||||
get_indent_str(
|
||||
char_u *ptr,
|
||||
int ts,
|
||||
int list) /* if TRUE, count only screen size for tabs */
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for ( ; *ptr; ++ptr)
|
||||
{
|
||||
if (*ptr == TAB)
|
||||
{
|
||||
if (!list || lcs_tab1) /* count a tab for what it is worth */
|
||||
count += ts - (count % ts);
|
||||
else
|
||||
/* In list mode, when tab is not set, count screen char width
|
||||
* for Tab, displays: ^I */
|
||||
count += ptr2cells(ptr);
|
||||
}
|
||||
else if (*ptr == ' ')
|
||||
++count; /* count a space for one */
|
||||
else
|
||||
break;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
#ifdef FEAT_VARTABS
|
||||
/*
|
||||
* Count the size (in window cells) of the indent in line "ptr", using
|
||||
* variable tabstops.
|
||||
* if "list" is TRUE, count only screen size for tabs.
|
||||
*/
|
||||
int
|
||||
get_indent_str_vtab(char_u *ptr, int ts, int *vts, int list)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for ( ; *ptr; ++ptr)
|
||||
{
|
||||
if (*ptr == TAB) /* count a tab for what it is worth */
|
||||
{
|
||||
if (!list || lcs_tab1)
|
||||
count += tabstop_padding(count, ts, vts);
|
||||
else
|
||||
/* In list mode, when tab is not set, count screen char width
|
||||
* for Tab, displays: ^I */
|
||||
count += ptr2cells(ptr);
|
||||
}
|
||||
else if (*ptr == ' ')
|
||||
++count; /* count a space for one */
|
||||
else
|
||||
break;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set the indent of the current line.
|
||||
* Leaves the cursor on the first non-blank in the line.
|
||||
* Caller must take care of undo.
|
||||
* "flags":
|
||||
* SIN_CHANGED: call changed_bytes() if the line was changed.
|
||||
* SIN_INSERT: insert the indent in front of the line.
|
||||
* SIN_UNDO: save line for undo before changing it.
|
||||
* Returns TRUE if the line was changed.
|
||||
*/
|
||||
int
|
||||
set_indent(
|
||||
int size, /* measured in spaces */
|
||||
int flags)
|
||||
{
|
||||
char_u *p;
|
||||
char_u *newline;
|
||||
char_u *oldline;
|
||||
char_u *s;
|
||||
int todo;
|
||||
int ind_len; /* measured in characters */
|
||||
int line_len;
|
||||
int doit = FALSE;
|
||||
int ind_done = 0; /* measured in spaces */
|
||||
#ifdef FEAT_VARTABS
|
||||
int ind_col = 0;
|
||||
#endif
|
||||
int tab_pad;
|
||||
int retval = FALSE;
|
||||
int orig_char_len = -1; /* number of initial whitespace chars when
|
||||
'et' and 'pi' are both set */
|
||||
|
||||
/*
|
||||
* First check if there is anything to do and compute the number of
|
||||
* characters needed for the indent.
|
||||
*/
|
||||
todo = size;
|
||||
ind_len = 0;
|
||||
p = oldline = ml_get_curline();
|
||||
|
||||
/* Calculate the buffer size for the new indent, and check to see if it
|
||||
* isn't already set */
|
||||
|
||||
/* if 'expandtab' isn't set: use TABs; if both 'expandtab' and
|
||||
* 'preserveindent' are set count the number of characters at the
|
||||
* beginning of the line to be copied */
|
||||
if (!curbuf->b_p_et || (!(flags & SIN_INSERT) && curbuf->b_p_pi))
|
||||
{
|
||||
/* If 'preserveindent' is set then reuse as much as possible of
|
||||
* the existing indent structure for the new indent */
|
||||
if (!(flags & SIN_INSERT) && curbuf->b_p_pi)
|
||||
{
|
||||
ind_done = 0;
|
||||
|
||||
/* count as many characters as we can use */
|
||||
while (todo > 0 && VIM_ISWHITE(*p))
|
||||
{
|
||||
if (*p == TAB)
|
||||
{
|
||||
#ifdef FEAT_VARTABS
|
||||
tab_pad = tabstop_padding(ind_done, curbuf->b_p_ts,
|
||||
curbuf->b_p_vts_array);
|
||||
#else
|
||||
tab_pad = (int)curbuf->b_p_ts
|
||||
- (ind_done % (int)curbuf->b_p_ts);
|
||||
#endif
|
||||
/* stop if this tab will overshoot the target */
|
||||
if (todo < tab_pad)
|
||||
break;
|
||||
todo -= tab_pad;
|
||||
++ind_len;
|
||||
ind_done += tab_pad;
|
||||
}
|
||||
else
|
||||
{
|
||||
--todo;
|
||||
++ind_len;
|
||||
++ind_done;
|
||||
}
|
||||
++p;
|
||||
}
|
||||
|
||||
#ifdef FEAT_VARTABS
|
||||
/* These diverge from this point. */
|
||||
ind_col = ind_done;
|
||||
#endif
|
||||
/* Set initial number of whitespace chars to copy if we are
|
||||
* preserving indent but expandtab is set */
|
||||
if (curbuf->b_p_et)
|
||||
orig_char_len = ind_len;
|
||||
|
||||
/* Fill to next tabstop with a tab, if possible */
|
||||
#ifdef FEAT_VARTABS
|
||||
tab_pad = tabstop_padding(ind_done, curbuf->b_p_ts,
|
||||
curbuf->b_p_vts_array);
|
||||
#else
|
||||
tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts);
|
||||
#endif
|
||||
if (todo >= tab_pad && orig_char_len == -1)
|
||||
{
|
||||
doit = TRUE;
|
||||
todo -= tab_pad;
|
||||
++ind_len;
|
||||
/* ind_done += tab_pad; */
|
||||
#ifdef FEAT_VARTABS
|
||||
ind_col += tab_pad;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* count tabs required for indent */
|
||||
#ifdef FEAT_VARTABS
|
||||
for (;;)
|
||||
{
|
||||
tab_pad = tabstop_padding(ind_col, curbuf->b_p_ts,
|
||||
curbuf->b_p_vts_array);
|
||||
if (todo < tab_pad)
|
||||
break;
|
||||
if (*p != TAB)
|
||||
doit = TRUE;
|
||||
else
|
||||
++p;
|
||||
todo -= tab_pad;
|
||||
++ind_len;
|
||||
ind_col += tab_pad;
|
||||
}
|
||||
#else
|
||||
while (todo >= (int)curbuf->b_p_ts)
|
||||
{
|
||||
if (*p != TAB)
|
||||
doit = TRUE;
|
||||
else
|
||||
++p;
|
||||
todo -= (int)curbuf->b_p_ts;
|
||||
++ind_len;
|
||||
/* ind_done += (int)curbuf->b_p_ts; */
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/* count spaces required for indent */
|
||||
while (todo > 0)
|
||||
{
|
||||
if (*p != ' ')
|
||||
doit = TRUE;
|
||||
else
|
||||
++p;
|
||||
--todo;
|
||||
++ind_len;
|
||||
/* ++ind_done; */
|
||||
}
|
||||
|
||||
/* Return if the indent is OK already. */
|
||||
if (!doit && !VIM_ISWHITE(*p) && !(flags & SIN_INSERT))
|
||||
return FALSE;
|
||||
|
||||
/* Allocate memory for the new line. */
|
||||
if (flags & SIN_INSERT)
|
||||
p = oldline;
|
||||
else
|
||||
p = skipwhite(p);
|
||||
line_len = (int)STRLEN(p) + 1;
|
||||
|
||||
/* If 'preserveindent' and 'expandtab' are both set keep the original
|
||||
* characters and allocate accordingly. We will fill the rest with spaces
|
||||
* after the if (!curbuf->b_p_et) below. */
|
||||
if (orig_char_len != -1)
|
||||
{
|
||||
newline = alloc(orig_char_len + size - ind_done + line_len);
|
||||
if (newline == NULL)
|
||||
return FALSE;
|
||||
todo = size - ind_done;
|
||||
ind_len = orig_char_len + todo; /* Set total length of indent in
|
||||
* characters, which may have been
|
||||
* undercounted until now */
|
||||
p = oldline;
|
||||
s = newline;
|
||||
while (orig_char_len > 0)
|
||||
{
|
||||
*s++ = *p++;
|
||||
orig_char_len--;
|
||||
}
|
||||
|
||||
/* Skip over any additional white space (useful when newindent is less
|
||||
* than old) */
|
||||
while (VIM_ISWHITE(*p))
|
||||
++p;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
todo = size;
|
||||
newline = alloc(ind_len + line_len);
|
||||
if (newline == NULL)
|
||||
return FALSE;
|
||||
s = newline;
|
||||
}
|
||||
|
||||
/* Put the characters in the new line. */
|
||||
/* if 'expandtab' isn't set: use TABs */
|
||||
if (!curbuf->b_p_et)
|
||||
{
|
||||
/* If 'preserveindent' is set then reuse as much as possible of
|
||||
* the existing indent structure for the new indent */
|
||||
if (!(flags & SIN_INSERT) && curbuf->b_p_pi)
|
||||
{
|
||||
p = oldline;
|
||||
ind_done = 0;
|
||||
|
||||
while (todo > 0 && VIM_ISWHITE(*p))
|
||||
{
|
||||
if (*p == TAB)
|
||||
{
|
||||
#ifdef FEAT_VARTABS
|
||||
tab_pad = tabstop_padding(ind_done, curbuf->b_p_ts,
|
||||
curbuf->b_p_vts_array);
|
||||
#else
|
||||
tab_pad = (int)curbuf->b_p_ts
|
||||
- (ind_done % (int)curbuf->b_p_ts);
|
||||
#endif
|
||||
/* stop if this tab will overshoot the target */
|
||||
if (todo < tab_pad)
|
||||
break;
|
||||
todo -= tab_pad;
|
||||
ind_done += tab_pad;
|
||||
}
|
||||
else
|
||||
{
|
||||
--todo;
|
||||
++ind_done;
|
||||
}
|
||||
*s++ = *p++;
|
||||
}
|
||||
|
||||
/* Fill to next tabstop with a tab, if possible */
|
||||
#ifdef FEAT_VARTABS
|
||||
tab_pad = tabstop_padding(ind_done, curbuf->b_p_ts,
|
||||
curbuf->b_p_vts_array);
|
||||
#else
|
||||
tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts);
|
||||
#endif
|
||||
if (todo >= tab_pad)
|
||||
{
|
||||
*s++ = TAB;
|
||||
todo -= tab_pad;
|
||||
#ifdef FEAT_VARTABS
|
||||
ind_done += tab_pad;
|
||||
#endif
|
||||
}
|
||||
|
||||
p = skipwhite(p);
|
||||
}
|
||||
|
||||
#ifdef FEAT_VARTABS
|
||||
for (;;)
|
||||
{
|
||||
tab_pad = tabstop_padding(ind_done, curbuf->b_p_ts,
|
||||
curbuf->b_p_vts_array);
|
||||
if (todo < tab_pad)
|
||||
break;
|
||||
*s++ = TAB;
|
||||
todo -= tab_pad;
|
||||
ind_done += tab_pad;
|
||||
}
|
||||
#else
|
||||
while (todo >= (int)curbuf->b_p_ts)
|
||||
{
|
||||
*s++ = TAB;
|
||||
todo -= (int)curbuf->b_p_ts;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
while (todo > 0)
|
||||
{
|
||||
*s++ = ' ';
|
||||
--todo;
|
||||
}
|
||||
mch_memmove(s, p, (size_t)line_len);
|
||||
|
||||
// Replace the line (unless undo fails).
|
||||
if (!(flags & SIN_UNDO) || u_savesub(curwin->w_cursor.lnum) == OK)
|
||||
{
|
||||
ml_replace(curwin->w_cursor.lnum, newline, FALSE);
|
||||
if (flags & SIN_CHANGED)
|
||||
changed_bytes(curwin->w_cursor.lnum, 0);
|
||||
|
||||
// Correct saved cursor position if it is in this line.
|
||||
if (saved_cursor.lnum == curwin->w_cursor.lnum)
|
||||
{
|
||||
if (saved_cursor.col >= (colnr_T)(p - oldline))
|
||||
// cursor was after the indent, adjust for the number of
|
||||
// bytes added/removed
|
||||
saved_cursor.col += ind_len - (colnr_T)(p - oldline);
|
||||
else if (saved_cursor.col >= (colnr_T)(s - newline))
|
||||
// cursor was in the indent, and is now after it, put it back
|
||||
// at the start of the indent (replacing spaces with TAB)
|
||||
saved_cursor.col = (colnr_T)(s - newline);
|
||||
}
|
||||
#ifdef FEAT_TEXT_PROP
|
||||
{
|
||||
int added = ind_len - (colnr_T)(p - oldline);
|
||||
|
||||
// When increasing indent this behaves like spaces were inserted at
|
||||
// the old indent, when decreasing indent it behaves like spaces
|
||||
// were deleted at the new indent.
|
||||
adjust_prop_columns(curwin->w_cursor.lnum,
|
||||
(colnr_T)(added > 0 ? (p - oldline) : ind_len), added, 0);
|
||||
}
|
||||
#endif
|
||||
retval = TRUE;
|
||||
}
|
||||
else
|
||||
vim_free(newline);
|
||||
|
||||
curwin->w_cursor.col = ind_len;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the indent of the current line after a number. Return -1 if no
|
||||
* number was found. Used for 'n' in 'formatoptions': numbered list.
|
||||
* Since a pattern is used it can actually handle more than numbers.
|
||||
*/
|
||||
int
|
||||
get_number_indent(linenr_T lnum)
|
||||
{
|
||||
colnr_T col;
|
||||
pos_T pos;
|
||||
|
||||
regmatch_T regmatch;
|
||||
int lead_len = 0; /* length of comment leader */
|
||||
|
||||
if (lnum > curbuf->b_ml.ml_line_count)
|
||||
return -1;
|
||||
pos.lnum = 0;
|
||||
|
||||
/* In format_lines() (i.e. not insert mode), fo+=q is needed too... */
|
||||
if ((State & INSERT) || has_format_option(FO_Q_COMS))
|
||||
lead_len = get_leader_len(ml_get(lnum), NULL, FALSE, TRUE);
|
||||
|
||||
regmatch.regprog = vim_regcomp(curbuf->b_p_flp, RE_MAGIC);
|
||||
if (regmatch.regprog != NULL)
|
||||
{
|
||||
regmatch.rm_ic = FALSE;
|
||||
|
||||
/* vim_regexec() expects a pointer to a line. This lets us
|
||||
* start matching for the flp beyond any comment leader... */
|
||||
if (vim_regexec(®match, ml_get(lnum) + lead_len, (colnr_T)0))
|
||||
{
|
||||
pos.lnum = lnum;
|
||||
pos.col = (colnr_T)(*regmatch.endp - ml_get(lnum));
|
||||
pos.coladd = 0;
|
||||
}
|
||||
vim_regfree(regmatch.regprog);
|
||||
}
|
||||
|
||||
if (pos.lnum == 0 || *ml_get_pos(&pos) == NUL)
|
||||
return -1;
|
||||
getvcol(curwin, &pos, &col, NULL, NULL);
|
||||
return (int)col;
|
||||
}
|
||||
|
||||
#if defined(FEAT_LINEBREAK) || defined(PROTO)
|
||||
/*
|
||||
* Return appropriate space number for breakindent, taking influencing
|
||||
* parameters into account. Window must be specified, since it is not
|
||||
* necessarily always the current one.
|
||||
*/
|
||||
int
|
||||
get_breakindent_win(
|
||||
win_T *wp,
|
||||
char_u *line) /* start of the line */
|
||||
{
|
||||
static int prev_indent = 0; /* cached indent value */
|
||||
static long prev_ts = 0L; /* cached tabstop value */
|
||||
static char_u *prev_line = NULL; /* cached pointer to line */
|
||||
static varnumber_T prev_tick = 0; /* changedtick of cached value */
|
||||
#ifdef FEAT_VARTABS
|
||||
static int *prev_vts = NULL; /* cached vartabs values */
|
||||
#endif
|
||||
int bri = 0;
|
||||
/* window width minus window margin space, i.e. what rests for text */
|
||||
const int eff_wwidth = wp->w_width
|
||||
- ((wp->w_p_nu || wp->w_p_rnu)
|
||||
&& (vim_strchr(p_cpo, CPO_NUMCOL) == NULL)
|
||||
? number_width(wp) + 1 : 0);
|
||||
|
||||
/* used cached indent, unless pointer or 'tabstop' changed */
|
||||
if (prev_line != line || prev_ts != wp->w_buffer->b_p_ts
|
||||
|| prev_tick != CHANGEDTICK(wp->w_buffer)
|
||||
#ifdef FEAT_VARTABS
|
||||
|| prev_vts != wp->w_buffer->b_p_vts_array
|
||||
#endif
|
||||
)
|
||||
{
|
||||
prev_line = line;
|
||||
prev_ts = wp->w_buffer->b_p_ts;
|
||||
prev_tick = CHANGEDTICK(wp->w_buffer);
|
||||
#ifdef FEAT_VARTABS
|
||||
prev_vts = wp->w_buffer->b_p_vts_array;
|
||||
prev_indent = get_indent_str_vtab(line,
|
||||
(int)wp->w_buffer->b_p_ts,
|
||||
wp->w_buffer->b_p_vts_array, wp->w_p_list);
|
||||
#else
|
||||
prev_indent = get_indent_str(line,
|
||||
(int)wp->w_buffer->b_p_ts, wp->w_p_list);
|
||||
#endif
|
||||
}
|
||||
bri = prev_indent + wp->w_p_brishift;
|
||||
|
||||
/* indent minus the length of the showbreak string */
|
||||
if (wp->w_p_brisbr)
|
||||
bri -= vim_strsize(p_sbr);
|
||||
|
||||
/* Add offset for number column, if 'n' is in 'cpoptions' */
|
||||
bri += win_col_off2(wp);
|
||||
|
||||
/* never indent past left window margin */
|
||||
if (bri < 0)
|
||||
bri = 0;
|
||||
/* always leave at least bri_min characters on the left,
|
||||
* if text width is sufficient */
|
||||
else if (bri > eff_wwidth - wp->w_p_brimin)
|
||||
bri = (eff_wwidth - wp->w_p_brimin < 0)
|
||||
? 0 : eff_wwidth - wp->w_p_brimin;
|
||||
|
||||
return bri;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* get_leader_len() returns the length in bytes of the prefix of the given
|
||||
* string which introduces a comment. If this string is not a comment then
|
||||
@@ -1075,26 +539,6 @@ pchar_cursor(int c)
|
||||
+ curwin->w_cursor.col) = c;
|
||||
}
|
||||
|
||||
/*
|
||||
* When extra == 0: Return TRUE if the cursor is before or on the first
|
||||
* non-blank in the line.
|
||||
* When extra == 1: Return TRUE if the cursor is before the first non-blank in
|
||||
* the line.
|
||||
*/
|
||||
int
|
||||
inindent(int extra)
|
||||
{
|
||||
char_u *ptr;
|
||||
colnr_T col;
|
||||
|
||||
for (col = 0, ptr = ml_get_curline(); VIM_ISWHITE(*ptr); ++col)
|
||||
++ptr;
|
||||
if (col >= curwin->w_cursor.col + extra)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip to next part of an option argument: Skip space and comma.
|
||||
*/
|
||||
|
||||
+46
-23
@@ -119,10 +119,11 @@ getvpos(pos_T *pos, colnr_T wcol)
|
||||
static int
|
||||
coladvance2(
|
||||
pos_T *pos,
|
||||
int addspaces, /* change the text to achieve our goal? */
|
||||
int finetune, /* change char offset for the exact column */
|
||||
colnr_T wcol) /* column to move to */
|
||||
int addspaces, // change the text to achieve our goal?
|
||||
int finetune, // change char offset for the exact column
|
||||
colnr_T wcol_arg) // column to move to (can be negative)
|
||||
{
|
||||
colnr_T wcol = wcol_arg;
|
||||
int idx;
|
||||
char_u *ptr;
|
||||
char_u *line;
|
||||
@@ -136,7 +137,7 @@ coladvance2(
|
||||
one_more = (State & INSERT)
|
||||
|| restart_edit != NUL
|
||||
|| (VIsual_active && *p_sel != 'o')
|
||||
|| ((ve_flags & VE_ONEMORE) && wcol < MAXCOL) ;
|
||||
|| ((ve_flags & VE_ONEMORE) && wcol < MAXCOL);
|
||||
line = ml_get_buf(curbuf, pos->lnum, FALSE);
|
||||
|
||||
if (wcol >= MAXCOL)
|
||||
@@ -206,6 +207,7 @@ coladvance2(
|
||||
|
||||
if (virtual_active()
|
||||
&& addspaces
|
||||
&& wcol >= 0
|
||||
&& ((col != wcol && col != wcol + 1) || csize > 1))
|
||||
{
|
||||
/* 'virtualedit' is set: The difference between wcol and col is
|
||||
@@ -305,7 +307,7 @@ coladvance2(
|
||||
if (has_mbyte)
|
||||
mb_adjustpos(curbuf, pos);
|
||||
|
||||
if (col < wcol)
|
||||
if (wcol < 0 || col < wcol)
|
||||
return FAIL;
|
||||
return OK;
|
||||
}
|
||||
@@ -2701,12 +2703,15 @@ trans_special(
|
||||
char_u **srcp,
|
||||
char_u *dst,
|
||||
int keycode, // prefer key code, e.g. K_DEL instead of DEL
|
||||
int in_string) // TRUE when inside a double quoted string
|
||||
int in_string, // TRUE when inside a double quoted string
|
||||
int simplify, // simplify <C-H> and <A-x>
|
||||
int *did_simplify) // found <C-H> or <A-x>
|
||||
{
|
||||
int modifiers = 0;
|
||||
int key;
|
||||
|
||||
key = find_special_key(srcp, &modifiers, keycode, FALSE, in_string);
|
||||
key = find_special_key(srcp, &modifiers, keycode, FALSE, in_string,
|
||||
simplify, did_simplify);
|
||||
if (key == 0)
|
||||
return 0;
|
||||
|
||||
@@ -2758,9 +2763,11 @@ special_to_buf(int key, int modifiers, int keycode, char_u *dst)
|
||||
find_special_key(
|
||||
char_u **srcp,
|
||||
int *modp,
|
||||
int keycode, /* prefer key code, e.g. K_DEL instead of DEL */
|
||||
int keep_x_key, /* don't translate xHome to Home key */
|
||||
int in_string) /* TRUE in string, double quote is escaped */
|
||||
int keycode, // prefer key code, e.g. K_DEL instead of DEL
|
||||
int keep_x_key, // don't translate xHome to Home key
|
||||
int in_string, // TRUE in string, double quote is escaped
|
||||
int simplify, // simplify <C-H> and <A-x>
|
||||
int *did_simplify) // found <C-H> or <A-x>
|
||||
{
|
||||
char_u *last_dash;
|
||||
char_u *end_of_name;
|
||||
@@ -2840,7 +2847,8 @@ find_special_key(
|
||||
&& VIM_ISDIGIT(last_dash[6]))
|
||||
{
|
||||
/* <Char-123> or <Char-033> or <Char-0x33> */
|
||||
vim_str2nr(last_dash + 6, NULL, &l, STR2NR_ALL, NULL, &n, 0, TRUE);
|
||||
vim_str2nr(last_dash + 6, NULL, &l, STR2NR_ALL, NULL,
|
||||
&n, 0, TRUE);
|
||||
if (l == 0)
|
||||
{
|
||||
emsg(_(e_invarg));
|
||||
@@ -2890,11 +2898,10 @@ find_special_key(
|
||||
key = DEL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Normal Key with modifier: Try to make a single byte code.
|
||||
*/
|
||||
// Normal Key with modifier: Try to make a single byte code.
|
||||
if (!IS_SPECIAL(key))
|
||||
key = extract_modifiers(key, &modifiers);
|
||||
key = extract_modifiers(key, &modifiers,
|
||||
simplify, did_simplify);
|
||||
|
||||
*modp = modifiers;
|
||||
*srcp = end_of_name;
|
||||
@@ -2908,26 +2915,37 @@ find_special_key(
|
||||
/*
|
||||
* Try to include modifiers in the key.
|
||||
* Changes "Shift-a" to 'A', "Alt-A" to 0xc0, etc.
|
||||
* When "simplify" is FALSE don't do Ctrl and Alt.
|
||||
* When "simplify" is TRUE and Ctrl or Alt is removed from modifiers set
|
||||
* "did_simplify" when it's not NULL.
|
||||
*/
|
||||
int
|
||||
extract_modifiers(int key, int *modp)
|
||||
extract_modifiers(int key, int *modp, int simplify, int *did_simplify)
|
||||
{
|
||||
int modifiers = *modp;
|
||||
|
||||
#ifdef MACOS_X
|
||||
/* Command-key really special, no fancynest */
|
||||
// Command-key really special, no fancynest
|
||||
if (!(modifiers & MOD_MASK_CMD))
|
||||
#endif
|
||||
if ((modifiers & MOD_MASK_SHIFT) && ASCII_ISALPHA(key))
|
||||
{
|
||||
key = TOUPPER_ASC(key);
|
||||
modifiers &= ~MOD_MASK_SHIFT;
|
||||
// With <C-S-a> and <A-S-a> we keep the shift modifier.
|
||||
// With <S-a> and <S-A> we don't keep the shift modifier.
|
||||
if (simplify || modifiers == MOD_MASK_SHIFT)
|
||||
modifiers &= ~MOD_MASK_SHIFT;
|
||||
}
|
||||
if ((modifiers & MOD_MASK_CTRL)
|
||||
|
||||
// <C-H> and <C-h> mean the same thing, always use "H"
|
||||
if ((modifiers & MOD_MASK_CTRL) && ASCII_ISALPHA(key))
|
||||
key = TOUPPER_ASC(key);
|
||||
|
||||
if (simplify && (modifiers & MOD_MASK_CTRL)
|
||||
#ifdef EBCDIC
|
||||
/* * TODO: EBCDIC Better use:
|
||||
* && (Ctrl_chr(key) || key == '?')
|
||||
* ??? */
|
||||
// TODO: EBCDIC Better use:
|
||||
// && (Ctrl_chr(key) || key == '?')
|
||||
// ???
|
||||
&& strchr("?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_", key)
|
||||
!= NULL
|
||||
#else
|
||||
@@ -2940,16 +2958,21 @@ extract_modifiers(int key, int *modp)
|
||||
/* <C-@> is <Nul> */
|
||||
if (key == 0)
|
||||
key = K_ZERO;
|
||||
if (did_simplify != NULL)
|
||||
*did_simplify = TRUE;
|
||||
}
|
||||
|
||||
#ifdef MACOS_X
|
||||
/* Command-key really special, no fancynest */
|
||||
if (!(modifiers & MOD_MASK_CMD))
|
||||
#endif
|
||||
if ((modifiers & MOD_MASK_ALT) && key < 0x80
|
||||
if (simplify && (modifiers & MOD_MASK_ALT) && key < 0x80
|
||||
&& !enc_dbcs) // avoid creating a lead byte
|
||||
{
|
||||
key |= 0x80;
|
||||
modifiers &= ~MOD_MASK_ALT; /* remove the META modifier */
|
||||
if (did_simplify != NULL)
|
||||
*did_simplify = TRUE;
|
||||
}
|
||||
|
||||
*modp = modifiers;
|
||||
|
||||
+25
-985
File diff suppressed because it is too large
Load Diff
+24
-2
@@ -105,7 +105,29 @@ set_init_1(int clean_arg)
|
||||
|| ((p = (char_u *)default_shell()) != NULL && *p != NUL)
|
||||
#endif
|
||||
)
|
||||
#if defined(MSWIN)
|
||||
{
|
||||
// For MS-Windows put the path in quotes instead of escaping spaces.
|
||||
char_u *cmd;
|
||||
size_t len;
|
||||
|
||||
if (vim_strchr(p, ' ') != NULL)
|
||||
{
|
||||
len = STRLEN(p) + 3; // two quotes and a trailing NUL
|
||||
cmd = alloc(len);
|
||||
if (cmd != NULL)
|
||||
{
|
||||
vim_snprintf((char *)cmd, len, "\"%s\"", p);
|
||||
set_string_default("sh", cmd);
|
||||
vim_free(cmd);
|
||||
}
|
||||
}
|
||||
else
|
||||
set_string_default("sh", p);
|
||||
}
|
||||
#else
|
||||
set_string_default_esc("sh", p, TRUE);
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_WILDIGN
|
||||
/*
|
||||
@@ -704,7 +726,7 @@ set_local_options_default(win_T *wp, int do_buffer)
|
||||
&& (do_buffer || (p->indir & PV_BUF) == 0)
|
||||
&& !(options[i].flags & P_NODEFAULT)
|
||||
&& !optval_default(p, varp, FALSE))
|
||||
set_option_default(i, OPT_LOCAL, FALSE);
|
||||
set_option_default(i, OPT_FREE|OPT_LOCAL, FALSE);
|
||||
}
|
||||
|
||||
unblock_autocmds();
|
||||
@@ -4583,7 +4605,7 @@ find_key_option(char_u *arg_arg, int has_lt)
|
||||
{
|
||||
--arg; /* put arg at the '<' */
|
||||
modifiers = 0;
|
||||
key = find_special_key(&arg, &modifiers, TRUE, TRUE, FALSE);
|
||||
key = find_special_key(&arg, &modifiers, TRUE, TRUE, FALSE, TRUE, NULL);
|
||||
if (modifiers) /* can't handle modifiers here */
|
||||
key = 0;
|
||||
}
|
||||
|
||||
@@ -3049,7 +3049,9 @@ static struct vimoption options[] =
|
||||
p_term("t_ST", T_CST)
|
||||
p_term("t_Te", T_STE)
|
||||
p_term("t_te", T_TE)
|
||||
p_term("t_TE", T_CTE)
|
||||
p_term("t_ti", T_TI)
|
||||
p_term("t_TI", T_CTI)
|
||||
p_term("t_Ts", T_STS)
|
||||
p_term("t_ts", T_TS)
|
||||
p_term("t_u7", T_U7)
|
||||
|
||||
+2
-1
@@ -1896,7 +1896,8 @@ did_set_string_option(
|
||||
{
|
||||
if (*p_pt)
|
||||
{
|
||||
(void)replace_termcodes(p_pt, &p, TRUE, TRUE, FALSE);
|
||||
(void)replace_termcodes(p_pt, &p,
|
||||
REPTERM_FROM_PART | REPTERM_DO_LT, NULL);
|
||||
if (p != NULL)
|
||||
{
|
||||
if (new_value_alloced)
|
||||
|
||||
+1
-1
@@ -1654,7 +1654,7 @@ mch_print_text_out(char_u *p, int len)
|
||||
/* This is wrong when printing spaces for a TAB. */
|
||||
if (p[len] != NUL)
|
||||
{
|
||||
wlen = MB_PTR2LEN(p + len);
|
||||
wlen = mb_ptr2len(p + len);
|
||||
wp = enc_to_utf16(p + len, &wlen);
|
||||
if (wp != NULL)
|
||||
{
|
||||
|
||||
+22
-5
@@ -4490,8 +4490,25 @@ mch_system_c(char *cmd, int options UNUSED)
|
||||
{
|
||||
int ret;
|
||||
WCHAR *wcmd;
|
||||
char_u *buf;
|
||||
size_t len;
|
||||
|
||||
// If the command starts and ends with double quotes, enclose the command
|
||||
// in parentheses.
|
||||
len = STRLEN(cmd);
|
||||
if (len >= 2 && cmd[0] == '"' && cmd[len - 1] == '"')
|
||||
{
|
||||
len += 3;
|
||||
buf = alloc(len);
|
||||
if (buf == NULL)
|
||||
return -1;
|
||||
vim_snprintf((char *)buf, len, "(%s)", cmd);
|
||||
wcmd = enc_to_utf16(buf, NULL);
|
||||
free(buf);
|
||||
}
|
||||
else
|
||||
wcmd = enc_to_utf16((char_u *)cmd, NULL);
|
||||
|
||||
wcmd = enc_to_utf16((char_u *)cmd, NULL);
|
||||
if (wcmd == NULL)
|
||||
return -1;
|
||||
|
||||
@@ -5851,9 +5868,9 @@ gotoxy(
|
||||
else
|
||||
{
|
||||
// Move the cursor to the left edge of the screen to prevent screen
|
||||
// destruction. Insider build bug.
|
||||
if (conpty_type == 3)
|
||||
vtp_printf("\033[%d;%dH", g_coord.Y + 1, 1);
|
||||
// destruction. Insider build bug. Always enabled because it's cheap
|
||||
// and avoids mistakes with recognizing the build.
|
||||
vtp_printf("\033[%d;%dH", g_coord.Y + 1, 1);
|
||||
|
||||
vtp_printf("\033[%d;%dH", y, x);
|
||||
|
||||
@@ -7277,7 +7294,7 @@ mch_setenv(char *var, char *value, int x UNUSED)
|
||||
* Confirm until this version. Also the logic changes.
|
||||
* insider preview.
|
||||
*/
|
||||
#define CONPTY_INSIDER_BUILD MAKE_VER(10, 0, 18990)
|
||||
#define CONPTY_INSIDER_BUILD MAKE_VER(10, 0, 18995)
|
||||
|
||||
/*
|
||||
* Not stable now.
|
||||
|
||||
+2
-2
@@ -1151,7 +1151,7 @@ split_message(char_u *mesg, pumitem_T **array)
|
||||
}
|
||||
}
|
||||
item->cells += ptr2cells(p);
|
||||
p += MB_PTR2LEN(p);
|
||||
p += mb_ptr2len(p);
|
||||
}
|
||||
item->bytelen = p - item->start;
|
||||
if (item->cells > max_cells)
|
||||
@@ -1195,7 +1195,7 @@ split_message(char_u *mesg, pumitem_T **array)
|
||||
{
|
||||
cells = item->indent * 2;
|
||||
for (p = item->start + skip; p < item->start + item->bytelen;
|
||||
p += MB_PTR2LEN(p))
|
||||
p += mb_ptr2len(p))
|
||||
if ((cells += ptr2cells(p)) > BALLOON_MIN_WIDTH)
|
||||
break;
|
||||
thislen = p - (item->start + skip);
|
||||
|
||||
+20
-5
@@ -535,7 +535,7 @@ check_highlight(dict_T *dict, char *name, char_u **pval)
|
||||
}
|
||||
|
||||
/*
|
||||
* Scroll to show the line with the cursor. This assumes lines don't wrap.
|
||||
* Scroll to show the line with the cursor.
|
||||
*/
|
||||
static void
|
||||
popup_show_curline(win_T *wp)
|
||||
@@ -550,6 +550,11 @@ popup_show_curline(win_T *wp)
|
||||
wp->w_topline = 1;
|
||||
else if (wp->w_topline > wp->w_buffer->b_ml.ml_line_count)
|
||||
wp->w_topline = wp->w_buffer->b_ml.ml_line_count;
|
||||
while (wp->w_topline < wp->w_cursor.lnum
|
||||
&& wp->w_topline < wp->w_buffer->b_ml.ml_line_count
|
||||
&& plines_m_win(wp, wp->w_topline, wp->w_cursor.lnum)
|
||||
> wp->w_height)
|
||||
++wp->w_topline;
|
||||
}
|
||||
|
||||
// Don't use "firstline" now.
|
||||
@@ -1041,6 +1046,7 @@ popup_adjust_position(win_T *wp)
|
||||
linenr_T lnum;
|
||||
int wrapped = 0;
|
||||
int maxwidth;
|
||||
int used_maxwidth = FALSE;
|
||||
int maxspace;
|
||||
int center_vert = FALSE;
|
||||
int center_hor = FALSE;
|
||||
@@ -1208,6 +1214,7 @@ popup_adjust_position(win_T *wp)
|
||||
++wrapped;
|
||||
len -= maxwidth;
|
||||
wp->w_width = maxwidth;
|
||||
used_maxwidth = TRUE;
|
||||
}
|
||||
}
|
||||
else if (len > maxwidth
|
||||
@@ -1259,6 +1266,8 @@ popup_adjust_position(win_T *wp)
|
||||
{
|
||||
++right_extra;
|
||||
++extra_width;
|
||||
if (used_maxwidth)
|
||||
maxwidth -= 2; // try to show the scrollbar
|
||||
}
|
||||
|
||||
minwidth = wp->w_minwidth;
|
||||
@@ -2636,12 +2645,12 @@ f_popup_getoptions(typval_T *argvars, typval_T *rettv)
|
||||
i = 1;
|
||||
FOR_ALL_TABPAGES(tp)
|
||||
{
|
||||
win_T *p;
|
||||
win_T *twp;
|
||||
|
||||
for (p = tp->tp_first_popupwin; p != NULL; p = wp->w_next)
|
||||
if (p->w_id == id)
|
||||
for (twp = tp->tp_first_popupwin; twp != NULL; twp = twp->w_next)
|
||||
if (twp->w_id == id)
|
||||
break;
|
||||
if (p != NULL)
|
||||
if (twp != NULL)
|
||||
break;
|
||||
++i;
|
||||
}
|
||||
@@ -2763,7 +2772,12 @@ invoke_popup_filter(win_T *wp, int c)
|
||||
// Emergency exit: CTRL-C closes the popup.
|
||||
if (c == Ctrl_C)
|
||||
{
|
||||
int save_got_int = got_int;
|
||||
|
||||
// Reset got_int to avoid the callback isn't called.
|
||||
got_int = FALSE;
|
||||
popup_close_with_retval(wp, -1);
|
||||
got_int |= save_got_int;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3365,6 +3379,7 @@ update_popups(void (*win_update)(win_T *wp))
|
||||
trunc_string(wp->w_popup_title, title, total_width - 2, len);
|
||||
screen_puts(title, wp->w_winrow, wp->w_wincol + 1,
|
||||
wp->w_popup_border[0] > 0 ? border_attr[0] : popup_attr);
|
||||
vim_free(title);
|
||||
}
|
||||
|
||||
// Compute scrollbar thumb position and size.
|
||||
|
||||
@@ -67,6 +67,7 @@ extern int _stricoll(char *a, char *b);
|
||||
# include "bufwrite.pro"
|
||||
# include "change.pro"
|
||||
# include "charset.pro"
|
||||
# include "cindent.pro"
|
||||
# include "cmdexpand.pro"
|
||||
# include "cmdhist.pro"
|
||||
# include "if_cscope.pro"
|
||||
|
||||
@@ -7,6 +7,7 @@ void f_listener_flush(typval_T *argvars, typval_T *rettv);
|
||||
void f_listener_remove(typval_T *argvars, typval_T *rettv);
|
||||
void may_invoke_listeners(buf_T *buf, linenr_T lnum, linenr_T lnume, int added);
|
||||
void invoke_listeners(buf_T *buf);
|
||||
void remove_listeners(buf_T *buf);
|
||||
void changed_bytes(linenr_T lnum, colnr_T col);
|
||||
void appended_lines(linenr_T lnum, long count);
|
||||
void appended_lines_mark(linenr_T lnum, long count);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/* cindent.c */
|
||||
int cin_is_cinword(char_u *line);
|
||||
pos_T *find_start_comment(int ind_maxcomment);
|
||||
int cindent_on(void);
|
||||
void parse_cino(buf_T *buf);
|
||||
int get_c_indent(void);
|
||||
int in_cinkeys(int keytyped, int when, int line_is_empty);
|
||||
void do_c_expr_indent(void);
|
||||
void f_cindent(typval_T *argvars, typval_T *rettv);
|
||||
/* vim: set ft=c : */
|
||||
+1
-1
@@ -8,7 +8,6 @@ int prompt_curpos_editable(void);
|
||||
void edit_unputchar(void);
|
||||
void display_dollar(colnr_T col);
|
||||
void undisplay_dollar(void);
|
||||
void change_indent(int type, int amount, int round, int replaced, int call_changed_bytes);
|
||||
void truncate_spaces(char_u *line);
|
||||
void backspace_until_column(int col);
|
||||
int get_literal(void);
|
||||
@@ -30,6 +29,7 @@ char_u *get_last_insert(void);
|
||||
char_u *get_last_insert_save(void);
|
||||
void replace_push(int c);
|
||||
int replace_push_mb(char_u *p);
|
||||
void replace_join(int off);
|
||||
int hkmap(int c);
|
||||
int bracketed_paste(paste_mode_T mode, int drop, garray_T *gap);
|
||||
void ins_scroll(void);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
void do_ascii(exarg_T *eap);
|
||||
void ex_align(exarg_T *eap);
|
||||
void ex_sort(exarg_T *eap);
|
||||
void ex_retab(exarg_T *eap);
|
||||
int do_move(linenr_T line1, linenr_T line2, linenr_T dest);
|
||||
void ex_copy(linenr_T line1, linenr_T line2, linenr_T n);
|
||||
void free_prev_shellcmd(void);
|
||||
|
||||
+21
-12
@@ -1,21 +1,9 @@
|
||||
/* indent.c */
|
||||
int cin_is_cinword(char_u *line);
|
||||
pos_T *find_start_comment(int ind_maxcomment);
|
||||
int cindent_on(void);
|
||||
void parse_cino(buf_T *buf);
|
||||
int get_c_indent(void);
|
||||
int get_expr_indent(void);
|
||||
int in_cinkeys(int keytyped, int when, int line_is_empty);
|
||||
int get_lisp_indent(void);
|
||||
void do_c_expr_indent(void);
|
||||
void fixthisline(int (*get_the_indent)(void));
|
||||
void fix_indent(void);
|
||||
int tabstop_set(char_u *var, int **array);
|
||||
int tabstop_padding(colnr_T col, int ts_arg, int *vts);
|
||||
int tabstop_at(colnr_T col, int ts, int *vts);
|
||||
colnr_T tabstop_start(colnr_T col, int ts, int *vts);
|
||||
void tabstop_fromto(colnr_T start_col, colnr_T end_col, int ts_arg, int *vts, int *ntabs, int *nspcs);
|
||||
int tabstop_eq(int *ts1, int *ts2);
|
||||
int *tabstop_copy(int *oldts);
|
||||
int tabstop_count(int *ts);
|
||||
int tabstop_first(int *ts);
|
||||
@@ -23,4 +11,25 @@ long get_sw_value(buf_T *buf);
|
||||
long get_sw_value_indent(buf_T *buf);
|
||||
long get_sw_value_col(buf_T *buf, colnr_T col);
|
||||
long get_sts_value(void);
|
||||
int get_indent(void);
|
||||
int get_indent_lnum(linenr_T lnum);
|
||||
int get_indent_buf(buf_T *buf, linenr_T lnum);
|
||||
int get_indent_str(char_u *ptr, int ts, int list);
|
||||
int get_indent_str_vtab(char_u *ptr, int ts, int *vts, int list);
|
||||
int set_indent(int size, int flags);
|
||||
int get_number_indent(linenr_T lnum);
|
||||
int get_breakindent_win(win_T *wp, char_u *line);
|
||||
int inindent(int extra);
|
||||
void op_reindent(oparg_T *oap, int (*how)(void));
|
||||
int preprocs_left(void);
|
||||
void ins_try_si(int c);
|
||||
void change_indent(int type, int amount, int round, int replaced, int call_changed_bytes);
|
||||
int copy_indent(int size, char_u *src);
|
||||
void ex_retab(exarg_T *eap);
|
||||
int get_expr_indent(void);
|
||||
int get_lisp_indent(void);
|
||||
void fixthisline(int (*get_the_indent)(void));
|
||||
void fix_indent(void);
|
||||
void f_indent(typval_T *argvars, typval_T *rettv);
|
||||
void f_lispindent(typval_T *argvars, typval_T *rettv);
|
||||
/* vim: set ft=c : */
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
/* misc1.c */
|
||||
int get_indent(void);
|
||||
int get_indent_lnum(linenr_T lnum);
|
||||
int get_indent_buf(buf_T *buf, linenr_T lnum);
|
||||
int get_indent_str(char_u *ptr, int ts, int list);
|
||||
int get_indent_str_vtab(char_u *ptr, int ts, int *vts, int list);
|
||||
int set_indent(int size, int flags);
|
||||
int get_number_indent(linenr_T lnum);
|
||||
int get_breakindent_win(win_T *wp, char_u *line);
|
||||
int get_leader_len(char_u *line, char_u **flags, int backward, int include_space);
|
||||
int get_last_leader_offset(char_u *line, char_u **flags);
|
||||
int plines(linenr_T lnum);
|
||||
@@ -19,7 +11,6 @@ int plines_m_win(win_T *wp, linenr_T first, linenr_T last);
|
||||
int gchar_pos(pos_T *pos);
|
||||
int gchar_cursor(void);
|
||||
void pchar_cursor(int c);
|
||||
int inindent(int extra);
|
||||
char_u *skip_to_option_part(char_u *p);
|
||||
void check_status(buf_T *buf);
|
||||
int ask_yesno(char_u *str, int direct);
|
||||
|
||||
+3
-3
@@ -68,10 +68,10 @@ int name_to_mod_mask(int c);
|
||||
int simplify_key(int key, int *modifiers);
|
||||
int handle_x_keys(int key);
|
||||
char_u *get_special_key_name(int c, int modifiers);
|
||||
int trans_special(char_u **srcp, char_u *dst, int keycode, int in_string);
|
||||
int trans_special(char_u **srcp, char_u *dst, int keycode, int in_string, int simplify, int *did_simplify);
|
||||
int special_to_buf(int key, int modifiers, int keycode, char_u *dst);
|
||||
int find_special_key(char_u **srcp, int *modp, int keycode, int keep_x_key, int in_string);
|
||||
int extract_modifiers(int key, int *modp);
|
||||
int find_special_key(char_u **srcp, int *modp, int keycode, int keep_x_key, int in_string, int simplify, int *did_simplify);
|
||||
int extract_modifiers(int key, int *modp, int simplify, int *did_simplify);
|
||||
int find_special_key_in_table(int c);
|
||||
int get_special_key_code(char_u *name);
|
||||
char_u *get_key_name(int i);
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
/* normal.c */
|
||||
void init_normal_cmds(void);
|
||||
void normal_cmd(oparg_T *oap, int toplevel);
|
||||
void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank);
|
||||
void check_visual_highlight(void);
|
||||
void end_visual_mode(void);
|
||||
void reset_VIsual_and_resel(void);
|
||||
void reset_VIsual(void);
|
||||
void restore_visual_mode(void);
|
||||
int find_ident_under_cursor(char_u **text, int find_type);
|
||||
int find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol, char_u **text, int *textcol, int find_type);
|
||||
void prep_redo(int regname, long, int, int, int, int, int);
|
||||
void prep_redo(int regname, long num, int cmd1, int cmd2, int cmd3, int cmd4, int cmd5);
|
||||
void clearop(oparg_T *oap);
|
||||
void clearopbeep(oparg_T *oap);
|
||||
void may_clear_cmdline(void);
|
||||
void clear_showcmd(void);
|
||||
int add_to_showcmd(int c);
|
||||
void add_to_showcmd_c(int c);
|
||||
@@ -26,5 +27,6 @@ void do_nv_ident(int c1, int c2);
|
||||
int get_visual_text(cmdarg_T *cap, char_u **pp, int *lenp);
|
||||
void start_selection(void);
|
||||
void may_start_select(int c);
|
||||
int unadjust_for_sel(void);
|
||||
void set_cursor_for_append_to_line(void);
|
||||
/* vim: set ft=c : */
|
||||
|
||||
+1
-6
@@ -1,25 +1,19 @@
|
||||
/* ops.c */
|
||||
int get_op_type(int char1, int char2);
|
||||
int op_on_lines(int op);
|
||||
int op_is_change(int op);
|
||||
int get_op_char(int optype);
|
||||
int get_extra_op_char(int optype);
|
||||
void op_shift(oparg_T *oap, int curs_top, int amount);
|
||||
void shift_line(int left, int round, int amount, int call_changed_bytes);
|
||||
void op_reindent(oparg_T *oap, int (*how)(void));
|
||||
void stuffescaped(char_u *arg, int literally);
|
||||
int op_delete(oparg_T *oap);
|
||||
int op_replace(oparg_T *oap, int c);
|
||||
void op_tilde(oparg_T *oap);
|
||||
int swapchar(int op_type, pos_T *pos);
|
||||
void op_insert(oparg_T *oap, long count1);
|
||||
int op_change(oparg_T *oap);
|
||||
void adjust_cursor_eol(void);
|
||||
int preprocs_left(void);
|
||||
char_u *skip_comment(char_u *line, int process, int include_space, int *is_comment);
|
||||
int do_join(long count, int insert_space, int save_undo, int use_formatoptions, int setmark);
|
||||
void op_format(oparg_T *oap, int keep_cursor);
|
||||
void op_formatexpr(oparg_T *oap);
|
||||
int fex_format(linenr_T lnum, long count, int c);
|
||||
void format_lines(linenr_T line_count, int avoid_fex);
|
||||
int paragraph_start(linenr_T lnum);
|
||||
@@ -28,4 +22,5 @@ void op_addsub(oparg_T *oap, linenr_T Prenum1, int g_cmd);
|
||||
void x11_export_final_selection(void);
|
||||
void clear_oparg(oparg_T *oap);
|
||||
void cursor_pos_info(dict_T *dict);
|
||||
void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank);
|
||||
/* vim: set ft=c : */
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ int is_mouse_topline(win_T *wp);
|
||||
int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen);
|
||||
void term_get_fg_color(char_u *r, char_u *g, char_u *b);
|
||||
void term_get_bg_color(char_u *r, char_u *g, char_u *b);
|
||||
char_u *replace_termcodes(char_u *from, char_u **bufp, int from_part, int do_lt, int special);
|
||||
char_u *replace_termcodes(char_u *from, char_u **bufp, int flags, int *did_simplify);
|
||||
void show_termcodes(void);
|
||||
int show_one_termcode(char_u *name, char_u *code, int printit);
|
||||
char_u *translate_mapping(char_u *str);
|
||||
|
||||
+2
-2
@@ -4046,8 +4046,8 @@ qf_goto_cwindow(qf_info_T *qi, int resize, int sz, int vertsplit)
|
||||
if (sz != win->w_width)
|
||||
win_setwidth(sz);
|
||||
}
|
||||
else if (sz != win->w_height
|
||||
&& win->w_height + win->w_status_height < cmdline_row)
|
||||
else if (sz != win->w_height && win->w_height
|
||||
+ win->w_status_height + tabline_height() < cmdline_row)
|
||||
win_setheight(sz);
|
||||
}
|
||||
|
||||
|
||||
@@ -1358,7 +1358,10 @@ free_scriptnames(void)
|
||||
int i;
|
||||
|
||||
for (i = script_items.ga_len; i > 0; --i)
|
||||
{
|
||||
vim_free(SCRIPT_ITEM(i).sn_name);
|
||||
ga_clear(&SCRIPT_ITEM(i).sn_prl_ga);
|
||||
}
|
||||
ga_clear(&script_items);
|
||||
}
|
||||
|
||||
|
||||
+10
-4
@@ -2087,7 +2087,7 @@ findmatchlimit(
|
||||
find_mps_values(&initc, &findc, &backwards, FALSE);
|
||||
if (findc)
|
||||
break;
|
||||
pos.col += MB_PTR2LEN(linep + pos.col);
|
||||
pos.col += mb_ptr2len(linep + pos.col);
|
||||
}
|
||||
if (!findc)
|
||||
{
|
||||
@@ -2666,14 +2666,14 @@ showmatch(
|
||||
if (PTR2CHAR(p) == c && (curwin->w_p_rl ^ p_ri))
|
||||
break;
|
||||
#endif
|
||||
p += MB_PTR2LEN(p) + 1;
|
||||
p += mb_ptr2len(p) + 1;
|
||||
if (PTR2CHAR(p) == c
|
||||
#ifdef FEAT_RIGHTLEFT
|
||||
&& !(curwin->w_p_rl ^ p_ri)
|
||||
#endif
|
||||
)
|
||||
break;
|
||||
p += MB_PTR2LEN(p);
|
||||
p += mb_ptr2len(p);
|
||||
if (*p == NUL)
|
||||
return;
|
||||
}
|
||||
@@ -5642,7 +5642,7 @@ exit_matched:
|
||||
&& action == ACTION_EXPAND
|
||||
&& !(compl_cont_status & CONT_SOL)
|
||||
&& *startp != NUL
|
||||
&& *(p = startp + MB_PTR2LEN(startp)) != NUL)
|
||||
&& *(p = startp + mb_ptr2len(startp)) != NUL)
|
||||
goto search_line;
|
||||
}
|
||||
line_breakcheck();
|
||||
@@ -5798,12 +5798,18 @@ show_pat_in_path(
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_VIMINFO
|
||||
/*
|
||||
* Return the last used search pattern at "idx".
|
||||
*/
|
||||
spat_T *
|
||||
get_spat(int idx)
|
||||
{
|
||||
return &spats[idx];
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the last used search pattern index.
|
||||
*/
|
||||
int
|
||||
get_spat_last_idx(void)
|
||||
{
|
||||
|
||||
+2
-2
@@ -2621,7 +2621,7 @@ spell_iswordp(
|
||||
|
||||
if (has_mbyte)
|
||||
{
|
||||
l = MB_PTR2LEN(p);
|
||||
l = mb_ptr2len(p);
|
||||
s = p;
|
||||
if (l == 1)
|
||||
{
|
||||
@@ -4367,7 +4367,7 @@ compile_cap_prog(synblock_T *synblock)
|
||||
regprog_T *rp = synblock->b_cap_prog;
|
||||
char_u *re;
|
||||
|
||||
if (*synblock->b_p_spc == NUL)
|
||||
if (synblock->b_p_spc == NULL || *synblock->b_p_spc == NUL)
|
||||
synblock->b_cap_prog = NULL;
|
||||
else
|
||||
{
|
||||
|
||||
+14
-14
@@ -1782,7 +1782,7 @@ suggest_trie_walk(
|
||||
{
|
||||
int l;
|
||||
|
||||
l = MB_PTR2LEN(fword + sp->ts_fidx);
|
||||
l = mb_ptr2len(fword + sp->ts_fidx);
|
||||
if (fword_ends)
|
||||
{
|
||||
// Copy the skipped character to preword.
|
||||
@@ -1937,7 +1937,7 @@ suggest_trie_walk(
|
||||
// Correct ts_fidx for the byte length of the
|
||||
// character (we didn't check that before).
|
||||
sp->ts_fidx = sp->ts_fcharstart
|
||||
+ MB_PTR2LEN(
|
||||
+ mb_ptr2len(
|
||||
fword + sp->ts_fcharstart);
|
||||
// For changing a composing character adjust
|
||||
// the score from SCORE_SUBST to
|
||||
@@ -2053,7 +2053,7 @@ suggest_trie_walk(
|
||||
if (has_mbyte)
|
||||
{
|
||||
c = mb_ptr2char(fword + sp->ts_fidx);
|
||||
stack[depth].ts_fidx += MB_PTR2LEN(fword + sp->ts_fidx);
|
||||
stack[depth].ts_fidx += mb_ptr2len(fword + sp->ts_fidx);
|
||||
if (enc_utf8 && utf_iscomposing(c))
|
||||
stack[depth].ts_score -= SCORE_DEL - SCORE_DELCOMP;
|
||||
else if (c == mb_ptr2char(fword + stack[depth].ts_fidx))
|
||||
@@ -2266,9 +2266,9 @@ suggest_trie_walk(
|
||||
p = fword + sp->ts_fidx;
|
||||
if (has_mbyte)
|
||||
{
|
||||
n = MB_PTR2LEN(p);
|
||||
n = mb_ptr2len(p);
|
||||
c = mb_ptr2char(p + n);
|
||||
mch_memmove(p + MB_PTR2LEN(p + n), p, n);
|
||||
mch_memmove(p + mb_ptr2len(p + n), p, n);
|
||||
mb_char2bytes(c, p);
|
||||
}
|
||||
else
|
||||
@@ -2354,11 +2354,11 @@ suggest_trie_walk(
|
||||
p = fword + sp->ts_fidx;
|
||||
if (has_mbyte)
|
||||
{
|
||||
n = MB_PTR2LEN(p);
|
||||
n = mb_ptr2len(p);
|
||||
c2 = mb_ptr2char(p + n);
|
||||
fl = MB_PTR2LEN(p + n);
|
||||
fl = mb_ptr2len(p + n);
|
||||
c = mb_ptr2char(p + n + fl);
|
||||
tl = MB_PTR2LEN(p + n + fl);
|
||||
tl = mb_ptr2len(p + n + fl);
|
||||
mch_memmove(p + fl + tl, p, n);
|
||||
mb_char2bytes(c, p);
|
||||
mb_char2bytes(c2, p + tl);
|
||||
@@ -2427,10 +2427,10 @@ suggest_trie_walk(
|
||||
p = fword + sp->ts_fidx;
|
||||
if (has_mbyte)
|
||||
{
|
||||
n = MB_PTR2LEN(p);
|
||||
n += MB_PTR2LEN(p + n);
|
||||
n = mb_ptr2len(p);
|
||||
n += mb_ptr2len(p + n);
|
||||
c = mb_ptr2char(p + n);
|
||||
tl = MB_PTR2LEN(p + n);
|
||||
tl = mb_ptr2len(p + n);
|
||||
mch_memmove(p + tl, p, n);
|
||||
mb_char2bytes(c, p);
|
||||
}
|
||||
@@ -2489,9 +2489,9 @@ suggest_trie_walk(
|
||||
if (has_mbyte)
|
||||
{
|
||||
c = mb_ptr2char(p);
|
||||
tl = MB_PTR2LEN(p);
|
||||
n = MB_PTR2LEN(p + tl);
|
||||
n += MB_PTR2LEN(p + tl + n);
|
||||
tl = mb_ptr2len(p);
|
||||
n = mb_ptr2len(p + tl);
|
||||
n += mb_ptr2len(p + tl + n);
|
||||
mch_memmove(p, p + tl, n);
|
||||
mb_char2bytes(c, p + n);
|
||||
}
|
||||
|
||||
+2
-12
@@ -1133,18 +1133,6 @@ typedef struct
|
||||
int vc_fail; // fail for invalid char, don't use '?'
|
||||
} vimconv_T;
|
||||
|
||||
/*
|
||||
* Structure used for reading from the viminfo file.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
char_u *vir_line; // text of the current line
|
||||
FILE *vir_fd; // file descriptor
|
||||
vimconv_T vir_conv; // encoding conversion
|
||||
int vir_version; // viminfo version detected or -1
|
||||
garray_T vir_barlines; // lines starting with |
|
||||
} vir_T;
|
||||
|
||||
/*
|
||||
* Structure used for the command line history.
|
||||
*/
|
||||
@@ -1184,6 +1172,8 @@ struct mapblock
|
||||
char_u *m_orig_str; // rhs as entered by the user
|
||||
int m_keylen; // strlen(m_keys)
|
||||
int m_mode; // valid mode
|
||||
int m_simplified; // m_keys was simplified, do not use this map
|
||||
// if seenModifyOtherKeys is TRUE
|
||||
int m_noremap; // if non-zero no re-mapping for m_str
|
||||
char m_silent; // <silent> used, don't echo commands
|
||||
char m_nowait; // <nowait> used
|
||||
|
||||
@@ -2198,23 +2198,23 @@ line_read_in:
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_TAG_BINS
|
||||
/*
|
||||
* When starting a binary search, get the size of the file and
|
||||
* compute the first offset.
|
||||
*/
|
||||
// When starting a binary search, get the size of the file and
|
||||
// compute the first offset.
|
||||
if (state == TS_BINARY)
|
||||
{
|
||||
/* Get the tag file size (don't use mch_fstat(), it's not
|
||||
* portable). */
|
||||
if ((filesize = vim_lseek(fileno(fp),
|
||||
(off_T)0L, SEEK_END)) <= 0)
|
||||
if (vim_fseek(fp, 0L, SEEK_END) != 0)
|
||||
// can't seek, don't use binary search
|
||||
state = TS_LINEAR;
|
||||
else
|
||||
{
|
||||
vim_lseek(fileno(fp), (off_T)0L, SEEK_SET);
|
||||
// Get the tag file size (don't use mch_fstat(), it's
|
||||
// not portable). Don't use lseek(), it doesn't work
|
||||
// properly on MacOS Catalina.
|
||||
filesize = vim_ftell(fp);
|
||||
vim_fseek(fp, 0L, SEEK_SET);
|
||||
|
||||
/* Calculate the first read offset in the file. Start
|
||||
* the search in the middle of the file. */
|
||||
// Calculate the first read offset in the file. Start
|
||||
// the search in the middle of the file.
|
||||
search_info.low_offset = 0;
|
||||
search_info.low_char = 0;
|
||||
search_info.high_offset = filesize;
|
||||
|
||||
+324
-217
@@ -1630,6 +1630,7 @@ get_term_entries(int *height, int *width)
|
||||
{KS_CM, "cm"}, {KS_SR, "sr"},
|
||||
{KS_CRI,"RI"}, {KS_VB, "vb"}, {KS_KS, "ks"},
|
||||
{KS_KE, "ke"}, {KS_TI, "ti"}, {KS_TE, "te"},
|
||||
{KS_CTI, "TI"}, {KS_CTE, "TE"},
|
||||
{KS_BC, "bc"}, {KS_CSB,"Sb"}, {KS_CSF,"Sf"},
|
||||
{KS_CAB,"AB"}, {KS_CAF,"AF"}, {KS_LE, "le"},
|
||||
{KS_ND, "nd"}, {KS_OP, "op"}, {KS_CRV, "RV"},
|
||||
@@ -3468,6 +3469,7 @@ starttermcap(void)
|
||||
if (full_screen && !termcap_active)
|
||||
{
|
||||
out_str(T_TI); /* start termcap mode */
|
||||
out_str(T_CTI); /* start "raw" mode */
|
||||
out_str(T_KS); /* start "keypad transmit" mode */
|
||||
out_str(T_BE); /* enable bracketed paste mode */
|
||||
out_flush();
|
||||
@@ -3523,6 +3525,7 @@ stoptermcap(void)
|
||||
out_flush();
|
||||
termcap_active = FALSE;
|
||||
cursor_on(); /* just in case it is still off */
|
||||
out_str(T_CTE); /* stop "raw" mode */
|
||||
out_str(T_TE); /* stop termcap mode */
|
||||
screen_start(); /* don't know where cursor is now */
|
||||
out_flush();
|
||||
@@ -4204,6 +4207,99 @@ is_mouse_topline(win_T *wp)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Put "string[new_slen]" in typebuf, or in "buf[bufsize]" if "buf" is not NULL.
|
||||
* Remove "slen" bytes.
|
||||
* Returns FAIL for error.
|
||||
*/
|
||||
static int
|
||||
put_string_in_typebuf(
|
||||
int offset,
|
||||
int slen,
|
||||
char_u *string,
|
||||
int new_slen,
|
||||
char_u *buf,
|
||||
int bufsize,
|
||||
int *buflen)
|
||||
{
|
||||
int extra = new_slen - slen;
|
||||
|
||||
string[new_slen] = NUL;
|
||||
if (buf == NULL)
|
||||
{
|
||||
if (extra < 0)
|
||||
// remove matched chars, taking care of noremap
|
||||
del_typebuf(-extra, offset);
|
||||
else if (extra > 0)
|
||||
// insert the extra space we need
|
||||
ins_typebuf(string + slen, REMAP_YES, offset, FALSE, FALSE);
|
||||
|
||||
// Careful: del_typebuf() and ins_typebuf() may have reallocated
|
||||
// typebuf.tb_buf[]!
|
||||
mch_memmove(typebuf.tb_buf + typebuf.tb_off + offset, string,
|
||||
(size_t)new_slen);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (extra < 0)
|
||||
// remove matched characters
|
||||
mch_memmove(buf + offset, buf + offset - extra,
|
||||
(size_t)(*buflen + offset + extra));
|
||||
else if (extra > 0)
|
||||
{
|
||||
// Insert the extra space we need. If there is insufficient
|
||||
// space return -1.
|
||||
if (*buflen + extra + new_slen >= bufsize)
|
||||
return FAIL;
|
||||
mch_memmove(buf + offset + extra, buf + offset,
|
||||
(size_t)(*buflen - offset));
|
||||
}
|
||||
mch_memmove(buf + offset, string, (size_t)new_slen);
|
||||
*buflen = *buflen + extra + new_slen;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Decode a modifier number as xterm provides it into MOD_MASK bits.
|
||||
*/
|
||||
static int
|
||||
decode_modifiers(int n)
|
||||
{
|
||||
int code = n - 1;
|
||||
int modifiers = 0;
|
||||
|
||||
if (code & 1)
|
||||
modifiers |= MOD_MASK_SHIFT;
|
||||
if (code & 2)
|
||||
modifiers |= MOD_MASK_ALT;
|
||||
if (code & 4)
|
||||
modifiers |= MOD_MASK_CTRL;
|
||||
if (code & 8)
|
||||
modifiers |= MOD_MASK_META;
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
static int
|
||||
modifiers2keycode(int modifiers, int *key, char_u *string)
|
||||
{
|
||||
int new_slen = 0;
|
||||
|
||||
if (modifiers != 0)
|
||||
{
|
||||
// Some keys have the modifier included. Need to handle that here to
|
||||
// make mappings work.
|
||||
*key = simplify_key(*key, &modifiers);
|
||||
if (modifiers != 0)
|
||||
{
|
||||
string[new_slen++] = K_SPECIAL;
|
||||
string[new_slen++] = (int)KS_MODIFIER;
|
||||
string[new_slen++] = modifiers;
|
||||
}
|
||||
}
|
||||
return new_slen;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if typebuf.tb_buf[] contains a terminal key code.
|
||||
* Check from typebuf.tb_buf[typebuf.tb_off] to typebuf.tb_buf[typebuf.tb_off
|
||||
@@ -4235,8 +4331,7 @@ check_termcode(
|
||||
int modifiers;
|
||||
char_u *modifiers_start = NULL;
|
||||
int key;
|
||||
int new_slen;
|
||||
int extra;
|
||||
int new_slen; // Length of what will replace the termcode
|
||||
char_u string[MAX_KEY_CODE_LEN + 1];
|
||||
int i, j;
|
||||
int idx = 0;
|
||||
@@ -4407,16 +4502,9 @@ check_termcode(
|
||||
|
||||
modifiers_start = tp + slen - 2;
|
||||
|
||||
/* Match! Convert modifier bits. */
|
||||
n = atoi((char *)modifiers_start) - 1;
|
||||
if (n & 1)
|
||||
modifiers |= MOD_MASK_SHIFT;
|
||||
if (n & 2)
|
||||
modifiers |= MOD_MASK_ALT;
|
||||
if (n & 4)
|
||||
modifiers |= MOD_MASK_CTRL;
|
||||
if (n & 8)
|
||||
modifiers |= MOD_MASK_META;
|
||||
// Match! Convert modifier bits.
|
||||
n = atoi((char *)modifiers_start);
|
||||
modifiers |= decode_modifiers(n);
|
||||
|
||||
slen = j;
|
||||
}
|
||||
@@ -4441,72 +4529,105 @@ check_termcode(
|
||||
# endif
|
||||
)
|
||||
{
|
||||
/* Check for some responses from the terminal starting with
|
||||
* "<Esc>[" or CSI:
|
||||
char_u *argp = tp[0] == ESC ? tp + 2 : tp + 1;
|
||||
|
||||
/*
|
||||
* Check for responses from the terminal starting with {lead}:
|
||||
* "<Esc>[" or CSI followed by [0-9>?]
|
||||
*
|
||||
* - Xterm version string: <Esc>[>{x};{vers};{y}c
|
||||
* Libvterm returns {x} == 0, {vers} == 100, {y} == 0.
|
||||
* - Xterm version string: {lead}>{x};{vers};{y}c
|
||||
* Also eat other possible responses to t_RV, rxvt returns
|
||||
* "<Esc>[?1;2c". Also accept CSI instead of <Esc>[.
|
||||
* mrxvt has been reported to have "+" in the version. Assume
|
||||
* the escape sequence ends with a letter or one of "{|}~".
|
||||
* "{lead}?1;2c".
|
||||
*
|
||||
* - Cursor position report: <Esc>[{row};{col}R
|
||||
* - Cursor position report: {lead}{row};{col}R
|
||||
* The final byte must be 'R'. It is used for checking the
|
||||
* ambiguous-width character state.
|
||||
*
|
||||
* - window position reply: <Esc>[3;{x};{y}t
|
||||
* - window position reply: {lead}3;{x};{y}t
|
||||
*
|
||||
* - key with modifiers when modifyOtherKeys is enabled:
|
||||
* {lead}27;{modifier};{key}~
|
||||
* {lead}{key};{modifier}u
|
||||
*/
|
||||
char_u *argp = tp[0] == ESC ? tp + 2 : tp + 1;
|
||||
|
||||
if ((*T_CRV != NUL || *T_U7 != NUL || did_request_winpos)
|
||||
&& ((tp[0] == ESC && len >= 3 && tp[1] == '[')
|
||||
if (((tp[0] == ESC && len >= 3 && tp[1] == '[')
|
||||
|| (tp[0] == CSI && len >= 2))
|
||||
&& (VIM_ISDIGIT(*argp) || *argp == '>' || *argp == '?'))
|
||||
&& (VIM_ISDIGIT(*argp) || *argp == '>' || *argp == '?'))
|
||||
{
|
||||
int col = 0;
|
||||
int semicols = 0;
|
||||
int row_char = NUL;
|
||||
int first = -1; // optional char right after {lead}
|
||||
int trail; // char that ends CSI sequence
|
||||
int arg[3] = {-1, -1, -1}; // argument numbers
|
||||
int argc; // number of arguments
|
||||
char_u *ap = argp;
|
||||
int csi_len;
|
||||
|
||||
extra = 0;
|
||||
for (i = 2 + (tp[0] != CSI); i < len
|
||||
&& !(tp[i] >= '{' && tp[i] <= '~')
|
||||
&& !ASCII_ISALPHA(tp[i]); ++i)
|
||||
if (tp[i] == ';' && ++semicols == 1)
|
||||
// Check for non-digit after CSI.
|
||||
if (!VIM_ISDIGIT(*ap))
|
||||
first = *ap++;
|
||||
|
||||
// Find up to three argument numbers.
|
||||
for (argc = 0; argc < 3; )
|
||||
{
|
||||
if (ap >= tp + len)
|
||||
{
|
||||
extra = i + 1;
|
||||
row_char = tp[i - 1];
|
||||
not_enough:
|
||||
LOG_TR(("Not enough characters for CSI sequence"));
|
||||
return -1;
|
||||
}
|
||||
if (i == len)
|
||||
{
|
||||
LOG_TR(("Not enough characters for CRV"));
|
||||
return -1;
|
||||
if (*ap == ';')
|
||||
arg[argc++] = -1; // omitted number
|
||||
else if (VIM_ISDIGIT(*ap))
|
||||
{
|
||||
arg[argc] = 0;
|
||||
for (;;)
|
||||
{
|
||||
if (ap >= tp + len)
|
||||
goto not_enough;
|
||||
if (!VIM_ISDIGIT(*ap))
|
||||
break;
|
||||
arg[argc] = arg[argc] * 10 + (*ap - '0');
|
||||
++ap;
|
||||
}
|
||||
++argc;
|
||||
}
|
||||
if (*ap == ';')
|
||||
++ap;
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (extra > 0)
|
||||
col = atoi((char *)tp + extra);
|
||||
// mrxvt has been reported to have "+" in the version. Assume
|
||||
// the escape sequence ends with a letter or one of "{|}~".
|
||||
while (ap < tp + len
|
||||
&& !(*ap >= '{' && *ap <= '~')
|
||||
&& !ASCII_ISALPHA(*ap))
|
||||
++ap;
|
||||
if (ap >= tp + len)
|
||||
goto not_enough;
|
||||
trail = *ap;
|
||||
csi_len = (int)(ap - tp) + 1;
|
||||
|
||||
/* Eat it when it has 2 arguments and ends in 'R'. Also when
|
||||
* u7_status is not "sent", it may be from a previous Vim that
|
||||
* just exited. But not for <S-F3>, it sends something
|
||||
* similar, check for row and column to make sense. */
|
||||
if (semicols == 1 && tp[i] == 'R')
|
||||
// Cursor position report: Eat it when there are 2 arguments
|
||||
// and it ends in 'R'. Also when u7_status is not "sent", it
|
||||
// may be from a previous Vim that just exited. But not for
|
||||
// <S-F3>, it sends something similar, check for row and column
|
||||
// to make sense.
|
||||
if (first == -1 && argc == 2 && trail == 'R')
|
||||
{
|
||||
if (row_char == '2' && col >= 2)
|
||||
if (arg[0] == 2 && arg[1] >= 2)
|
||||
{
|
||||
char *aw = NULL;
|
||||
|
||||
LOG_TR(("Received U7 status: %s", tp));
|
||||
u7_status.tr_progress = STATUS_GOT;
|
||||
did_cursorhold = TRUE;
|
||||
if (col == 2)
|
||||
if (arg[1] == 2)
|
||||
aw = "single";
|
||||
else if (col == 3)
|
||||
else if (arg[1] == 3)
|
||||
aw = "double";
|
||||
if (aw != NULL && STRCMP(aw, p_ambw) != 0)
|
||||
{
|
||||
/* Setting the option causes a screen redraw. Do
|
||||
* that right away if possible, keeping any
|
||||
* messages. */
|
||||
// Setting the option causes a screen redraw. Do
|
||||
// that right away if possible, keeping any
|
||||
// messages.
|
||||
set_option_value((char_u *)"ambw", 0L,
|
||||
(char_u *)aw, 0);
|
||||
# ifdef DEBUG_TERMRESPONSE
|
||||
@@ -4522,34 +4643,35 @@ check_termcode(
|
||||
}
|
||||
key_name[0] = (int)KS_EXTRA;
|
||||
key_name[1] = (int)KE_IGNORE;
|
||||
slen = i + 1;
|
||||
slen = csi_len;
|
||||
# ifdef FEAT_EVAL
|
||||
set_vim_var_string(VV_TERMU7RESP, tp, slen);
|
||||
# endif
|
||||
}
|
||||
/* eat it when at least one digit and ending in 'c' */
|
||||
else if (*T_CRV != NUL && i > 2 + (tp[0] != CSI)
|
||||
&& tp[i] == 'c')
|
||||
|
||||
// Version string: Eat it when there is at least one digit and
|
||||
// it ends in 'c'
|
||||
else if (*T_CRV != NUL && ap > argp + 1 && trail == 'c')
|
||||
{
|
||||
int version = col;
|
||||
int version = arg[1];
|
||||
|
||||
LOG_TR(("Received CRV response: %s", tp));
|
||||
crv_status.tr_progress = STATUS_GOT;
|
||||
did_cursorhold = TRUE;
|
||||
|
||||
/* If this code starts with CSI, you can bet that the
|
||||
* terminal uses 8-bit codes. */
|
||||
// If this code starts with CSI, you can bet that the
|
||||
// terminal uses 8-bit codes.
|
||||
if (tp[0] == CSI)
|
||||
switch_to_8bit();
|
||||
|
||||
/* rxvt sends its version number: "20703" is 2.7.3.
|
||||
* Screen sends 40500.
|
||||
* Ignore it for when the user has set 'term' to xterm,
|
||||
* even though it's an rxvt. */
|
||||
// rxvt sends its version number: "20703" is 2.7.3.
|
||||
// Screen sends 40500.
|
||||
// Ignore it for when the user has set 'term' to xterm,
|
||||
// even though it's an rxvt.
|
||||
if (version > 20000)
|
||||
version = 0;
|
||||
|
||||
if (tp[1 + (tp[0] != CSI)] == '>' && semicols == 2)
|
||||
if (first == '>' && argc == 3)
|
||||
{
|
||||
int need_flush = FALSE;
|
||||
int is_iterm2 = FALSE;
|
||||
@@ -4557,10 +4679,10 @@ check_termcode(
|
||||
|
||||
// mintty 2.9.5 sends 77;20905;0c.
|
||||
// (77 is ASCII 'M' for mintty.)
|
||||
if (STRNCMP(tp + extra - 3, "77;", 3) == 0)
|
||||
if (arg[0] == 77)
|
||||
is_mintty = TRUE;
|
||||
|
||||
/* if xterm version >= 141 try to get termcap codes */
|
||||
// if xterm version >= 141 try to get termcap codes
|
||||
if (version >= 141)
|
||||
{
|
||||
LOG_TR(("Enable checking for XT codes"));
|
||||
@@ -4569,13 +4691,12 @@ check_termcode(
|
||||
req_codes_from_term();
|
||||
}
|
||||
|
||||
/* libvterm sends 0;100;0 */
|
||||
if (version == 100
|
||||
&& STRNCMP(tp + extra - 2, "0;100;0c", 8) == 0)
|
||||
// libvterm sends 0;100;0
|
||||
if (version == 100 && arg[0] == 0 && arg[2] == 0)
|
||||
{
|
||||
/* If run from Vim $COLORS is set to the number of
|
||||
* colors the terminal supports. Otherwise assume
|
||||
* 256, libvterm supports even more. */
|
||||
// If run from Vim $COLORS is set to the number of
|
||||
// colors the terminal supports. Otherwise assume
|
||||
// 256, libvterm supports even more.
|
||||
if (mch_getenv((char_u *)"COLORS") == NULL)
|
||||
may_adjust_color_count(256);
|
||||
/* Libvterm can handle SGR mouse reporting. */
|
||||
@@ -4587,56 +4708,54 @@ check_termcode(
|
||||
if (version == 95)
|
||||
{
|
||||
// Mac Terminal.app sends 1;95;0
|
||||
if (STRNCMP(tp + extra - 2, "1;95;0c", 7) == 0)
|
||||
if (arg[0] == 1 && arg[2] == 0)
|
||||
{
|
||||
is_not_xterm = TRUE;
|
||||
is_mac_terminal = TRUE;
|
||||
}
|
||||
// iTerm2 sends 0;95;0
|
||||
if (STRNCMP(tp + extra - 2, "0;95;0c", 7) == 0)
|
||||
else if (arg[0] == 0 && arg[2] == 0)
|
||||
is_iterm2 = TRUE;
|
||||
// old iTerm2 sends 0;95;
|
||||
else if (STRNCMP(tp + extra - 2, "0;95;c", 6) == 0)
|
||||
else if (arg[0] == 0 && arg[2] == -1)
|
||||
is_not_xterm = TRUE;
|
||||
}
|
||||
|
||||
/* Only set 'ttymouse' automatically if it was not set
|
||||
* by the user already. */
|
||||
// Only set 'ttymouse' automatically if it was not set
|
||||
// by the user already.
|
||||
if (!option_was_set((char_u *)"ttym"))
|
||||
{
|
||||
/* Xterm version 277 supports SGR. Also support
|
||||
* Terminal.app, iTerm2 and mintty. */
|
||||
// Xterm version 277 supports SGR. Also support
|
||||
// Terminal.app, iTerm2 and mintty.
|
||||
if (version >= 277 || is_iterm2 || is_mac_terminal
|
||||
|| is_mintty)
|
||||
set_option_value((char_u *)"ttym", 0L,
|
||||
(char_u *)"sgr", 0);
|
||||
/* if xterm version >= 95 use mouse dragging */
|
||||
// if xterm version >= 95 use mouse dragging
|
||||
else if (version >= 95)
|
||||
set_option_value((char_u *)"ttym", 0L,
|
||||
(char_u *)"xterm2", 0);
|
||||
}
|
||||
|
||||
/* Detect terminals that set $TERM to something like
|
||||
* "xterm-256colors" but are not fully xterm
|
||||
* compatible. */
|
||||
// Detect terminals that set $TERM to something like
|
||||
// "xterm-256colors" but are not fully xterm
|
||||
// compatible.
|
||||
|
||||
/* Gnome terminal sends 1;3801;0, 1;4402;0 or 1;2501;0.
|
||||
* xfce4-terminal sends 1;2802;0.
|
||||
* screen sends 83;40500;0
|
||||
* Assuming any version number over 2500 is not an
|
||||
* xterm (without the limit for rxvt and screen). */
|
||||
if (col >= 2500)
|
||||
// Gnome terminal sends 1;3801;0, 1;4402;0 or 1;2501;0.
|
||||
// xfce4-terminal sends 1;2802;0.
|
||||
// screen sends 83;40500;0
|
||||
// Assuming any version number over 2500 is not an
|
||||
// xterm (without the limit for rxvt and screen).
|
||||
if (arg[1] >= 2500)
|
||||
is_not_xterm = TRUE;
|
||||
|
||||
/* PuTTY sends 0;136;0
|
||||
* vandyke SecureCRT sends 1;136;0 */
|
||||
if (version == 136
|
||||
&& STRNCMP(tp + extra - 1, ";136;0c", 7) == 0)
|
||||
// PuTTY sends 0;136;0
|
||||
// vandyke SecureCRT sends 1;136;0
|
||||
else if (version == 136 && arg[2] == 0)
|
||||
is_not_xterm = TRUE;
|
||||
|
||||
/* Konsole sends 0;115;0 */
|
||||
if (version == 115
|
||||
&& STRNCMP(tp + extra - 2, "0;115;0c", 8) == 0)
|
||||
// Konsole sends 0;115;0
|
||||
else if (version == 115 && arg[0] == 0 && arg[2] == 0)
|
||||
is_not_xterm = TRUE;
|
||||
|
||||
// Xterm first responded to this request at patch level
|
||||
@@ -4644,11 +4763,11 @@ check_termcode(
|
||||
if (version < 95)
|
||||
is_not_xterm = TRUE;
|
||||
|
||||
/* Only request the cursor style if t_SH and t_RS are
|
||||
* set. Only supported properly by xterm since version
|
||||
* 279 (otherwise it returns 0x18).
|
||||
* Not for Terminal.app, it can't handle t_RS, it
|
||||
* echoes the characters to the screen. */
|
||||
// Only request the cursor style if t_SH and t_RS are
|
||||
// set. Only supported properly by xterm since version
|
||||
// 279 (otherwise it returns 0x18).
|
||||
// Not for Terminal.app, it can't handle t_RS, it
|
||||
// echoes the characters to the screen.
|
||||
if (rcs_status.tr_progress == STATUS_GET
|
||||
&& version >= 279
|
||||
&& !is_not_xterm
|
||||
@@ -4661,9 +4780,9 @@ check_termcode(
|
||||
need_flush = TRUE;
|
||||
}
|
||||
|
||||
/* Only request the cursor blink mode if t_RC set. Not
|
||||
* for Gnome terminal, it can't handle t_RC, it
|
||||
* echoes the characters to the screen. */
|
||||
// Only request the cursor blink mode if t_RC set. Not
|
||||
// for Gnome terminal, it can't handle t_RC, it
|
||||
// echoes the characters to the screen.
|
||||
if (rbm_status.tr_progress == STATUS_GET
|
||||
&& !is_not_xterm
|
||||
&& *T_CRC != NUL)
|
||||
@@ -4677,7 +4796,7 @@ check_termcode(
|
||||
if (need_flush)
|
||||
out_flush();
|
||||
}
|
||||
slen = i + 1;
|
||||
slen = csi_len;
|
||||
# ifdef FEAT_EVAL
|
||||
set_vim_var_string(VV_TERMRESPONSE, tp, slen);
|
||||
# endif
|
||||
@@ -4687,69 +4806,91 @@ check_termcode(
|
||||
key_name[1] = (int)KE_IGNORE;
|
||||
}
|
||||
|
||||
/* Check blinking cursor from xterm:
|
||||
* {lead}?12;1$y set
|
||||
* {lead}?12;2$y not set
|
||||
*
|
||||
* {lead} can be <Esc>[ or CSI
|
||||
*/
|
||||
// Check blinking cursor from xterm:
|
||||
// {lead}?12;1$y set
|
||||
// {lead}?12;2$y not set
|
||||
//
|
||||
// {lead} can be <Esc>[ or CSI
|
||||
else if (rbm_status.tr_progress == STATUS_SENT
|
||||
&& tp[(j = 1 + (tp[0] == ESC))] == '?'
|
||||
&& i == j + 6
|
||||
&& tp[j + 1] == '1'
|
||||
&& tp[j + 2] == '2'
|
||||
&& tp[j + 3] == ';'
|
||||
&& tp[i - 1] == '$'
|
||||
&& tp[i] == 'y')
|
||||
&& first == '?'
|
||||
&& ap == argp + 6
|
||||
&& arg[0] == 12
|
||||
&& ap[-1] == '$'
|
||||
&& trail == 'y')
|
||||
{
|
||||
initial_cursor_blink = (tp[j + 4] == '1');
|
||||
initial_cursor_blink = (arg[1] == '1');
|
||||
rbm_status.tr_progress = STATUS_GOT;
|
||||
LOG_TR(("Received cursor blinking mode response: %s", tp));
|
||||
key_name[0] = (int)KS_EXTRA;
|
||||
key_name[1] = (int)KE_IGNORE;
|
||||
slen = i + 1;
|
||||
slen = csi_len;
|
||||
# ifdef FEAT_EVAL
|
||||
set_vim_var_string(VV_TERMBLINKRESP, tp, slen);
|
||||
# endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for a window position response from the terminal:
|
||||
* {lead}3;{x};{y}t
|
||||
*/
|
||||
else if (did_request_winpos
|
||||
&& ((len >= 4 && tp[0] == ESC && tp[1] == '[')
|
||||
|| (len >= 3 && tp[0] == CSI))
|
||||
&& tp[(j = 1 + (tp[0] == ESC))] == '3'
|
||||
&& tp[j + 1] == ';')
|
||||
// Check for a window position response from the terminal:
|
||||
// {lead}3;{x};{y}t
|
||||
else if (did_request_winpos && argc == 3 && arg[0] == 3
|
||||
&& trail == 't')
|
||||
{
|
||||
j += 2;
|
||||
for (i = j; i < len && vim_isdigit(tp[i]); ++i)
|
||||
;
|
||||
if (i < len && tp[i] == ';')
|
||||
{
|
||||
winpos_x = atoi((char *)tp + j);
|
||||
j = i + 1;
|
||||
for (i = j; i < len && vim_isdigit(tp[i]); ++i)
|
||||
;
|
||||
if (i < len && tp[i] == 't')
|
||||
{
|
||||
winpos_y = atoi((char *)tp + j);
|
||||
/* got finished code: consume it */
|
||||
key_name[0] = (int)KS_EXTRA;
|
||||
key_name[1] = (int)KE_IGNORE;
|
||||
slen = i + 1;
|
||||
winpos_x = arg[1];
|
||||
winpos_y = arg[2];
|
||||
// got finished code: consume it
|
||||
key_name[0] = (int)KS_EXTRA;
|
||||
key_name[1] = (int)KE_IGNORE;
|
||||
slen = csi_len;
|
||||
|
||||
if (--did_request_winpos <= 0)
|
||||
winpos_status.tr_progress = STATUS_GOT;
|
||||
}
|
||||
}
|
||||
if (i == len)
|
||||
{
|
||||
LOG_TR(("not enough characters for winpos"));
|
||||
return -1;
|
||||
}
|
||||
if (--did_request_winpos <= 0)
|
||||
winpos_status.tr_progress = STATUS_GOT;
|
||||
}
|
||||
|
||||
// Key with modifier:
|
||||
// {lead}27;{modifier};{key}~
|
||||
// {lead}{key};{modifier}u
|
||||
else if ((arg[0] == 27 && argc == 3 && trail == '~')
|
||||
|| (argc == 2 && trail == 'u'))
|
||||
{
|
||||
seenModifyOtherKeys = TRUE;
|
||||
if (trail == 'u')
|
||||
key = arg[0];
|
||||
else
|
||||
key = arg[2];
|
||||
|
||||
modifiers = decode_modifiers(arg[1]);
|
||||
|
||||
// Some keys already have Shift included, pass them as
|
||||
// normal keys. Not when Ctrl is also used, because <C-H>
|
||||
// and <C-S-H> are different.
|
||||
if (modifiers == MOD_MASK_SHIFT
|
||||
&& ((key >= '@' && key <= 'Z')
|
||||
|| key == '^' || key == '_'
|
||||
|| (key >= '{' && key <= '~')))
|
||||
modifiers = 0;
|
||||
|
||||
// When used with Ctrl we always make a letter upper case,
|
||||
// so that mapping <C-H> and <C-h> are the same. Typing
|
||||
// <C-S-H> also uses "H" but modifier is different.
|
||||
if ((modifiers & MOD_MASK_CTRL) && ASCII_ISALPHA(key))
|
||||
key = TOUPPER_ASC(key);
|
||||
|
||||
// insert modifiers with KS_MODIFIER
|
||||
new_slen = modifiers2keycode(modifiers, &key, string);
|
||||
slen = csi_len;
|
||||
|
||||
if (has_mbyte)
|
||||
new_slen += (*mb_char2bytes)(key, string + new_slen);
|
||||
else
|
||||
string[new_slen++] = key;
|
||||
|
||||
if (put_string_in_typebuf(offset, slen, string, new_slen,
|
||||
buf, bufsize, buflen) == FAIL)
|
||||
return -1;
|
||||
return len + new_slen - slen + offset;
|
||||
}
|
||||
|
||||
// else: Unknown CSI sequence. We could drop it, but then the
|
||||
// user can't create a map for it.
|
||||
}
|
||||
|
||||
/* Check for fore/background color response from the terminal:
|
||||
@@ -5131,19 +5272,7 @@ check_termcode(
|
||||
/*
|
||||
* Add any modifier codes to our string.
|
||||
*/
|
||||
new_slen = 0; /* Length of what will replace the termcode */
|
||||
if (modifiers != 0)
|
||||
{
|
||||
/* Some keys have the modifier included. Need to handle that here
|
||||
* to make mappings work. */
|
||||
key = simplify_key(key, &modifiers);
|
||||
if (modifiers != 0)
|
||||
{
|
||||
string[new_slen++] = K_SPECIAL;
|
||||
string[new_slen++] = (int)KS_MODIFIER;
|
||||
string[new_slen++] = modifiers;
|
||||
}
|
||||
}
|
||||
new_slen = modifiers2keycode(modifiers, &key, string);
|
||||
|
||||
/* Finally, add the special key code to our string */
|
||||
key_name[0] = KEY2TERMCAP0(key);
|
||||
@@ -5169,43 +5298,10 @@ check_termcode(
|
||||
string[new_slen++] = key_name[0];
|
||||
string[new_slen++] = key_name[1];
|
||||
}
|
||||
string[new_slen] = NUL;
|
||||
extra = new_slen - slen;
|
||||
if (buf == NULL)
|
||||
{
|
||||
if (extra < 0)
|
||||
/* remove matched chars, taking care of noremap */
|
||||
del_typebuf(-extra, offset);
|
||||
else if (extra > 0)
|
||||
/* insert the extra space we need */
|
||||
ins_typebuf(string + slen, REMAP_YES, offset, FALSE, FALSE);
|
||||
|
||||
/*
|
||||
* Careful: del_typebuf() and ins_typebuf() may have reallocated
|
||||
* typebuf.tb_buf[]!
|
||||
*/
|
||||
mch_memmove(typebuf.tb_buf + typebuf.tb_off + offset, string,
|
||||
(size_t)new_slen);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (extra < 0)
|
||||
/* remove matched characters */
|
||||
mch_memmove(buf + offset, buf + offset - extra,
|
||||
(size_t)(*buflen + offset + extra));
|
||||
else if (extra > 0)
|
||||
{
|
||||
/* Insert the extra space we need. If there is insufficient
|
||||
* space return -1. */
|
||||
if (*buflen + extra + new_slen >= bufsize)
|
||||
return -1;
|
||||
mch_memmove(buf + offset + extra, buf + offset,
|
||||
(size_t)(*buflen - offset));
|
||||
}
|
||||
mch_memmove(buf + offset, string, (size_t)new_slen);
|
||||
*buflen = *buflen + extra + new_slen;
|
||||
}
|
||||
return retval == 0 ? (len + extra + offset) : retval;
|
||||
if (put_string_in_typebuf(offset, slen, string, new_slen,
|
||||
buf, bufsize, buflen) == FAIL)
|
||||
return -1;
|
||||
return retval == 0 ? (len + new_slen - slen + offset) : retval;
|
||||
}
|
||||
|
||||
#ifdef FEAT_TERMRESPONSE
|
||||
@@ -5258,18 +5354,26 @@ term_get_bg_color(char_u *r, char_u *g, char_u *b)
|
||||
* pointer to it is returned. If something fails *bufp is set to NULL and from
|
||||
* is returned.
|
||||
*
|
||||
* CTRL-V characters are removed. When "from_part" is TRUE, a trailing CTRL-V
|
||||
* is included, otherwise it is removed (for ":map xx ^V", maps xx to
|
||||
* nothing). When 'cpoptions' does not contain 'B', a backslash can be used
|
||||
* instead of a CTRL-V.
|
||||
* CTRL-V characters are removed. When "flags" has REPTERM_FROM_PART, a
|
||||
* trailing CTRL-V is included, otherwise it is removed (for ":map xx ^V", maps
|
||||
* xx to nothing). When 'cpoptions' does not contain 'B', a backslash can be
|
||||
* used instead of a CTRL-V.
|
||||
*
|
||||
* Flags:
|
||||
* REPTERM_FROM_PART see above
|
||||
* REPTERM_DO_LT also translate <lt>
|
||||
* REPTERM_SPECIAL always accept <key> notation
|
||||
* REPTERM_NO_SIMPLIFY do not simplify <C-H> to 0x08 and set 8th bit for <A-x>
|
||||
*
|
||||
* "did_simplify" is set when some <C-H> or <A-x> code was simplified, unless
|
||||
* it is NULL.
|
||||
*/
|
||||
char_u *
|
||||
replace_termcodes(
|
||||
char_u *from,
|
||||
char_u **bufp,
|
||||
int from_part,
|
||||
int do_lt, /* also translate <lt> */
|
||||
int special) /* always accept <key> notation */
|
||||
int flags,
|
||||
int *did_simplify)
|
||||
{
|
||||
int i;
|
||||
int slen;
|
||||
@@ -5282,7 +5386,8 @@ replace_termcodes(
|
||||
char_u *result; /* buffer for resulting string */
|
||||
|
||||
do_backslash = (vim_strchr(p_cpo, CPO_BSLASH) == NULL);
|
||||
do_special = (vim_strchr(p_cpo, CPO_SPECI) == NULL) || special;
|
||||
do_special = (vim_strchr(p_cpo, CPO_SPECI) == NULL)
|
||||
|| (flags & REPTERM_SPECIAL);
|
||||
do_key_code = (vim_strchr(p_cpo, CPO_KEYCODE) == NULL);
|
||||
|
||||
/*
|
||||
@@ -5301,7 +5406,7 @@ replace_termcodes(
|
||||
/*
|
||||
* Check for #n at start only: function key n
|
||||
*/
|
||||
if (from_part && src[0] == '#' && VIM_ISDIGIT(src[1])) /* function key */
|
||||
if ((flags & REPTERM_FROM_PART) && src[0] == '#' && VIM_ISDIGIT(src[1]))
|
||||
{
|
||||
result[dlen++] = K_SPECIAL;
|
||||
result[dlen++] = 'k';
|
||||
@@ -5321,7 +5426,8 @@ replace_termcodes(
|
||||
* If 'cpoptions' does not contain '<', check for special key codes,
|
||||
* like "<C-S-LeftMouse>"
|
||||
*/
|
||||
if (do_special && (do_lt || STRNCMP(src, "<lt>", 4) != 0))
|
||||
if (do_special && ((flags & REPTERM_DO_LT)
|
||||
|| STRNCMP(src, "<lt>", 4) != 0))
|
||||
{
|
||||
#ifdef FEAT_EVAL
|
||||
/*
|
||||
@@ -5347,7 +5453,8 @@ replace_termcodes(
|
||||
}
|
||||
#endif
|
||||
|
||||
slen = trans_special(&src, result + dlen, TRUE, FALSE);
|
||||
slen = trans_special(&src, result + dlen, TRUE, FALSE,
|
||||
(flags & REPTERM_NO_SIMPLIFY) == 0, did_simplify);
|
||||
if (slen)
|
||||
{
|
||||
dlen += slen;
|
||||
@@ -5427,7 +5534,7 @@ replace_termcodes(
|
||||
++src; /* skip CTRL-V or backslash */
|
||||
if (*src == NUL)
|
||||
{
|
||||
if (from_part)
|
||||
if (flags & REPTERM_FROM_PART)
|
||||
result[dlen++] = key;
|
||||
break;
|
||||
}
|
||||
|
||||
+6
-2
@@ -65,7 +65,9 @@ enum SpecialKey
|
||||
KS_KS, /* put term in "keypad transmit" mode */
|
||||
KS_KE, /* out of "keypad transmit" mode */
|
||||
KS_TI, /* put terminal in termcap mode */
|
||||
KS_TE, /* out of termcap mode */
|
||||
KS_CTI, /* put terminal in "raw" mode */
|
||||
KS_TE, /* end of termcap mode */
|
||||
KS_CTE, /* end of "raw" mode */
|
||||
KS_BC, /* backspace character (cursor left) */
|
||||
KS_CCS, /* cur is relative to scroll region */
|
||||
KS_CCO, /* number of colors */
|
||||
@@ -164,7 +166,9 @@ extern char_u *(term_strings[]); /* current terminal strings */
|
||||
#define T_KS (TERM_STR(KS_KS)) /* put term in "keypad transmit" mode */
|
||||
#define T_KE (TERM_STR(KS_KE)) /* out of "keypad transmit" mode */
|
||||
#define T_TI (TERM_STR(KS_TI)) /* put terminal in termcap mode */
|
||||
#define T_TE (TERM_STR(KS_TE)) /* out of termcap mode */
|
||||
#define T_CTI (TERM_STR(KS_CTI)) /* put terminal in "raw" mode */
|
||||
#define T_TE (TERM_STR(KS_TE)) /* end of termcap mode */
|
||||
#define T_CTE (TERM_STR(KS_CTE)) /* end of "raw" mode */
|
||||
#define T_BC (TERM_STR(KS_BC)) /* backspace character */
|
||||
#define T_CCS (TERM_STR(KS_CCS)) /* cur is relative to scroll region */
|
||||
#define T_CCO (TERM_STR(KS_CCO)) /* number of colors */
|
||||
|
||||
+28
-5
@@ -772,7 +772,8 @@ ex_terminal(exarg_T *eap)
|
||||
|
||||
p = skiptowhite(cmd);
|
||||
*p = NUL;
|
||||
keys = replace_termcodes(ep + 1, &buf, TRUE, TRUE, TRUE);
|
||||
keys = replace_termcodes(ep + 1, &buf,
|
||||
REPTERM_FROM_PART | REPTERM_DO_LT | REPTERM_SPECIAL, NULL);
|
||||
opt.jo_set2 |= JO2_EOF_CHARS;
|
||||
opt.jo_eof_chars = vim_strsave(keys);
|
||||
vim_free(buf);
|
||||
@@ -1376,11 +1377,18 @@ term_convert_key(term_T *term, int c, char *buf)
|
||||
break;
|
||||
}
|
||||
|
||||
// add modifiers for the typed key
|
||||
if (mod_mask & MOD_MASK_SHIFT)
|
||||
mod |= VTERM_MOD_SHIFT;
|
||||
if (mod_mask & MOD_MASK_CTRL)
|
||||
mod |= VTERM_MOD_CTRL;
|
||||
if (mod_mask & (MOD_MASK_ALT | MOD_MASK_META))
|
||||
mod |= VTERM_MOD_ALT;
|
||||
|
||||
/*
|
||||
* Convert special keys to vterm keys:
|
||||
* - Write keys to vterm: vterm_keyboard_key()
|
||||
* - Write output to channel.
|
||||
* TODO: use mod_mask
|
||||
*/
|
||||
if (key != VTERM_KEY_NONE)
|
||||
/* Special key, let vterm convert it. */
|
||||
@@ -1907,15 +1915,21 @@ term_vgetc()
|
||||
{
|
||||
int c;
|
||||
int save_State = State;
|
||||
int modify_other_keys =
|
||||
vterm_is_modify_other_keys(curbuf->b_term->tl_vterm);
|
||||
|
||||
State = TERMINAL;
|
||||
got_int = FALSE;
|
||||
#ifdef MSWIN
|
||||
ctrl_break_was_pressed = FALSE;
|
||||
#endif
|
||||
if (modify_other_keys)
|
||||
++no_reduce_keys;
|
||||
c = vgetc();
|
||||
got_int = FALSE;
|
||||
State = save_State;
|
||||
if (modify_other_keys)
|
||||
--no_reduce_keys;
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -2260,6 +2274,7 @@ term_win_entered()
|
||||
terminal_loop(int blocking)
|
||||
{
|
||||
int c;
|
||||
int raw_c;
|
||||
int termwinkey = 0;
|
||||
int ret;
|
||||
#ifdef UNIX
|
||||
@@ -2312,6 +2327,13 @@ terminal_loop(int blocking)
|
||||
if (c == K_IGNORE)
|
||||
continue;
|
||||
|
||||
// vgetc may not include CTRL in the key when modify_other_keys is set.
|
||||
raw_c = c;
|
||||
if ((mod_mask & MOD_MASK_CTRL)
|
||||
&& ((c >= '`' && c <= 0x7f)
|
||||
|| (c >= '@' && c <= '_')))
|
||||
c &= 0x1f;
|
||||
|
||||
#ifdef UNIX
|
||||
/*
|
||||
* The shell or another program may change the tty settings. Getting
|
||||
@@ -2422,7 +2444,7 @@ terminal_loop(int blocking)
|
||||
c = wc;
|
||||
}
|
||||
# endif
|
||||
if (send_keys_to_term(curbuf->b_term, c, TRUE) != OK)
|
||||
if (send_keys_to_term(curbuf->b_term, raw_c, TRUE) != OK)
|
||||
{
|
||||
if (c == K_MOUSEMOVE)
|
||||
/* We are sure to come back here, don't reset the cursor color
|
||||
@@ -4607,6 +4629,7 @@ read_dump_file(FILE *fd, VTermPos *cursor_pos)
|
||||
}
|
||||
|
||||
ga_clear(&ga_text);
|
||||
ga_clear(&ga_cell);
|
||||
vim_free(prev_char);
|
||||
|
||||
return max_cells;
|
||||
@@ -4738,7 +4761,7 @@ term_load_dump(typval_T *argvars, typval_T *rettv, int do_diff)
|
||||
buf = curbuf;
|
||||
while (!(curbuf->b_ml.ml_flags & ML_EMPTY))
|
||||
ml_delete((linenr_T)1, FALSE);
|
||||
ga_clear(&curbuf->b_term->tl_scrollback);
|
||||
free_scrollback(curbuf->b_term);
|
||||
redraw_later(NOT_VALID);
|
||||
}
|
||||
}
|
||||
@@ -5435,7 +5458,7 @@ f_term_scrape(typval_T *argvars, typval_T *rettv)
|
||||
attrs = cellattr->attrs;
|
||||
fg = cellattr->fg;
|
||||
bg = cellattr->bg;
|
||||
len = MB_PTR2LEN(p);
|
||||
len = mb_ptr2len(p);
|
||||
mch_memmove(mbs, p, len);
|
||||
mbs[len] = NUL;
|
||||
p += len;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user