Mercurial > vim
annotate src/digraph.c @ 32936:c517845bd10e v9.0.1776
patch 9.0.1776: No support for stable Python 3 ABI
Commit: https://github.com/vim/vim/commit/c13b3d1350b60b94fe87f0761ea31c0e7fb6ebf3
Author: Yee Cheng Chin <ychin.git@gmail.com>
Date: Sun Aug 20 21:18:38 2023 +0200
patch 9.0.1776: No support for stable Python 3 ABI
Problem: No support for stable Python 3 ABI
Solution: Support Python 3 stable ABI
Commits:
1) Support Python 3 stable ABI to allow mixed version interoperatbility
Vim currently supports embedding Python for use with plugins, and the
"dynamic" linking option allows the user to specify a locally installed
version of Python by setting `pythonthreedll`. However, one caveat is
that the Python 3 libs are not binary compatible across minor versions,
and mixing versions can potentially be dangerous (e.g. let's say Vim was
linked against the Python 3.10 SDK, but the user sets `pythonthreedll`
to a 3.11 lib). Usually, nothing bad happens, but in theory this could
lead to crashes, memory corruption, and other unpredictable behaviors.
It's also difficult for the user to tell something is wrong because Vim
has no way of reporting what Python 3 version Vim was linked with.
For Vim installed via a package manager, this usually isn't an issue
because all the dependencies would already be figured out. For prebuilt
Vim binaries like MacVim (my motivation for working on this), AppImage,
and Win32 installer this could potentially be an issue as usually a
single binary is distributed. This is more tricky when a new Python
version is released, as there's a chicken-and-egg issue with deciding
what Python version to build against and hard to keep in sync when a new
Python version just drops and we have a mix of users of different Python
versions, and a user just blindly upgrading to a new Python could lead to
bad interactions with Vim.
Python 3 does have a solution for this problem: stable ABI / limited API
(see https://docs.python.org/3/c-api/stable.html). The C SDK limits the
API to a set of functions that are promised to be stable across
versions. This pull request adds an ifdef config that allows us to turn
it on when building Vim. Vim binaries built with this option should be
safe to freely link with any Python 3 libraies without having the
constraint of having to use the same minor version.
Note: Python 2 has no such concept and this doesn't change how Python 2
integration works (not that there is going to be a new version of Python
2 that would cause compatibility issues in the future anyway).
---
Technical details:
======
The stable ABI can be accessed when we compile with the Python 3 limited
API (by defining `Py_LIMITED_API`). The Python 3 code (in `if_python3.c`
and `if_py_both.h`) would now handle this and switch to limited API
mode. Without it set, Vim will still use the full API as before so this
is an opt-in change.
The main difference is that `PyType_Object` is now an opaque struct that
we can't directly create "static types" out of, and we have to create
type objects as "heap types" instead. This is because the struct is not
stable and changes from version to version (e.g. 3.8 added a
`tp_vectorcall` field to it). I had to change all the types to be
allocated on the heap instead with just a pointer to them.
Other functions are also simply missing in limited API, or they are
introduced too late (e.g. `PyUnicode_AsUTF8AndSize` in 3.10) to it that
we need some other ways to do the same thing, so I had to abstract a few
things into macros, and sometimes re-implement functions like
`PyObject_NEW`.
One caveat is that in limited API, `OutputType` (used for replacing
`sys.stdout`) no longer inherits from `PyStdPrinter_Type` which I don't
think has any real issue other than minor differences in how they
convert to a string and missing a couple functions like `mode()` and
`fileno()`.
Also fixed an existing bug where `tp_basicsize` was set incorrectly for
`BufferObject`, `TabListObject, `WinListObject`.
Technically, there could be a small performance drop, there is a little
more indirection with accessing type objects, and some APIs like
`PyUnicode_AsUTF8AndSize` are missing, but in practice I didn't see any
difference, and any well-written Python plugin should try to avoid
excessing callbacks to the `vim` module in Python anyway.
I only tested limited API mode down to Python 3.7, which seemes to
compile and work fine. I haven't tried earlier Python versions.
2) Fix PyIter_Check on older Python vers / type##Ptr unused warning
For PyIter_Check, older versions exposed them as either macros (used in
full API), or a function (for use in limited API). A previous change
exposed PyIter_Check to the dynamic build because Python just moved it
to function-only in 3.10 anyway. Because of that, just make sure we
always grab the function in dynamic builds in earlier versions since
that's what Python eventually did anyway.
3) Move Py_LIMITED_API define to configure script
Can now use --with-python-stable-abi flag to customize what stable ABI
version to target. Can also use an env var to do so as well.
4) Show +python/dyn-stable in :version, and allow has() feature query
Not sure if the "/dyn-stable" suffix would break things, or whether we
should do it another way. Or just don't show it in version and rely on
has() feature checking.
5) Documentation first draft. Still need to implement v:python3_version
6) Fix PyIter_Check build breaks when compiling against Python 3.8
7) Add CI coverage stable ABI on Linux/Windows / make configurable on Windows
This adds configurable options for Windows make files (both MinGW and
MSVC). CI will also now exercise both traditional full API and stable
ABI for Linux and Windows in the matrix for coverage.
Also added a "dynamic" option to Linux matrix as a drive-by change to
make other scripting languages like Ruby / Perl testable under both
static and dynamic builds.
8) Fix inaccuracy in Windows docs
Python's own docs are confusing but you don't actually want to use
`python3.dll` for the dynamic linkage.
9) Add generated autoconf file
10) Add v:python3_version support
This variable indicates the version of Python3 that Vim was built
against (PY_VERSION_HEX), and will be useful to check whether the Python
library you are loading in dynamically actually fits it. When built with
stable ABI, it will be the limited ABI version instead
(`Py_LIMITED_API`), which indicates the minimum version of Python 3 the
user should have, rather than the exact match. When stable ABI is used,
we won't be exposing PY_VERSION_HEX in this var because it just doesn't
seem necessary to do so (the whole point of stable ABI is the promise
that it will work across versions), and I don't want to confuse the user
with too many variables.
Also, cleaned up some documentation, and added help tags.
11) Fix Python 3.7 compat issues
Fix a couple issues when using limited API < 3.8
- Crash on exit: In Python 3.7, if a heap-allocated type is destroyed
before all instances are, it would cause a crash later. This happens
when we destroyed `OptionsType` before calling `Py_Finalize` when
using the limited API. To make it worse, later versions changed the
semantics and now each instance has a strong reference to its own type
and the recommendation has changed to have each instance de-ref its
own type and have its type in GC traversal. To avoid dealing with
these cross-version variations, we just don't free the heap type. They
are static types in non-limited-API anyway and are designed to last
through the entirety of the app, and we also don't restart the Python
runtime and therefore do not need it to have absolutely 0 leaks.
See:
- https://docs.python.org/3/whatsnew/3.8.html#changes-in-the-c-api
- https://docs.python.org/3/whatsnew/3.9.html#changes-in-the-c-api
- PyIter_Check: This function is not provided in limited APIs older than
3.8. Previously I was trying to mock it out using manual
PyType_GetSlot() but it was brittle and also does not actually work
properly for static types (it will generate a Python error). Just
return false. It does mean using limited API < 3.8 is not recommended
as you lose the functionality to handle iterators, but from playing
with plugins I couldn't find it to be an issue.
- Fix loading of PyIter_Check so it will be done when limited API < 3.8.
Otherwise loading a 3.7 Python lib will fail even if limited API was
specified to use it.
12) Make sure to only load `PyUnicode_AsUTF8AndSize` in needed in limited API
We don't use this function unless limited API >= 3.10, but we were
loading it regardless. Usually it's ok in Unix-like systems where Python
just has a single lib that we load from, but in Windows where there is a
separate python3.dll this would not work as the symbol would not have
been exposed in this more limited DLL file. This makes it much clearer
under what condition is this function needed.
closes: #12032
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 20 Aug 2023 21:30:04 +0200 |
parents | e16361210675 |
children | 74a0f1bc62b1 |
rev | line source |
---|---|
10042
4aead6a9b7a9
commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents:
9719
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
7 | 2 * |
3 * VIM - Vi IMproved by Bram Moolenaar | |
4 * | |
5 * Do ":help uganda" in Vim to read copying and usage conditions. | |
6 * Do ":help credits" in Vim to see a list of people who contributed. | |
7 * See README.txt for an overview of the Vim source code. | |
8 */ | |
9 | |
10 /* | |
11 * digraph.c: code for digraphs | |
12 */ | |
13 | |
14 #include "vim.h" | |
15 | |
16 #if defined(FEAT_DIGRAPHS) || defined(PROTO) | |
17 | |
18 typedef int result_T; | |
19 | |
20 typedef struct digraph | |
21 { | |
22 char_u char1; | |
23 char_u char2; | |
24 result_T result; | |
25 } digr_T; | |
26 | |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
27 static void printdigraph(digr_T *dp, result_T *previous); |
7 | 28 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
29 // digraphs added by the user |
1869 | 30 static garray_T user_digraphs = {0, 0, (int)sizeof(digr_T), 10, NULL}; |
7 | 31 |
32 /* | |
29980
f0952e40de8e
patch 9.0.0328: OLD_DIGRAPHS is unused
Bram Moolenaar <Bram@vim.org>
parents:
29812
diff
changeset
|
33 * digraphs for Unicode from RFC1345 |
f0952e40de8e
patch 9.0.0328: OLD_DIGRAPHS is unused
Bram Moolenaar <Bram@vim.org>
parents:
29812
diff
changeset
|
34 * (also work for ISO-8859-1 aka latin1) |
f0952e40de8e
patch 9.0.0328: OLD_DIGRAPHS is unused
Bram Moolenaar <Bram@vim.org>
parents:
29812
diff
changeset
|
35 * |
7 | 36 * Note: Characters marked with XX are not included literally, because some |
37 * compilers cannot handle them (Amiga SAS/C is the most picky one). | |
38 */ | |
29980
f0952e40de8e
patch 9.0.0328: OLD_DIGRAPHS is unused
Bram Moolenaar <Bram@vim.org>
parents:
29812
diff
changeset
|
39 static digr_T digraphdefault[] = { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
40 {'N', 'U', 0x0a}, // LF for NUL |
7 | 41 {'S', 'H', 0x01}, |
42 {'S', 'X', 0x02}, | |
43 {'E', 'X', 0x03}, | |
44 {'E', 'T', 0x04}, | |
45 {'E', 'Q', 0x05}, | |
46 {'A', 'K', 0x06}, | |
47 {'B', 'L', 0x07}, | |
48 {'B', 'S', 0x08}, | |
49 {'H', 'T', 0x09}, | |
50 {'L', 'F', 0x0a}, | |
51 {'V', 'T', 0x0b}, | |
52 {'F', 'F', 0x0c}, | |
53 {'C', 'R', 0x0d}, | |
54 {'S', 'O', 0x0e}, | |
55 {'S', 'I', 0x0f}, | |
56 {'D', 'L', 0x10}, | |
57 {'D', '1', 0x11}, | |
58 {'D', '2', 0x12}, | |
59 {'D', '3', 0x13}, | |
60 {'D', '4', 0x14}, | |
61 {'N', 'K', 0x15}, | |
62 {'S', 'Y', 0x16}, | |
63 {'E', 'B', 0x17}, | |
64 {'C', 'N', 0x18}, | |
65 {'E', 'M', 0x19}, | |
66 {'S', 'B', 0x1a}, | |
67 {'E', 'C', 0x1b}, | |
68 {'F', 'S', 0x1c}, | |
69 {'G', 'S', 0x1d}, | |
70 {'R', 'S', 0x1e}, | |
71 {'U', 'S', 0x1f}, | |
72 {'S', 'P', 0x20}, | |
73 {'N', 'b', 0x23}, | |
74 {'D', 'O', 0x24}, | |
75 {'A', 't', 0x40}, | |
76 {'<', '(', 0x5b}, | |
77 {'/', '/', 0x5c}, | |
78 {')', '>', 0x5d}, | |
79 {'\'', '>', 0x5e}, | |
80 {'\'', '!', 0x60}, | |
81 {'(', '!', 0x7b}, | |
82 {'!', '!', 0x7c}, | |
83 {'!', ')', 0x7d}, | |
84 {'\'', '?', 0x7e}, | |
85 {'D', 'T', 0x7f}, | |
86 {'P', 'A', 0x80}, | |
87 {'H', 'O', 0x81}, | |
88 {'B', 'H', 0x82}, | |
89 {'N', 'H', 0x83}, | |
90 {'I', 'N', 0x84}, | |
91 {'N', 'L', 0x85}, | |
92 {'S', 'A', 0x86}, | |
93 {'E', 'S', 0x87}, | |
94 {'H', 'S', 0x88}, | |
95 {'H', 'J', 0x89}, | |
96 {'V', 'S', 0x8a}, | |
97 {'P', 'D', 0x8b}, | |
98 {'P', 'U', 0x8c}, | |
99 {'R', 'I', 0x8d}, | |
100 {'S', '2', 0x8e}, | |
101 {'S', '3', 0x8f}, | |
102 {'D', 'C', 0x90}, | |
103 {'P', '1', 0x91}, | |
104 {'P', '2', 0x92}, | |
105 {'T', 'S', 0x93}, | |
106 {'C', 'C', 0x94}, | |
107 {'M', 'W', 0x95}, | |
108 {'S', 'G', 0x96}, | |
109 {'E', 'G', 0x97}, | |
110 {'S', 'S', 0x98}, | |
111 {'G', 'C', 0x99}, | |
112 {'S', 'C', 0x9a}, | |
113 {'C', 'I', 0x9b}, | |
114 {'S', 'T', 0x9c}, | |
115 {'O', 'C', 0x9d}, | |
116 {'P', 'M', 0x9e}, | |
117 {'A', 'C', 0x9f}, | |
118 {'N', 'S', 0xa0}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
119 # define DG_START_LATIN 0xa1 |
7 | 120 {'!', 'I', 0xa1}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
121 {'~', '!', 0xa1}, // ¡ Vim 5.x compatible |
7 | 122 {'C', 't', 0xa2}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
123 {'c', '|', 0xa2}, // ¢ Vim 5.x compatible |
7 | 124 {'P', 'd', 0xa3}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
125 {'$', '$', 0xa3}, // £ Vim 5.x compatible |
7 | 126 {'C', 'u', 0xa4}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
127 {'o', 'x', 0xa4}, // ¤ Vim 5.x compatible |
7 | 128 {'Y', 'e', 0xa5}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
129 {'Y', '-', 0xa5}, // ¥ Vim 5.x compatible |
7 | 130 {'B', 'B', 0xa6}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
131 {'|', '|', 0xa6}, // ¦ Vim 5.x compatible |
7 | 132 {'S', 'E', 0xa7}, |
133 {'\'', ':', 0xa8}, | |
134 {'C', 'o', 0xa9}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
135 {'c', 'O', 0xa9}, // © Vim 5.x compatible |
7 | 136 {'-', 'a', 0xaa}, |
137 {'<', '<', 0xab}, | |
138 {'N', 'O', 0xac}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
139 {'-', ',', 0xac}, // ¬ Vim 5.x compatible |
7 | 140 {'-', '-', 0xad}, |
141 {'R', 'g', 0xae}, | |
142 {'\'', 'm', 0xaf}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
143 {'-', '=', 0xaf}, // ¯ Vim 5.x compatible |
7 | 144 {'D', 'G', 0xb0}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
145 {'~', 'o', 0xb0}, // ° Vim 5.x compatible |
7 | 146 {'+', '-', 0xb1}, |
147 {'2', 'S', 0xb2}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
148 {'2', '2', 0xb2}, // ² Vim 5.x compatible |
7 | 149 {'3', 'S', 0xb3}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
150 {'3', '3', 0xb3}, // ³ Vim 5.x compatible |
7 | 151 {'\'', '\'', 0xb4}, |
152 {'M', 'y', 0xb5}, | |
153 {'P', 'I', 0xb6}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
154 {'p', 'p', 0xb6}, // ¶ Vim 5.x compatible |
7 | 155 {'.', 'M', 0xb7}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
156 {'~', '.', 0xb7}, // · Vim 5.x compatible |
7 | 157 {'\'', ',', 0xb8}, |
158 {'1', 'S', 0xb9}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
159 {'1', '1', 0xb9}, // ¹ Vim 5.x compatible |
7 | 160 {'-', 'o', 0xba}, |
161 {'>', '>', 0xbb}, | |
162 {'1', '4', 0xbc}, | |
163 {'1', '2', 0xbd}, | |
164 {'3', '4', 0xbe}, | |
165 {'?', 'I', 0xbf}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
166 {'~', '?', 0xbf}, // ¿ Vim 5.x compatible |
7 | 167 {'A', '!', 0xc0}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
168 {'A', '`', 0xc0}, // À Vim 5.x compatible |
7 | 169 {'A', '\'', 0xc1}, |
170 {'A', '>', 0xc2}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
171 {'A', '^', 0xc2}, // Â Vim 5.x compatible |
7 | 172 {'A', '?', 0xc3}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
173 {'A', '~', 0xc3}, // Ã Vim 5.x compatible |
7 | 174 {'A', ':', 0xc4}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
175 {'A', '"', 0xc4}, // Ä Vim 5.x compatible |
7 | 176 {'A', 'A', 0xc5}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
177 {'A', '@', 0xc5}, // Å Vim 5.x compatible |
7 | 178 {'A', 'E', 0xc6}, |
179 {'C', ',', 0xc7}, | |
180 {'E', '!', 0xc8}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
181 {'E', '`', 0xc8}, // È Vim 5.x compatible |
7 | 182 {'E', '\'', 0xc9}, |
183 {'E', '>', 0xca}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
184 {'E', '^', 0xca}, // Ê Vim 5.x compatible |
7 | 185 {'E', ':', 0xcb}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
186 {'E', '"', 0xcb}, // Ë Vim 5.x compatible |
7 | 187 {'I', '!', 0xcc}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
188 {'I', '`', 0xcc}, // Ì Vim 5.x compatible |
7 | 189 {'I', '\'', 0xcd}, |
190 {'I', '>', 0xce}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
191 {'I', '^', 0xce}, // Î Vim 5.x compatible |
7 | 192 {'I', ':', 0xcf}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
193 {'I', '"', 0xcf}, // Ï Vim 5.x compatible |
7 | 194 {'D', '-', 0xd0}, |
195 {'N', '?', 0xd1}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
196 {'N', '~', 0xd1}, // Ñ Vim 5.x compatible |
7 | 197 {'O', '!', 0xd2}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
198 {'O', '`', 0xd2}, // Ò Vim 5.x compatible |
7 | 199 {'O', '\'', 0xd3}, |
200 {'O', '>', 0xd4}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
201 {'O', '^', 0xd4}, // Ô Vim 5.x compatible |
7 | 202 {'O', '?', 0xd5}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
203 {'O', '~', 0xd5}, // Õ Vim 5.x compatible |
7 | 204 {'O', ':', 0xd6}, |
205 {'*', 'X', 0xd7}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
206 {'/', '\\', 0xd7}, // × Vim 5.x compatible |
7 | 207 {'O', '/', 0xd8}, |
208 {'U', '!', 0xd9}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
209 {'U', '`', 0xd9}, // Ù Vim 5.x compatible |
7 | 210 {'U', '\'', 0xda}, |
211 {'U', '>', 0xdb}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
212 {'U', '^', 0xdb}, // Û Vim 5.x compatible |
7 | 213 {'U', ':', 0xdc}, |
214 {'Y', '\'', 0xdd}, | |
215 {'T', 'H', 0xde}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
216 {'I', 'p', 0xde}, // Þ Vim 5.x compatible |
7 | 217 {'s', 's', 0xdf}, |
218 {'a', '!', 0xe0}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
219 {'a', '`', 0xe0}, // à Vim 5.x compatible |
7 | 220 {'a', '\'', 0xe1}, |
221 {'a', '>', 0xe2}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
222 {'a', '^', 0xe2}, // â Vim 5.x compatible |
7 | 223 {'a', '?', 0xe3}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
224 {'a', '~', 0xe3}, // ã Vim 5.x compatible |
7 | 225 {'a', ':', 0xe4}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
226 {'a', '"', 0xe4}, // ä Vim 5.x compatible |
7 | 227 {'a', 'a', 0xe5}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
228 {'a', '@', 0xe5}, // å Vim 5.x compatible |
7 | 229 {'a', 'e', 0xe6}, |
230 {'c', ',', 0xe7}, | |
231 {'e', '!', 0xe8}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
232 {'e', '`', 0xe8}, // è Vim 5.x compatible |
7 | 233 {'e', '\'', 0xe9}, |
234 {'e', '>', 0xea}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
235 {'e', '^', 0xea}, // ê Vim 5.x compatible |
7 | 236 {'e', ':', 0xeb}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
237 {'e', '"', 0xeb}, // ë Vim 5.x compatible |
7 | 238 {'i', '!', 0xec}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
239 {'i', '`', 0xec}, // ì Vim 5.x compatible |
7 | 240 {'i', '\'', 0xed}, |
241 {'i', '>', 0xee}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
242 {'i', '^', 0xee}, // î Vim 5.x compatible |
7 | 243 {'i', ':', 0xef}, |
244 {'d', '-', 0xf0}, | |
245 {'n', '?', 0xf1}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
246 {'n', '~', 0xf1}, // ñ Vim 5.x compatible |
7 | 247 {'o', '!', 0xf2}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
248 {'o', '`', 0xf2}, // ò Vim 5.x compatible |
7 | 249 {'o', '\'', 0xf3}, |
250 {'o', '>', 0xf4}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
251 {'o', '^', 0xf4}, // ô Vim 5.x compatible |
7 | 252 {'o', '?', 0xf5}, |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
253 {'o', '~', 0xf5}, // õ Vim 5.x compatible |
7 | 254 {'o', ':', 0xf6}, |
255 {'-', ':', 0xf7}, | |
256 {'o', '/', 0xf8}, | |
257 {'u', '!', 0xf9}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
258 {'u', '`', 0xf9}, // ù Vim 5.x compatible |
7 | 259 {'u', '\'', 0xfa}, |
260 {'u', '>', 0xfb}, | |
17853
c90ca5b9fc0d
patch 8.1.1923: some source files are not in a normal encoding
Bram Moolenaar <Bram@vim.org>
parents:
17789
diff
changeset
|
261 {'u', '^', 0xfb}, // û Vim 5.x compatible |
7 | 262 {'u', ':', 0xfc}, |
263 {'y', '\'', 0xfd}, | |
264 {'t', 'h', 0xfe}, | |
265 {'y', ':', 0xff}, | |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
266 {'y', '"', 0xff}, // x XX Vim 5.x compatible |
7 | 267 |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
268 # define USE_UNICODE_DIGRAPHS |
7 | 269 |
270 {'A', '-', 0x0100}, | |
271 {'a', '-', 0x0101}, | |
272 {'A', '(', 0x0102}, | |
273 {'a', '(', 0x0103}, | |
274 {'A', ';', 0x0104}, | |
275 {'a', ';', 0x0105}, | |
276 {'C', '\'', 0x0106}, | |
277 {'c', '\'', 0x0107}, | |
278 {'C', '>', 0x0108}, | |
279 {'c', '>', 0x0109}, | |
280 {'C', '.', 0x010a}, | |
281 {'c', '.', 0x010b}, | |
282 {'C', '<', 0x010c}, | |
283 {'c', '<', 0x010d}, | |
284 {'D', '<', 0x010e}, | |
285 {'d', '<', 0x010f}, | |
286 {'D', '/', 0x0110}, | |
287 {'d', '/', 0x0111}, | |
288 {'E', '-', 0x0112}, | |
289 {'e', '-', 0x0113}, | |
290 {'E', '(', 0x0114}, | |
291 {'e', '(', 0x0115}, | |
292 {'E', '.', 0x0116}, | |
293 {'e', '.', 0x0117}, | |
294 {'E', ';', 0x0118}, | |
295 {'e', ';', 0x0119}, | |
296 {'E', '<', 0x011a}, | |
297 {'e', '<', 0x011b}, | |
298 {'G', '>', 0x011c}, | |
299 {'g', '>', 0x011d}, | |
300 {'G', '(', 0x011e}, | |
301 {'g', '(', 0x011f}, | |
302 {'G', '.', 0x0120}, | |
303 {'g', '.', 0x0121}, | |
304 {'G', ',', 0x0122}, | |
305 {'g', ',', 0x0123}, | |
306 {'H', '>', 0x0124}, | |
307 {'h', '>', 0x0125}, | |
308 {'H', '/', 0x0126}, | |
309 {'h', '/', 0x0127}, | |
310 {'I', '?', 0x0128}, | |
311 {'i', '?', 0x0129}, | |
312 {'I', '-', 0x012a}, | |
313 {'i', '-', 0x012b}, | |
314 {'I', '(', 0x012c}, | |
315 {'i', '(', 0x012d}, | |
316 {'I', ';', 0x012e}, | |
317 {'i', ';', 0x012f}, | |
318 {'I', '.', 0x0130}, | |
319 {'i', '.', 0x0131}, | |
320 {'I', 'J', 0x0132}, | |
321 {'i', 'j', 0x0133}, | |
322 {'J', '>', 0x0134}, | |
323 {'j', '>', 0x0135}, | |
324 {'K', ',', 0x0136}, | |
325 {'k', ',', 0x0137}, | |
326 {'k', 'k', 0x0138}, | |
327 {'L', '\'', 0x0139}, | |
328 {'l', '\'', 0x013a}, | |
329 {'L', ',', 0x013b}, | |
330 {'l', ',', 0x013c}, | |
331 {'L', '<', 0x013d}, | |
332 {'l', '<', 0x013e}, | |
333 {'L', '.', 0x013f}, | |
334 {'l', '.', 0x0140}, | |
335 {'L', '/', 0x0141}, | |
336 {'l', '/', 0x0142}, | |
337 {'N', '\'', 0x0143}, | |
338 {'n', '\'', 0x0144}, | |
339 {'N', ',', 0x0145}, | |
340 {'n', ',', 0x0146}, | |
341 {'N', '<', 0x0147}, | |
342 {'n', '<', 0x0148}, | |
343 {'\'', 'n', 0x0149}, | |
344 {'N', 'G', 0x014a}, | |
345 {'n', 'g', 0x014b}, | |
346 {'O', '-', 0x014c}, | |
347 {'o', '-', 0x014d}, | |
348 {'O', '(', 0x014e}, | |
349 {'o', '(', 0x014f}, | |
350 {'O', '"', 0x0150}, | |
351 {'o', '"', 0x0151}, | |
352 {'O', 'E', 0x0152}, | |
353 {'o', 'e', 0x0153}, | |
354 {'R', '\'', 0x0154}, | |
355 {'r', '\'', 0x0155}, | |
356 {'R', ',', 0x0156}, | |
357 {'r', ',', 0x0157}, | |
358 {'R', '<', 0x0158}, | |
359 {'r', '<', 0x0159}, | |
360 {'S', '\'', 0x015a}, | |
361 {'s', '\'', 0x015b}, | |
362 {'S', '>', 0x015c}, | |
363 {'s', '>', 0x015d}, | |
364 {'S', ',', 0x015e}, | |
365 {'s', ',', 0x015f}, | |
366 {'S', '<', 0x0160}, | |
367 {'s', '<', 0x0161}, | |
368 {'T', ',', 0x0162}, | |
369 {'t', ',', 0x0163}, | |
370 {'T', '<', 0x0164}, | |
371 {'t', '<', 0x0165}, | |
372 {'T', '/', 0x0166}, | |
373 {'t', '/', 0x0167}, | |
374 {'U', '?', 0x0168}, | |
375 {'u', '?', 0x0169}, | |
376 {'U', '-', 0x016a}, | |
377 {'u', '-', 0x016b}, | |
378 {'U', '(', 0x016c}, | |
379 {'u', '(', 0x016d}, | |
380 {'U', '0', 0x016e}, | |
381 {'u', '0', 0x016f}, | |
382 {'U', '"', 0x0170}, | |
383 {'u', '"', 0x0171}, | |
384 {'U', ';', 0x0172}, | |
385 {'u', ';', 0x0173}, | |
386 {'W', '>', 0x0174}, | |
387 {'w', '>', 0x0175}, | |
388 {'Y', '>', 0x0176}, | |
389 {'y', '>', 0x0177}, | |
390 {'Y', ':', 0x0178}, | |
391 {'Z', '\'', 0x0179}, | |
392 {'z', '\'', 0x017a}, | |
393 {'Z', '.', 0x017b}, | |
394 {'z', '.', 0x017c}, | |
395 {'Z', '<', 0x017d}, | |
396 {'z', '<', 0x017e}, | |
397 {'O', '9', 0x01a0}, | |
398 {'o', '9', 0x01a1}, | |
399 {'O', 'I', 0x01a2}, | |
400 {'o', 'i', 0x01a3}, | |
401 {'y', 'r', 0x01a6}, | |
402 {'U', '9', 0x01af}, | |
403 {'u', '9', 0x01b0}, | |
404 {'Z', '/', 0x01b5}, | |
405 {'z', '/', 0x01b6}, | |
406 {'E', 'D', 0x01b7}, | |
407 {'A', '<', 0x01cd}, | |
408 {'a', '<', 0x01ce}, | |
409 {'I', '<', 0x01cf}, | |
410 {'i', '<', 0x01d0}, | |
411 {'O', '<', 0x01d1}, | |
412 {'o', '<', 0x01d2}, | |
413 {'U', '<', 0x01d3}, | |
414 {'u', '<', 0x01d4}, | |
415 {'A', '1', 0x01de}, | |
416 {'a', '1', 0x01df}, | |
417 {'A', '7', 0x01e0}, | |
418 {'a', '7', 0x01e1}, | |
419 {'A', '3', 0x01e2}, | |
420 {'a', '3', 0x01e3}, | |
421 {'G', '/', 0x01e4}, | |
422 {'g', '/', 0x01e5}, | |
423 {'G', '<', 0x01e6}, | |
424 {'g', '<', 0x01e7}, | |
425 {'K', '<', 0x01e8}, | |
426 {'k', '<', 0x01e9}, | |
427 {'O', ';', 0x01ea}, | |
428 {'o', ';', 0x01eb}, | |
429 {'O', '1', 0x01ec}, | |
430 {'o', '1', 0x01ed}, | |
431 {'E', 'Z', 0x01ee}, | |
432 {'e', 'z', 0x01ef}, | |
433 {'j', '<', 0x01f0}, | |
434 {'G', '\'', 0x01f4}, | |
435 {'g', '\'', 0x01f5}, | |
436 {';', 'S', 0x02bf}, | |
437 {'\'', '<', 0x02c7}, | |
438 {'\'', '(', 0x02d8}, | |
439 {'\'', '.', 0x02d9}, | |
440 {'\'', '0', 0x02da}, | |
441 {'\'', ';', 0x02db}, | |
442 {'\'', '"', 0x02dd}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
443 # define DG_START_GREEK 0x0386 |
7 | 444 {'A', '%', 0x0386}, |
445 {'E', '%', 0x0388}, | |
446 {'Y', '%', 0x0389}, | |
447 {'I', '%', 0x038a}, | |
448 {'O', '%', 0x038c}, | |
449 {'U', '%', 0x038e}, | |
450 {'W', '%', 0x038f}, | |
451 {'i', '3', 0x0390}, | |
452 {'A', '*', 0x0391}, | |
453 {'B', '*', 0x0392}, | |
454 {'G', '*', 0x0393}, | |
455 {'D', '*', 0x0394}, | |
456 {'E', '*', 0x0395}, | |
457 {'Z', '*', 0x0396}, | |
458 {'Y', '*', 0x0397}, | |
459 {'H', '*', 0x0398}, | |
460 {'I', '*', 0x0399}, | |
461 {'K', '*', 0x039a}, | |
462 {'L', '*', 0x039b}, | |
463 {'M', '*', 0x039c}, | |
464 {'N', '*', 0x039d}, | |
465 {'C', '*', 0x039e}, | |
466 {'O', '*', 0x039f}, | |
467 {'P', '*', 0x03a0}, | |
468 {'R', '*', 0x03a1}, | |
469 {'S', '*', 0x03a3}, | |
470 {'T', '*', 0x03a4}, | |
471 {'U', '*', 0x03a5}, | |
472 {'F', '*', 0x03a6}, | |
473 {'X', '*', 0x03a7}, | |
474 {'Q', '*', 0x03a8}, | |
475 {'W', '*', 0x03a9}, | |
476 {'J', '*', 0x03aa}, | |
477 {'V', '*', 0x03ab}, | |
478 {'a', '%', 0x03ac}, | |
479 {'e', '%', 0x03ad}, | |
480 {'y', '%', 0x03ae}, | |
481 {'i', '%', 0x03af}, | |
482 {'u', '3', 0x03b0}, | |
483 {'a', '*', 0x03b1}, | |
484 {'b', '*', 0x03b2}, | |
485 {'g', '*', 0x03b3}, | |
486 {'d', '*', 0x03b4}, | |
487 {'e', '*', 0x03b5}, | |
488 {'z', '*', 0x03b6}, | |
489 {'y', '*', 0x03b7}, | |
490 {'h', '*', 0x03b8}, | |
491 {'i', '*', 0x03b9}, | |
492 {'k', '*', 0x03ba}, | |
493 {'l', '*', 0x03bb}, | |
494 {'m', '*', 0x03bc}, | |
495 {'n', '*', 0x03bd}, | |
496 {'c', '*', 0x03be}, | |
497 {'o', '*', 0x03bf}, | |
498 {'p', '*', 0x03c0}, | |
499 {'r', '*', 0x03c1}, | |
500 {'*', 's', 0x03c2}, | |
501 {'s', '*', 0x03c3}, | |
502 {'t', '*', 0x03c4}, | |
503 {'u', '*', 0x03c5}, | |
504 {'f', '*', 0x03c6}, | |
505 {'x', '*', 0x03c7}, | |
506 {'q', '*', 0x03c8}, | |
507 {'w', '*', 0x03c9}, | |
508 {'j', '*', 0x03ca}, | |
509 {'v', '*', 0x03cb}, | |
510 {'o', '%', 0x03cc}, | |
511 {'u', '%', 0x03cd}, | |
512 {'w', '%', 0x03ce}, | |
513 {'\'', 'G', 0x03d8}, | |
514 {',', 'G', 0x03d9}, | |
515 {'T', '3', 0x03da}, | |
516 {'t', '3', 0x03db}, | |
517 {'M', '3', 0x03dc}, | |
518 {'m', '3', 0x03dd}, | |
519 {'K', '3', 0x03de}, | |
520 {'k', '3', 0x03df}, | |
521 {'P', '3', 0x03e0}, | |
522 {'p', '3', 0x03e1}, | |
523 {'\'', '%', 0x03f4}, | |
524 {'j', '3', 0x03f5}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
525 # define DG_START_CYRILLIC 0x0401 |
7 | 526 {'I', 'O', 0x0401}, |
527 {'D', '%', 0x0402}, | |
528 {'G', '%', 0x0403}, | |
529 {'I', 'E', 0x0404}, | |
530 {'D', 'S', 0x0405}, | |
531 {'I', 'I', 0x0406}, | |
532 {'Y', 'I', 0x0407}, | |
533 {'J', '%', 0x0408}, | |
534 {'L', 'J', 0x0409}, | |
535 {'N', 'J', 0x040a}, | |
536 {'T', 's', 0x040b}, | |
537 {'K', 'J', 0x040c}, | |
538 {'V', '%', 0x040e}, | |
539 {'D', 'Z', 0x040f}, | |
540 {'A', '=', 0x0410}, | |
541 {'B', '=', 0x0411}, | |
542 {'V', '=', 0x0412}, | |
543 {'G', '=', 0x0413}, | |
544 {'D', '=', 0x0414}, | |
545 {'E', '=', 0x0415}, | |
546 {'Z', '%', 0x0416}, | |
547 {'Z', '=', 0x0417}, | |
548 {'I', '=', 0x0418}, | |
549 {'J', '=', 0x0419}, | |
550 {'K', '=', 0x041a}, | |
551 {'L', '=', 0x041b}, | |
552 {'M', '=', 0x041c}, | |
553 {'N', '=', 0x041d}, | |
554 {'O', '=', 0x041e}, | |
555 {'P', '=', 0x041f}, | |
556 {'R', '=', 0x0420}, | |
557 {'S', '=', 0x0421}, | |
558 {'T', '=', 0x0422}, | |
559 {'U', '=', 0x0423}, | |
560 {'F', '=', 0x0424}, | |
561 {'H', '=', 0x0425}, | |
562 {'C', '=', 0x0426}, | |
563 {'C', '%', 0x0427}, | |
564 {'S', '%', 0x0428}, | |
565 {'S', 'c', 0x0429}, | |
566 {'=', '"', 0x042a}, | |
567 {'Y', '=', 0x042b}, | |
568 {'%', '"', 0x042c}, | |
569 {'J', 'E', 0x042d}, | |
570 {'J', 'U', 0x042e}, | |
571 {'J', 'A', 0x042f}, | |
572 {'a', '=', 0x0430}, | |
573 {'b', '=', 0x0431}, | |
574 {'v', '=', 0x0432}, | |
575 {'g', '=', 0x0433}, | |
576 {'d', '=', 0x0434}, | |
577 {'e', '=', 0x0435}, | |
578 {'z', '%', 0x0436}, | |
579 {'z', '=', 0x0437}, | |
580 {'i', '=', 0x0438}, | |
581 {'j', '=', 0x0439}, | |
582 {'k', '=', 0x043a}, | |
583 {'l', '=', 0x043b}, | |
584 {'m', '=', 0x043c}, | |
585 {'n', '=', 0x043d}, | |
586 {'o', '=', 0x043e}, | |
587 {'p', '=', 0x043f}, | |
588 {'r', '=', 0x0440}, | |
589 {'s', '=', 0x0441}, | |
590 {'t', '=', 0x0442}, | |
591 {'u', '=', 0x0443}, | |
592 {'f', '=', 0x0444}, | |
593 {'h', '=', 0x0445}, | |
594 {'c', '=', 0x0446}, | |
595 {'c', '%', 0x0447}, | |
596 {'s', '%', 0x0448}, | |
597 {'s', 'c', 0x0449}, | |
598 {'=', '\'', 0x044a}, | |
599 {'y', '=', 0x044b}, | |
600 {'%', '\'', 0x044c}, | |
601 {'j', 'e', 0x044d}, | |
602 {'j', 'u', 0x044e}, | |
603 {'j', 'a', 0x044f}, | |
604 {'i', 'o', 0x0451}, | |
605 {'d', '%', 0x0452}, | |
606 {'g', '%', 0x0453}, | |
607 {'i', 'e', 0x0454}, | |
608 {'d', 's', 0x0455}, | |
609 {'i', 'i', 0x0456}, | |
610 {'y', 'i', 0x0457}, | |
611 {'j', '%', 0x0458}, | |
612 {'l', 'j', 0x0459}, | |
613 {'n', 'j', 0x045a}, | |
614 {'t', 's', 0x045b}, | |
615 {'k', 'j', 0x045c}, | |
616 {'v', '%', 0x045e}, | |
617 {'d', 'z', 0x045f}, | |
618 {'Y', '3', 0x0462}, | |
619 {'y', '3', 0x0463}, | |
620 {'O', '3', 0x046a}, | |
621 {'o', '3', 0x046b}, | |
622 {'F', '3', 0x0472}, | |
623 {'f', '3', 0x0473}, | |
624 {'V', '3', 0x0474}, | |
625 {'v', '3', 0x0475}, | |
626 {'C', '3', 0x0480}, | |
627 {'c', '3', 0x0481}, | |
628 {'G', '3', 0x0490}, | |
629 {'g', '3', 0x0491}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
630 # define DG_START_HEBREW 0x05d0 |
7 | 631 {'A', '+', 0x05d0}, |
632 {'B', '+', 0x05d1}, | |
633 {'G', '+', 0x05d2}, | |
634 {'D', '+', 0x05d3}, | |
635 {'H', '+', 0x05d4}, | |
636 {'W', '+', 0x05d5}, | |
637 {'Z', '+', 0x05d6}, | |
638 {'X', '+', 0x05d7}, | |
639 {'T', 'j', 0x05d8}, | |
640 {'J', '+', 0x05d9}, | |
641 {'K', '%', 0x05da}, | |
642 {'K', '+', 0x05db}, | |
643 {'L', '+', 0x05dc}, | |
644 {'M', '%', 0x05dd}, | |
645 {'M', '+', 0x05de}, | |
646 {'N', '%', 0x05df}, | |
647 {'N', '+', 0x05e0}, | |
648 {'S', '+', 0x05e1}, | |
649 {'E', '+', 0x05e2}, | |
650 {'P', '%', 0x05e3}, | |
651 {'P', '+', 0x05e4}, | |
652 {'Z', 'j', 0x05e5}, | |
653 {'Z', 'J', 0x05e6}, | |
654 {'Q', '+', 0x05e7}, | |
655 {'R', '+', 0x05e8}, | |
656 {'S', 'h', 0x05e9}, | |
657 {'T', '+', 0x05ea}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
658 # define DG_START_ARABIC 0x060c |
7 | 659 {',', '+', 0x060c}, |
660 {';', '+', 0x061b}, | |
661 {'?', '+', 0x061f}, | |
662 {'H', '\'', 0x0621}, | |
663 {'a', 'M', 0x0622}, | |
664 {'a', 'H', 0x0623}, | |
665 {'w', 'H', 0x0624}, | |
666 {'a', 'h', 0x0625}, | |
667 {'y', 'H', 0x0626}, | |
668 {'a', '+', 0x0627}, | |
669 {'b', '+', 0x0628}, | |
670 {'t', 'm', 0x0629}, | |
671 {'t', '+', 0x062a}, | |
672 {'t', 'k', 0x062b}, | |
673 {'g', '+', 0x062c}, | |
674 {'h', 'k', 0x062d}, | |
675 {'x', '+', 0x062e}, | |
676 {'d', '+', 0x062f}, | |
677 {'d', 'k', 0x0630}, | |
678 {'r', '+', 0x0631}, | |
679 {'z', '+', 0x0632}, | |
680 {'s', '+', 0x0633}, | |
681 {'s', 'n', 0x0634}, | |
682 {'c', '+', 0x0635}, | |
683 {'d', 'd', 0x0636}, | |
684 {'t', 'j', 0x0637}, | |
685 {'z', 'H', 0x0638}, | |
686 {'e', '+', 0x0639}, | |
687 {'i', '+', 0x063a}, | |
688 {'+', '+', 0x0640}, | |
689 {'f', '+', 0x0641}, | |
690 {'q', '+', 0x0642}, | |
691 {'k', '+', 0x0643}, | |
692 {'l', '+', 0x0644}, | |
693 {'m', '+', 0x0645}, | |
694 {'n', '+', 0x0646}, | |
695 {'h', '+', 0x0647}, | |
696 {'w', '+', 0x0648}, | |
697 {'j', '+', 0x0649}, | |
698 {'y', '+', 0x064a}, | |
699 {':', '+', 0x064b}, | |
700 {'"', '+', 0x064c}, | |
701 {'=', '+', 0x064d}, | |
702 {'/', '+', 0x064e}, | |
703 {'\'', '+', 0x064f}, | |
704 {'1', '+', 0x0650}, | |
705 {'3', '+', 0x0651}, | |
706 {'0', '+', 0x0652}, | |
707 {'a', 'S', 0x0670}, | |
708 {'p', '+', 0x067e}, | |
709 {'v', '+', 0x06a4}, | |
710 {'g', 'f', 0x06af}, | |
711 {'0', 'a', 0x06f0}, | |
712 {'1', 'a', 0x06f1}, | |
713 {'2', 'a', 0x06f2}, | |
714 {'3', 'a', 0x06f3}, | |
715 {'4', 'a', 0x06f4}, | |
716 {'5', 'a', 0x06f5}, | |
717 {'6', 'a', 0x06f6}, | |
718 {'7', 'a', 0x06f7}, | |
719 {'8', 'a', 0x06f8}, | |
720 {'9', 'a', 0x06f9}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
721 # define DG_START_LATIN_EXTENDED 0x1e02 |
7 | 722 {'B', '.', 0x1e02}, |
723 {'b', '.', 0x1e03}, | |
724 {'B', '_', 0x1e06}, | |
725 {'b', '_', 0x1e07}, | |
726 {'D', '.', 0x1e0a}, | |
727 {'d', '.', 0x1e0b}, | |
728 {'D', '_', 0x1e0e}, | |
729 {'d', '_', 0x1e0f}, | |
730 {'D', ',', 0x1e10}, | |
731 {'d', ',', 0x1e11}, | |
732 {'F', '.', 0x1e1e}, | |
733 {'f', '.', 0x1e1f}, | |
734 {'G', '-', 0x1e20}, | |
735 {'g', '-', 0x1e21}, | |
736 {'H', '.', 0x1e22}, | |
737 {'h', '.', 0x1e23}, | |
738 {'H', ':', 0x1e26}, | |
739 {'h', ':', 0x1e27}, | |
740 {'H', ',', 0x1e28}, | |
741 {'h', ',', 0x1e29}, | |
742 {'K', '\'', 0x1e30}, | |
743 {'k', '\'', 0x1e31}, | |
744 {'K', '_', 0x1e34}, | |
745 {'k', '_', 0x1e35}, | |
746 {'L', '_', 0x1e3a}, | |
747 {'l', '_', 0x1e3b}, | |
748 {'M', '\'', 0x1e3e}, | |
749 {'m', '\'', 0x1e3f}, | |
750 {'M', '.', 0x1e40}, | |
751 {'m', '.', 0x1e41}, | |
752 {'N', '.', 0x1e44}, | |
753 {'n', '.', 0x1e45}, | |
754 {'N', '_', 0x1e48}, | |
755 {'n', '_', 0x1e49}, | |
756 {'P', '\'', 0x1e54}, | |
757 {'p', '\'', 0x1e55}, | |
758 {'P', '.', 0x1e56}, | |
759 {'p', '.', 0x1e57}, | |
760 {'R', '.', 0x1e58}, | |
761 {'r', '.', 0x1e59}, | |
762 {'R', '_', 0x1e5e}, | |
763 {'r', '_', 0x1e5f}, | |
764 {'S', '.', 0x1e60}, | |
765 {'s', '.', 0x1e61}, | |
766 {'T', '.', 0x1e6a}, | |
767 {'t', '.', 0x1e6b}, | |
768 {'T', '_', 0x1e6e}, | |
769 {'t', '_', 0x1e6f}, | |
770 {'V', '?', 0x1e7c}, | |
771 {'v', '?', 0x1e7d}, | |
772 {'W', '!', 0x1e80}, | |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
773 {'W', '`', 0x1e80}, // extra alternative, easier to remember |
7 | 774 {'w', '!', 0x1e81}, |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
775 {'w', '`', 0x1e81}, // extra alternative, easier to remember |
7 | 776 {'W', '\'', 0x1e82}, |
777 {'w', '\'', 0x1e83}, | |
778 {'W', ':', 0x1e84}, | |
779 {'w', ':', 0x1e85}, | |
780 {'W', '.', 0x1e86}, | |
781 {'w', '.', 0x1e87}, | |
782 {'X', '.', 0x1e8a}, | |
783 {'x', '.', 0x1e8b}, | |
784 {'X', ':', 0x1e8c}, | |
785 {'x', ':', 0x1e8d}, | |
786 {'Y', '.', 0x1e8e}, | |
787 {'y', '.', 0x1e8f}, | |
788 {'Z', '>', 0x1e90}, | |
789 {'z', '>', 0x1e91}, | |
790 {'Z', '_', 0x1e94}, | |
791 {'z', '_', 0x1e95}, | |
792 {'h', '_', 0x1e96}, | |
793 {'t', ':', 0x1e97}, | |
794 {'w', '0', 0x1e98}, | |
795 {'y', '0', 0x1e99}, | |
796 {'A', '2', 0x1ea2}, | |
797 {'a', '2', 0x1ea3}, | |
798 {'E', '2', 0x1eba}, | |
799 {'e', '2', 0x1ebb}, | |
800 {'E', '?', 0x1ebc}, | |
801 {'e', '?', 0x1ebd}, | |
802 {'I', '2', 0x1ec8}, | |
803 {'i', '2', 0x1ec9}, | |
804 {'O', '2', 0x1ece}, | |
805 {'o', '2', 0x1ecf}, | |
806 {'U', '2', 0x1ee6}, | |
807 {'u', '2', 0x1ee7}, | |
808 {'Y', '!', 0x1ef2}, | |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
809 {'Y', '`', 0x1ef2}, // extra alternative, easier to remember |
7 | 810 {'y', '!', 0x1ef3}, |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
811 {'y', '`', 0x1ef3}, // extra alternative, easier to remember |
7 | 812 {'Y', '2', 0x1ef6}, |
813 {'y', '2', 0x1ef7}, | |
814 {'Y', '?', 0x1ef8}, | |
815 {'y', '?', 0x1ef9}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
816 # define DG_START_GREEK_EXTENDED 0x1f00 |
7 | 817 {';', '\'', 0x1f00}, |
818 {',', '\'', 0x1f01}, | |
819 {';', '!', 0x1f02}, | |
820 {',', '!', 0x1f03}, | |
821 {'?', ';', 0x1f04}, | |
822 {'?', ',', 0x1f05}, | |
823 {'!', ':', 0x1f06}, | |
824 {'?', ':', 0x1f07}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
825 # define DG_START_PUNCTUATION 0x2002 |
7 | 826 {'1', 'N', 0x2002}, |
827 {'1', 'M', 0x2003}, | |
828 {'3', 'M', 0x2004}, | |
829 {'4', 'M', 0x2005}, | |
830 {'6', 'M', 0x2006}, | |
831 {'1', 'T', 0x2009}, | |
832 {'1', 'H', 0x200a}, | |
833 {'-', '1', 0x2010}, | |
834 {'-', 'N', 0x2013}, | |
835 {'-', 'M', 0x2014}, | |
836 {'-', '3', 0x2015}, | |
837 {'!', '2', 0x2016}, | |
838 {'=', '2', 0x2017}, | |
839 {'\'', '6', 0x2018}, | |
840 {'\'', '9', 0x2019}, | |
841 {'.', '9', 0x201a}, | |
842 {'9', '\'', 0x201b}, | |
843 {'"', '6', 0x201c}, | |
844 {'"', '9', 0x201d}, | |
845 {':', '9', 0x201e}, | |
846 {'9', '"', 0x201f}, | |
847 {'/', '-', 0x2020}, | |
848 {'/', '=', 0x2021}, | |
22172
1b23391fac7e
patch 8.2.1635: no digraph for 0x2022 BULLET
Bram Moolenaar <Bram@vim.org>
parents:
21329
diff
changeset
|
849 {'o', 'o', 0x2022}, |
7 | 850 {'.', '.', 0x2025}, |
10334
086117f5fb71
commit https://github.com/vim/vim/commit/81615517249bb78cba9c37c9834b787c1b265521
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
851 {',', '.', 0x2026}, |
7 | 852 {'%', '0', 0x2030}, |
853 {'1', '\'', 0x2032}, | |
854 {'2', '\'', 0x2033}, | |
855 {'3', '\'', 0x2034}, | |
856 {'1', '"', 0x2035}, | |
857 {'2', '"', 0x2036}, | |
858 {'3', '"', 0x2037}, | |
859 {'C', 'a', 0x2038}, | |
860 {'<', '1', 0x2039}, | |
861 {'>', '1', 0x203a}, | |
862 {':', 'X', 0x203b}, | |
863 {'\'', '-', 0x203e}, | |
864 {'/', 'f', 0x2044}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
865 # define DG_START_SUB_SUPER 0x2070 |
7 | 866 {'0', 'S', 0x2070}, |
867 {'4', 'S', 0x2074}, | |
868 {'5', 'S', 0x2075}, | |
869 {'6', 'S', 0x2076}, | |
870 {'7', 'S', 0x2077}, | |
871 {'8', 'S', 0x2078}, | |
872 {'9', 'S', 0x2079}, | |
873 {'+', 'S', 0x207a}, | |
874 {'-', 'S', 0x207b}, | |
875 {'=', 'S', 0x207c}, | |
876 {'(', 'S', 0x207d}, | |
877 {')', 'S', 0x207e}, | |
878 {'n', 'S', 0x207f}, | |
879 {'0', 's', 0x2080}, | |
880 {'1', 's', 0x2081}, | |
881 {'2', 's', 0x2082}, | |
882 {'3', 's', 0x2083}, | |
883 {'4', 's', 0x2084}, | |
884 {'5', 's', 0x2085}, | |
885 {'6', 's', 0x2086}, | |
886 {'7', 's', 0x2087}, | |
887 {'8', 's', 0x2088}, | |
888 {'9', 's', 0x2089}, | |
889 {'+', 's', 0x208a}, | |
890 {'-', 's', 0x208b}, | |
891 {'=', 's', 0x208c}, | |
892 {'(', 's', 0x208d}, | |
893 {')', 's', 0x208e}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
894 # define DG_START_CURRENCY 0x20a4 |
7 | 895 {'L', 'i', 0x20a4}, |
896 {'P', 't', 0x20a7}, | |
897 {'W', '=', 0x20a9}, | |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
898 {'=', 'e', 0x20ac}, // euro |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
899 {'E', 'u', 0x20ac}, // euro |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
900 {'=', 'R', 0x20bd}, // rouble |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
901 {'=', 'P', 0x20bd}, // rouble |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
902 # define DG_START_OTHER1 0x2103 |
7 | 903 {'o', 'C', 0x2103}, |
904 {'c', 'o', 0x2105}, | |
905 {'o', 'F', 0x2109}, | |
906 {'N', '0', 0x2116}, | |
907 {'P', 'O', 0x2117}, | |
908 {'R', 'x', 0x211e}, | |
909 {'S', 'M', 0x2120}, | |
910 {'T', 'M', 0x2122}, | |
911 {'O', 'm', 0x2126}, | |
912 {'A', 'O', 0x212b}, | |
913 {'1', '3', 0x2153}, | |
914 {'2', '3', 0x2154}, | |
915 {'1', '5', 0x2155}, | |
916 {'2', '5', 0x2156}, | |
917 {'3', '5', 0x2157}, | |
918 {'4', '5', 0x2158}, | |
919 {'1', '6', 0x2159}, | |
920 {'5', '6', 0x215a}, | |
921 {'1', '8', 0x215b}, | |
922 {'3', '8', 0x215c}, | |
923 {'5', '8', 0x215d}, | |
924 {'7', '8', 0x215e}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
925 # define DG_START_ROMAN 0x2160 |
7 | 926 {'1', 'R', 0x2160}, |
927 {'2', 'R', 0x2161}, | |
928 {'3', 'R', 0x2162}, | |
929 {'4', 'R', 0x2163}, | |
930 {'5', 'R', 0x2164}, | |
931 {'6', 'R', 0x2165}, | |
932 {'7', 'R', 0x2166}, | |
933 {'8', 'R', 0x2167}, | |
934 {'9', 'R', 0x2168}, | |
935 {'a', 'R', 0x2169}, | |
936 {'b', 'R', 0x216a}, | |
937 {'c', 'R', 0x216b}, | |
938 {'1', 'r', 0x2170}, | |
939 {'2', 'r', 0x2171}, | |
940 {'3', 'r', 0x2172}, | |
941 {'4', 'r', 0x2173}, | |
942 {'5', 'r', 0x2174}, | |
943 {'6', 'r', 0x2175}, | |
944 {'7', 'r', 0x2176}, | |
945 {'8', 'r', 0x2177}, | |
946 {'9', 'r', 0x2178}, | |
947 {'a', 'r', 0x2179}, | |
948 {'b', 'r', 0x217a}, | |
949 {'c', 'r', 0x217b}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
950 # define DG_START_ARROWS 0x2190 |
7 | 951 {'<', '-', 0x2190}, |
952 {'-', '!', 0x2191}, | |
953 {'-', '>', 0x2192}, | |
954 {'-', 'v', 0x2193}, | |
955 {'<', '>', 0x2194}, | |
956 {'U', 'D', 0x2195}, | |
957 {'<', '=', 0x21d0}, | |
958 {'=', '>', 0x21d2}, | |
959 {'=', '=', 0x21d4}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
960 # define DG_START_MATH 0x2200 |
7 | 961 {'F', 'A', 0x2200}, |
962 {'d', 'P', 0x2202}, | |
963 {'T', 'E', 0x2203}, | |
964 {'/', '0', 0x2205}, | |
965 {'D', 'E', 0x2206}, | |
966 {'N', 'B', 0x2207}, | |
967 {'(', '-', 0x2208}, | |
968 {'-', ')', 0x220b}, | |
969 {'*', 'P', 0x220f}, | |
970 {'+', 'Z', 0x2211}, | |
971 {'-', '2', 0x2212}, | |
972 {'-', '+', 0x2213}, | |
973 {'*', '-', 0x2217}, | |
974 {'O', 'b', 0x2218}, | |
975 {'S', 'b', 0x2219}, | |
976 {'R', 'T', 0x221a}, | |
977 {'0', '(', 0x221d}, | |
978 {'0', '0', 0x221e}, | |
979 {'-', 'L', 0x221f}, | |
980 {'-', 'V', 0x2220}, | |
981 {'P', 'P', 0x2225}, | |
982 {'A', 'N', 0x2227}, | |
983 {'O', 'R', 0x2228}, | |
984 {'(', 'U', 0x2229}, | |
985 {')', 'U', 0x222a}, | |
986 {'I', 'n', 0x222b}, | |
987 {'D', 'I', 0x222c}, | |
988 {'I', 'o', 0x222e}, | |
989 {'.', ':', 0x2234}, | |
990 {':', '.', 0x2235}, | |
991 {':', 'R', 0x2236}, | |
992 {':', ':', 0x2237}, | |
993 {'?', '1', 0x223c}, | |
994 {'C', 'G', 0x223e}, | |
995 {'?', '-', 0x2243}, | |
996 {'?', '=', 0x2245}, | |
997 {'?', '2', 0x2248}, | |
998 {'=', '?', 0x224c}, | |
999 {'H', 'I', 0x2253}, | |
1000 {'!', '=', 0x2260}, | |
1001 {'=', '3', 0x2261}, | |
1002 {'=', '<', 0x2264}, | |
1003 {'>', '=', 0x2265}, | |
1004 {'<', '*', 0x226a}, | |
1005 {'*', '>', 0x226b}, | |
1006 {'!', '<', 0x226e}, | |
1007 {'!', '>', 0x226f}, | |
1008 {'(', 'C', 0x2282}, | |
1009 {')', 'C', 0x2283}, | |
1010 {'(', '_', 0x2286}, | |
1011 {')', '_', 0x2287}, | |
1012 {'0', '.', 0x2299}, | |
1013 {'0', '2', 0x229a}, | |
1014 {'-', 'T', 0x22a5}, | |
1015 {'.', 'P', 0x22c5}, | |
1016 {':', '3', 0x22ee}, | |
1017 {'.', '3', 0x22ef}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
1018 # define DG_START_TECHNICAL 0x2302 |
7 | 1019 {'E', 'h', 0x2302}, |
1020 {'<', '7', 0x2308}, | |
1021 {'>', '7', 0x2309}, | |
1022 {'7', '<', 0x230a}, | |
1023 {'7', '>', 0x230b}, | |
1024 {'N', 'I', 0x2310}, | |
1025 {'(', 'A', 0x2312}, | |
1026 {'T', 'R', 0x2315}, | |
1027 {'I', 'u', 0x2320}, | |
1028 {'I', 'l', 0x2321}, | |
1029 {'<', '/', 0x2329}, | |
1030 {'/', '>', 0x232a}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
1031 # define DG_START_OTHER2 0x2423 |
7 | 1032 {'V', 's', 0x2423}, |
1033 {'1', 'h', 0x2440}, | |
1034 {'3', 'h', 0x2441}, | |
1035 {'2', 'h', 0x2442}, | |
1036 {'4', 'h', 0x2443}, | |
1037 {'1', 'j', 0x2446}, | |
1038 {'2', 'j', 0x2447}, | |
1039 {'3', 'j', 0x2448}, | |
1040 {'4', 'j', 0x2449}, | |
1041 {'1', '.', 0x2488}, | |
1042 {'2', '.', 0x2489}, | |
1043 {'3', '.', 0x248a}, | |
1044 {'4', '.', 0x248b}, | |
1045 {'5', '.', 0x248c}, | |
1046 {'6', '.', 0x248d}, | |
1047 {'7', '.', 0x248e}, | |
1048 {'8', '.', 0x248f}, | |
1049 {'9', '.', 0x2490}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
1050 # define DG_START_DRAWING 0x2500 |
7 | 1051 {'h', 'h', 0x2500}, |
1052 {'H', 'H', 0x2501}, | |
1053 {'v', 'v', 0x2502}, | |
1054 {'V', 'V', 0x2503}, | |
1055 {'3', '-', 0x2504}, | |
1056 {'3', '_', 0x2505}, | |
1057 {'3', '!', 0x2506}, | |
1058 {'3', '/', 0x2507}, | |
1059 {'4', '-', 0x2508}, | |
1060 {'4', '_', 0x2509}, | |
1061 {'4', '!', 0x250a}, | |
1062 {'4', '/', 0x250b}, | |
1063 {'d', 'r', 0x250c}, | |
1064 {'d', 'R', 0x250d}, | |
1065 {'D', 'r', 0x250e}, | |
1066 {'D', 'R', 0x250f}, | |
1067 {'d', 'l', 0x2510}, | |
1068 {'d', 'L', 0x2511}, | |
1069 {'D', 'l', 0x2512}, | |
1070 {'L', 'D', 0x2513}, | |
1071 {'u', 'r', 0x2514}, | |
1072 {'u', 'R', 0x2515}, | |
1073 {'U', 'r', 0x2516}, | |
1074 {'U', 'R', 0x2517}, | |
1075 {'u', 'l', 0x2518}, | |
1076 {'u', 'L', 0x2519}, | |
1077 {'U', 'l', 0x251a}, | |
1078 {'U', 'L', 0x251b}, | |
1079 {'v', 'r', 0x251c}, | |
1080 {'v', 'R', 0x251d}, | |
1081 {'V', 'r', 0x2520}, | |
1082 {'V', 'R', 0x2523}, | |
1083 {'v', 'l', 0x2524}, | |
1084 {'v', 'L', 0x2525}, | |
1085 {'V', 'l', 0x2528}, | |
1086 {'V', 'L', 0x252b}, | |
1087 {'d', 'h', 0x252c}, | |
1088 {'d', 'H', 0x252f}, | |
1089 {'D', 'h', 0x2530}, | |
1090 {'D', 'H', 0x2533}, | |
1091 {'u', 'h', 0x2534}, | |
1092 {'u', 'H', 0x2537}, | |
1093 {'U', 'h', 0x2538}, | |
1094 {'U', 'H', 0x253b}, | |
1095 {'v', 'h', 0x253c}, | |
1096 {'v', 'H', 0x253f}, | |
1097 {'V', 'h', 0x2542}, | |
1098 {'V', 'H', 0x254b}, | |
1099 {'F', 'D', 0x2571}, | |
1100 {'B', 'D', 0x2572}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
1101 # define DG_START_BLOCK 0x2580 |
7 | 1102 {'T', 'B', 0x2580}, |
1103 {'L', 'B', 0x2584}, | |
1104 {'F', 'B', 0x2588}, | |
1105 {'l', 'B', 0x258c}, | |
1106 {'R', 'B', 0x2590}, | |
1107 {'.', 'S', 0x2591}, | |
1108 {':', 'S', 0x2592}, | |
1109 {'?', 'S', 0x2593}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
1110 # define DG_START_SHAPES 0x25a0 |
7 | 1111 {'f', 'S', 0x25a0}, |
1112 {'O', 'S', 0x25a1}, | |
1113 {'R', 'O', 0x25a2}, | |
1114 {'R', 'r', 0x25a3}, | |
1115 {'R', 'F', 0x25a4}, | |
1116 {'R', 'Y', 0x25a5}, | |
1117 {'R', 'H', 0x25a6}, | |
1118 {'R', 'Z', 0x25a7}, | |
1119 {'R', 'K', 0x25a8}, | |
1120 {'R', 'X', 0x25a9}, | |
1121 {'s', 'B', 0x25aa}, | |
1122 {'S', 'R', 0x25ac}, | |
1123 {'O', 'r', 0x25ad}, | |
1124 {'U', 'T', 0x25b2}, | |
1125 {'u', 'T', 0x25b3}, | |
1126 {'P', 'R', 0x25b6}, | |
1127 {'T', 'r', 0x25b7}, | |
1128 {'D', 't', 0x25bc}, | |
1129 {'d', 'T', 0x25bd}, | |
1130 {'P', 'L', 0x25c0}, | |
1131 {'T', 'l', 0x25c1}, | |
1132 {'D', 'b', 0x25c6}, | |
1133 {'D', 'w', 0x25c7}, | |
1134 {'L', 'Z', 0x25ca}, | |
1135 {'0', 'm', 0x25cb}, | |
1136 {'0', 'o', 0x25ce}, | |
1137 {'0', 'M', 0x25cf}, | |
1138 {'0', 'L', 0x25d0}, | |
1139 {'0', 'R', 0x25d1}, | |
1140 {'S', 'n', 0x25d8}, | |
1141 {'I', 'c', 0x25d9}, | |
1142 {'F', 'd', 0x25e2}, | |
1143 {'B', 'd', 0x25e3}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
1144 # define DG_START_SYMBOLS 0x2605 |
7 | 1145 {'*', '2', 0x2605}, |
1146 {'*', '1', 0x2606}, | |
1147 {'<', 'H', 0x261c}, | |
1148 {'>', 'H', 0x261e}, | |
1149 {'0', 'u', 0x263a}, | |
1150 {'0', 'U', 0x263b}, | |
1151 {'S', 'U', 0x263c}, | |
1152 {'F', 'm', 0x2640}, | |
1153 {'M', 'l', 0x2642}, | |
1154 {'c', 'S', 0x2660}, | |
1155 {'c', 'H', 0x2661}, | |
1156 {'c', 'D', 0x2662}, | |
1157 {'c', 'C', 0x2663}, | |
1158 {'M', 'd', 0x2669}, | |
1159 {'M', '8', 0x266a}, | |
1160 {'M', '2', 0x266b}, | |
1161 {'M', 'b', 0x266d}, | |
1162 {'M', 'x', 0x266e}, | |
1163 {'M', 'X', 0x266f}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
1164 # define DG_START_DINGBATS 0x2713 |
7 | 1165 {'O', 'K', 0x2713}, |
1166 {'X', 'X', 0x2717}, | |
1167 {'-', 'X', 0x2720}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
1168 # define DG_START_CJK_SYMBOLS 0x3000 |
7 | 1169 {'I', 'S', 0x3000}, |
1170 {',', '_', 0x3001}, | |
1171 {'.', '_', 0x3002}, | |
1172 {'+', '"', 0x3003}, | |
1173 {'+', '_', 0x3004}, | |
1174 {'*', '_', 0x3005}, | |
1175 {';', '_', 0x3006}, | |
1176 {'0', '_', 0x3007}, | |
1177 {'<', '+', 0x300a}, | |
1178 {'>', '+', 0x300b}, | |
1179 {'<', '\'', 0x300c}, | |
1180 {'>', '\'', 0x300d}, | |
1181 {'<', '"', 0x300e}, | |
1182 {'>', '"', 0x300f}, | |
1183 {'(', '"', 0x3010}, | |
1184 {')', '"', 0x3011}, | |
1185 {'=', 'T', 0x3012}, | |
1186 {'=', '_', 0x3013}, | |
1187 {'(', '\'', 0x3014}, | |
1188 {')', '\'', 0x3015}, | |
1189 {'(', 'I', 0x3016}, | |
1190 {')', 'I', 0x3017}, | |
1191 {'-', '?', 0x301c}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
1192 # define DG_START_HIRAGANA 0x3041 |
7 | 1193 {'A', '5', 0x3041}, |
1194 {'a', '5', 0x3042}, | |
1195 {'I', '5', 0x3043}, | |
1196 {'i', '5', 0x3044}, | |
1197 {'U', '5', 0x3045}, | |
1198 {'u', '5', 0x3046}, | |
1199 {'E', '5', 0x3047}, | |
1200 {'e', '5', 0x3048}, | |
1201 {'O', '5', 0x3049}, | |
1202 {'o', '5', 0x304a}, | |
1203 {'k', 'a', 0x304b}, | |
1204 {'g', 'a', 0x304c}, | |
1205 {'k', 'i', 0x304d}, | |
1206 {'g', 'i', 0x304e}, | |
1207 {'k', 'u', 0x304f}, | |
1208 {'g', 'u', 0x3050}, | |
1209 {'k', 'e', 0x3051}, | |
1210 {'g', 'e', 0x3052}, | |
1211 {'k', 'o', 0x3053}, | |
1212 {'g', 'o', 0x3054}, | |
1213 {'s', 'a', 0x3055}, | |
1214 {'z', 'a', 0x3056}, | |
1215 {'s', 'i', 0x3057}, | |
1216 {'z', 'i', 0x3058}, | |
1217 {'s', 'u', 0x3059}, | |
1218 {'z', 'u', 0x305a}, | |
1219 {'s', 'e', 0x305b}, | |
1220 {'z', 'e', 0x305c}, | |
1221 {'s', 'o', 0x305d}, | |
1222 {'z', 'o', 0x305e}, | |
1223 {'t', 'a', 0x305f}, | |
1224 {'d', 'a', 0x3060}, | |
1225 {'t', 'i', 0x3061}, | |
1226 {'d', 'i', 0x3062}, | |
1227 {'t', 'U', 0x3063}, | |
1228 {'t', 'u', 0x3064}, | |
1229 {'d', 'u', 0x3065}, | |
1230 {'t', 'e', 0x3066}, | |
1231 {'d', 'e', 0x3067}, | |
1232 {'t', 'o', 0x3068}, | |
1233 {'d', 'o', 0x3069}, | |
1234 {'n', 'a', 0x306a}, | |
1235 {'n', 'i', 0x306b}, | |
1236 {'n', 'u', 0x306c}, | |
1237 {'n', 'e', 0x306d}, | |
1238 {'n', 'o', 0x306e}, | |
1239 {'h', 'a', 0x306f}, | |
1240 {'b', 'a', 0x3070}, | |
1241 {'p', 'a', 0x3071}, | |
1242 {'h', 'i', 0x3072}, | |
1243 {'b', 'i', 0x3073}, | |
1244 {'p', 'i', 0x3074}, | |
1245 {'h', 'u', 0x3075}, | |
1246 {'b', 'u', 0x3076}, | |
1247 {'p', 'u', 0x3077}, | |
1248 {'h', 'e', 0x3078}, | |
1249 {'b', 'e', 0x3079}, | |
1250 {'p', 'e', 0x307a}, | |
1251 {'h', 'o', 0x307b}, | |
1252 {'b', 'o', 0x307c}, | |
1253 {'p', 'o', 0x307d}, | |
1254 {'m', 'a', 0x307e}, | |
1255 {'m', 'i', 0x307f}, | |
1256 {'m', 'u', 0x3080}, | |
1257 {'m', 'e', 0x3081}, | |
1258 {'m', 'o', 0x3082}, | |
1259 {'y', 'A', 0x3083}, | |
1260 {'y', 'a', 0x3084}, | |
1261 {'y', 'U', 0x3085}, | |
1262 {'y', 'u', 0x3086}, | |
1263 {'y', 'O', 0x3087}, | |
1264 {'y', 'o', 0x3088}, | |
1265 {'r', 'a', 0x3089}, | |
1266 {'r', 'i', 0x308a}, | |
1267 {'r', 'u', 0x308b}, | |
1268 {'r', 'e', 0x308c}, | |
1269 {'r', 'o', 0x308d}, | |
1270 {'w', 'A', 0x308e}, | |
1271 {'w', 'a', 0x308f}, | |
1272 {'w', 'i', 0x3090}, | |
1273 {'w', 'e', 0x3091}, | |
1274 {'w', 'o', 0x3092}, | |
1275 {'n', '5', 0x3093}, | |
1276 {'v', 'u', 0x3094}, | |
1277 {'"', '5', 0x309b}, | |
1278 {'0', '5', 0x309c}, | |
1279 {'*', '5', 0x309d}, | |
1280 {'+', '5', 0x309e}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
1281 # define DG_START_KATAKANA 0x30a1 |
7 | 1282 {'a', '6', 0x30a1}, |
1283 {'A', '6', 0x30a2}, | |
1284 {'i', '6', 0x30a3}, | |
1285 {'I', '6', 0x30a4}, | |
1286 {'u', '6', 0x30a5}, | |
1287 {'U', '6', 0x30a6}, | |
1288 {'e', '6', 0x30a7}, | |
1289 {'E', '6', 0x30a8}, | |
1290 {'o', '6', 0x30a9}, | |
1291 {'O', '6', 0x30aa}, | |
1292 {'K', 'a', 0x30ab}, | |
1293 {'G', 'a', 0x30ac}, | |
1294 {'K', 'i', 0x30ad}, | |
1295 {'G', 'i', 0x30ae}, | |
1296 {'K', 'u', 0x30af}, | |
1297 {'G', 'u', 0x30b0}, | |
1298 {'K', 'e', 0x30b1}, | |
1299 {'G', 'e', 0x30b2}, | |
1300 {'K', 'o', 0x30b3}, | |
1301 {'G', 'o', 0x30b4}, | |
1302 {'S', 'a', 0x30b5}, | |
1303 {'Z', 'a', 0x30b6}, | |
1304 {'S', 'i', 0x30b7}, | |
1305 {'Z', 'i', 0x30b8}, | |
1306 {'S', 'u', 0x30b9}, | |
1307 {'Z', 'u', 0x30ba}, | |
1308 {'S', 'e', 0x30bb}, | |
1309 {'Z', 'e', 0x30bc}, | |
1310 {'S', 'o', 0x30bd}, | |
1311 {'Z', 'o', 0x30be}, | |
1312 {'T', 'a', 0x30bf}, | |
1313 {'D', 'a', 0x30c0}, | |
1314 {'T', 'i', 0x30c1}, | |
1315 {'D', 'i', 0x30c2}, | |
1316 {'T', 'U', 0x30c3}, | |
1317 {'T', 'u', 0x30c4}, | |
1318 {'D', 'u', 0x30c5}, | |
1319 {'T', 'e', 0x30c6}, | |
1320 {'D', 'e', 0x30c7}, | |
1321 {'T', 'o', 0x30c8}, | |
1322 {'D', 'o', 0x30c9}, | |
1323 {'N', 'a', 0x30ca}, | |
1324 {'N', 'i', 0x30cb}, | |
1325 {'N', 'u', 0x30cc}, | |
1326 {'N', 'e', 0x30cd}, | |
1327 {'N', 'o', 0x30ce}, | |
1328 {'H', 'a', 0x30cf}, | |
1329 {'B', 'a', 0x30d0}, | |
1330 {'P', 'a', 0x30d1}, | |
1331 {'H', 'i', 0x30d2}, | |
1332 {'B', 'i', 0x30d3}, | |
1333 {'P', 'i', 0x30d4}, | |
1334 {'H', 'u', 0x30d5}, | |
1335 {'B', 'u', 0x30d6}, | |
1336 {'P', 'u', 0x30d7}, | |
1337 {'H', 'e', 0x30d8}, | |
1338 {'B', 'e', 0x30d9}, | |
1339 {'P', 'e', 0x30da}, | |
1340 {'H', 'o', 0x30db}, | |
1341 {'B', 'o', 0x30dc}, | |
1342 {'P', 'o', 0x30dd}, | |
1343 {'M', 'a', 0x30de}, | |
1344 {'M', 'i', 0x30df}, | |
1345 {'M', 'u', 0x30e0}, | |
1346 {'M', 'e', 0x30e1}, | |
1347 {'M', 'o', 0x30e2}, | |
1348 {'Y', 'A', 0x30e3}, | |
1349 {'Y', 'a', 0x30e4}, | |
1350 {'Y', 'U', 0x30e5}, | |
1351 {'Y', 'u', 0x30e6}, | |
1352 {'Y', 'O', 0x30e7}, | |
1353 {'Y', 'o', 0x30e8}, | |
1354 {'R', 'a', 0x30e9}, | |
1355 {'R', 'i', 0x30ea}, | |
1356 {'R', 'u', 0x30eb}, | |
1357 {'R', 'e', 0x30ec}, | |
1358 {'R', 'o', 0x30ed}, | |
1359 {'W', 'A', 0x30ee}, | |
1360 {'W', 'a', 0x30ef}, | |
1361 {'W', 'i', 0x30f0}, | |
1362 {'W', 'e', 0x30f1}, | |
1363 {'W', 'o', 0x30f2}, | |
1364 {'N', '6', 0x30f3}, | |
1365 {'V', 'u', 0x30f4}, | |
1366 {'K', 'A', 0x30f5}, | |
1367 {'K', 'E', 0x30f6}, | |
1368 {'V', 'a', 0x30f7}, | |
1369 {'V', 'i', 0x30f8}, | |
1370 {'V', 'e', 0x30f9}, | |
1371 {'V', 'o', 0x30fa}, | |
1372 {'.', '6', 0x30fb}, | |
1373 {'-', '6', 0x30fc}, | |
1374 {'*', '6', 0x30fd}, | |
1375 {'+', '6', 0x30fe}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
1376 # define DG_START_BOPOMOFO 0x3105 |
7 | 1377 {'b', '4', 0x3105}, |
1378 {'p', '4', 0x3106}, | |
1379 {'m', '4', 0x3107}, | |
1380 {'f', '4', 0x3108}, | |
1381 {'d', '4', 0x3109}, | |
1382 {'t', '4', 0x310a}, | |
1383 {'n', '4', 0x310b}, | |
1384 {'l', '4', 0x310c}, | |
1385 {'g', '4', 0x310d}, | |
1386 {'k', '4', 0x310e}, | |
1387 {'h', '4', 0x310f}, | |
1388 {'j', '4', 0x3110}, | |
1389 {'q', '4', 0x3111}, | |
1390 {'x', '4', 0x3112}, | |
1391 {'z', 'h', 0x3113}, | |
1392 {'c', 'h', 0x3114}, | |
1393 {'s', 'h', 0x3115}, | |
1394 {'r', '4', 0x3116}, | |
1395 {'z', '4', 0x3117}, | |
1396 {'c', '4', 0x3118}, | |
1397 {'s', '4', 0x3119}, | |
1398 {'a', '4', 0x311a}, | |
1399 {'o', '4', 0x311b}, | |
1400 {'e', '4', 0x311c}, | |
1401 {'a', 'i', 0x311e}, | |
1402 {'e', 'i', 0x311f}, | |
1403 {'a', 'u', 0x3120}, | |
1404 {'o', 'u', 0x3121}, | |
1405 {'a', 'n', 0x3122}, | |
1406 {'e', 'n', 0x3123}, | |
1407 {'a', 'N', 0x3124}, | |
1408 {'e', 'N', 0x3125}, | |
1409 {'e', 'r', 0x3126}, | |
1410 {'i', '4', 0x3127}, | |
1411 {'u', '4', 0x3128}, | |
1412 {'i', 'u', 0x3129}, | |
1413 {'v', '4', 0x312a}, | |
1414 {'n', 'G', 0x312b}, | |
1415 {'g', 'n', 0x312c}, | |
21329
bb3f60b0aca0
patch 8.2.1215: Atari MiNT support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20751
diff
changeset
|
1416 # define DG_START_OTHER3 0x3220 |
7 | 1417 {'1', 'c', 0x3220}, |
1418 {'2', 'c', 0x3221}, | |
1419 {'3', 'c', 0x3222}, | |
1420 {'4', 'c', 0x3223}, | |
1421 {'5', 'c', 0x3224}, | |
1422 {'6', 'c', 0x3225}, | |
1423 {'7', 'c', 0x3226}, | |
1424 {'8', 'c', 0x3227}, | |
1425 {'9', 'c', 0x3228}, | |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
1426 // code points 0xe000 - 0xefff excluded, they have no assigned |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
1427 // characters, only used in proposals. |
7 | 1428 {'f', 'f', 0xfb00}, |
1429 {'f', 'i', 0xfb01}, | |
1430 {'f', 'l', 0xfb02}, | |
1431 {'f', 't', 0xfb05}, | |
1432 {'s', 't', 0xfb06}, | |
1478 | 1433 |
29980
f0952e40de8e
patch 9.0.0328: OLD_DIGRAPHS is unused
Bram Moolenaar <Bram@vim.org>
parents:
29812
diff
changeset
|
1434 {NUL, NUL, NUL} // end marker |
f0952e40de8e
patch 9.0.0328: OLD_DIGRAPHS is unused
Bram Moolenaar <Bram@vim.org>
parents:
29812
diff
changeset
|
1435 }; |
7 | 1436 |
1437 /* | |
1438 * handle digraphs after typing a character | |
1439 */ | |
1440 int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
1441 do_digraph(int c) |
7 | 1442 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
1443 static int backspaced; // character before K_BS |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
1444 static int lastchar; // last typed character |
7 | 1445 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
1446 if (c == -1) // init values |
7 | 1447 { |
1448 backspaced = -1; | |
1449 } | |
1450 else if (p_dg) | |
1451 { | |
1452 if (backspaced >= 0) | |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
1453 c = digraph_get(backspaced, c, FALSE); |
7 | 1454 backspaced = -1; |
1455 if ((c == K_BS || c == Ctrl_H) && lastchar >= 0) | |
1456 backspaced = lastchar; | |
1457 } | |
1458 lastchar = c; | |
1459 return c; | |
1460 } | |
1461 | |
1462 /* | |
13359
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1463 * Find a digraph for "val". If found return the string to display it. |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1464 * If not found return NULL. |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1465 */ |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1466 char_u * |
14083
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1467 get_digraph_for_char(int val_arg) |
13359
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1468 { |
14083
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1469 int val = val_arg; |
13359
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1470 int i; |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1471 int use_defaults; |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1472 digr_T *dp; |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1473 static char_u r[3]; |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1474 |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1475 #if defined(USE_UNICODE_DIGRAPHS) |
14083
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1476 if (!enc_utf8) |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1477 { |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1478 char_u buf[6], *to; |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1479 vimconv_T vc; |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1480 |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1481 // convert the character from 'encoding' to Unicode |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1482 i = mb_char2bytes(val, buf); |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1483 vc.vc_type = CONV_NONE; |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1484 if (convert_setup(&vc, p_enc, (char_u *)"utf-8") == OK) |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1485 { |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1486 vc.vc_fail = TRUE; |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1487 to = string_convert(&vc, buf, &i); |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1488 if (to != NULL) |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1489 { |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1490 val = utf_ptr2char(to); |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1491 vim_free(to); |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1492 } |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1493 (void)convert_setup(&vc, NULL, NULL); |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1494 } |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1495 } |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1496 #endif |
8a9a00357676
patch 8.1.0059: displayed digraph for "ga" wrong with 'encoding' "cp1251"
Christian Brabandt <cb@256bit.org>
parents:
13359
diff
changeset
|
1497 |
13359
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1498 for (use_defaults = 0; use_defaults <= 1; use_defaults++) |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1499 { |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1500 if (use_defaults == 0) |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1501 dp = (digr_T *)user_digraphs.ga_data; |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1502 else |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1503 dp = digraphdefault; |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1504 for (i = 0; use_defaults ? dp->char1 != NUL |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1505 : i < user_digraphs.ga_len; ++i) |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1506 { |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1507 if (dp->result == val) |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1508 { |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1509 r[0] = dp->char1; |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1510 r[1] = dp->char2; |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1511 r[2] = NUL; |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1512 return r; |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1513 } |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1514 ++dp; |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1515 } |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1516 } |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1517 return NULL; |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1518 } |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1519 |
81c348d40312
patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents:
13121
diff
changeset
|
1520 /* |
7 | 1521 * Get a digraph. Used after typing CTRL-K on the command line or in normal |
1522 * mode. | |
1523 * Returns composed character, or NUL when ESC was used. | |
1524 */ | |
1525 int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
1526 get_digraph( |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
1527 int cmdline) // TRUE when called from the cmdline |
7 | 1528 { |
1529 int c, cc; | |
1530 | |
1531 ++no_mapping; | |
1532 ++allow_keys; | |
1389 | 1533 c = plain_vgetc(); |
7 | 1534 --no_mapping; |
1535 --allow_keys; | |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1536 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1537 if (c == ESC) // ESC cancels CTRL-K |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1538 return NUL; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1539 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1540 if (IS_SPECIAL(c)) // insert special key code |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1541 return c; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1542 if (cmdline) |
7 | 1543 { |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1544 if (char2cells(c) == 1 |
7 | 1545 #if defined(FEAT_CRYPT) || defined(FEAT_EVAL) |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1546 && cmdline_star == 0 |
7 | 1547 #endif |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1548 ) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1549 putcmdline(c, TRUE); |
7 | 1550 } |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1551 else |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1552 add_to_showcmd(c); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1553 ++no_mapping; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1554 ++allow_keys; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1555 cc = plain_vgetc(); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1556 --no_mapping; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1557 --allow_keys; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1558 if (cc != ESC) // ESC cancels CTRL-K |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31531
diff
changeset
|
1559 return digraph_get(c, cc, TRUE); |
7 | 1560 return NUL; |
1561 } | |
1562 | |
1563 /* | |
1564 * Lookup the pair "char1", "char2" in the digraph tables. | |
1565 * If no match, return "char2". | |
3263 | 1566 * If "meta_char" is TRUE and "char1" is a space, return "char2" | 0x80. |
7 | 1567 */ |
1568 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
1569 getexactdigraph(int char1, int char2, int meta_char) |
7 | 1570 { |
1571 int i; | |
1572 int retval = 0; | |
1573 digr_T *dp; | |
1574 | |
1575 if (IS_SPECIAL(char1) || IS_SPECIAL(char2)) | |
1576 return char2; | |
1577 | |
1578 /* | |
1579 * Search user digraphs first. | |
1580 */ | |
1581 dp = (digr_T *)user_digraphs.ga_data; | |
1582 for (i = 0; i < user_digraphs.ga_len; ++i) | |
1583 { | |
1584 if ((int)dp->char1 == char1 && (int)dp->char2 == char2) | |
1585 { | |
1586 retval = dp->result; | |
1587 break; | |
1588 } | |
1589 ++dp; | |
1590 } | |
1591 | |
1592 /* | |
1593 * Search default digraphs. | |
1594 */ | |
1595 if (retval == 0) | |
1596 { | |
1597 dp = digraphdefault; | |
30481
ac6b2ee967f1
patch 9.0.0576: unused loop variables
Bram Moolenaar <Bram@vim.org>
parents:
29980
diff
changeset
|
1598 while (dp->char1 != 0) |
7 | 1599 { |
1600 if ((int)dp->char1 == char1 && (int)dp->char2 == char2) | |
1601 { | |
1602 retval = dp->result; | |
1603 break; | |
1604 } | |
1605 ++dp; | |
1606 } | |
1607 } | |
15595
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15470
diff
changeset
|
1608 #ifdef USE_UNICODE_DIGRAPHS |
7 | 1609 if (retval != 0 && !enc_utf8) |
1610 { | |
1611 char_u buf[6], *to; | |
1612 vimconv_T vc; | |
1613 | |
1614 /* | |
1615 * Convert the Unicode digraph to 'encoding'. | |
1616 */ | |
1617 i = utf_char2bytes(retval, buf); | |
1618 retval = 0; | |
1619 vc.vc_type = CONV_NONE; | |
1620 if (convert_setup(&vc, (char_u *)"utf-8", p_enc) == OK) | |
1621 { | |
1622 vc.vc_fail = TRUE; | |
1623 to = string_convert(&vc, buf, &i); | |
1624 if (to != NULL) | |
1625 { | |
1626 retval = (*mb_ptr2char)(to); | |
1627 vim_free(to); | |
1628 } | |
1629 (void)convert_setup(&vc, NULL, NULL); | |
1630 } | |
1631 } | |
15595
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15470
diff
changeset
|
1632 #endif |
7 | 1633 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
1634 // Ignore multi-byte characters when not in multi-byte mode. |
7 | 1635 if (!has_mbyte && retval > 0xff) |
1636 retval = 0; | |
1637 | |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
1638 if (retval == 0) // digraph deleted or not found |
7 | 1639 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
1640 if (char1 == ' ' && meta_char) // <space> <char> --> meta-char |
7 | 1641 return (char2 | 0x80); |
1642 return char2; | |
1643 } | |
1644 return retval; | |
1645 } | |
1646 | |
1647 /* | |
1648 * Get digraph. | |
1649 * Allow for both char1-char2 and char2-char1 | |
1650 */ | |
1651 int | |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
1652 digraph_get(int char1, int char2, int meta_char) |
7 | 1653 { |
1654 int retval; | |
1655 | |
3263 | 1656 if (((retval = getexactdigraph(char1, char2, meta_char)) == char2) |
7 | 1657 && (char1 != char2) |
3263 | 1658 && ((retval = getexactdigraph(char2, char1, meta_char)) == char1)) |
7 | 1659 return char2; |
1660 return retval; | |
1661 } | |
1662 | |
1663 /* | |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1664 * Add a digraph to the digraph table. |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1665 */ |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1666 static void |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1667 registerdigraph(int char1, int char2, int n) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1668 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1669 int i; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1670 digr_T *dp; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1671 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1672 // If the digraph already exists, replace "result". |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1673 dp = (digr_T *)user_digraphs.ga_data; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1674 for (i = 0; i < user_digraphs.ga_len; ++i) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1675 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1676 if ((int)dp->char1 == char1 && (int)dp->char2 == char2) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1677 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1678 dp->result = n; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1679 return; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1680 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1681 ++dp; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1682 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1683 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1684 // Add a new digraph to the table. |
31837
e16361210675
patch 9.0.1251: checking returned value of ga_grow() is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
31804
diff
changeset
|
1685 if (ga_grow(&user_digraphs, 1) == FAIL) |
31531
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1686 return; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1687 |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1688 dp = (digr_T *)user_digraphs.ga_data + user_digraphs.ga_len; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1689 dp->char1 = char1; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1690 dp->char2 = char2; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1691 dp->result = n; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1692 ++user_digraphs.ga_len; |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1693 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1694 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1695 /* |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1696 * Check the characters are valid for a digraph. |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1697 * If they are valid, returns TRUE; otherwise, give an error message and |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1698 * returns FALSE. |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1699 */ |
25567
0082503ff2ff
patch 8.2.3320: some local functions are not static
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1700 static int |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1701 check_digraph_chars_valid(int char1, int char2) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1702 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1703 if (char2 == 0) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1704 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1705 char_u msg[MB_MAXBYTES + 1]; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1706 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1707 msg[mb_char2bytes(char1, msg)] = NUL; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1708 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1709 semsg(_(e_digraph_must_be_just_two_characters_str), msg); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1710 return FALSE; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1711 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1712 if (char1 == ESC || char2 == ESC) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1713 { |
26602
fac6673086df
patch 8.2.3830: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
25759
diff
changeset
|
1714 emsg(_(e_escape_not_allowed_in_digraph)); |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1715 return FALSE; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1716 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1717 return TRUE; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1718 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1719 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1720 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1721 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1722 /* |
7 | 1723 * Add the digraphs in the argument to the digraph table. |
1724 * format: {c1}{c2} char {c1}{c2} char ... | |
1725 */ | |
1726 void | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
1727 putdigraph(char_u *str) |
7 | 1728 { |
1729 int char1, char2, n; | |
1730 | |
1731 while (*str != NUL) | |
1732 { | |
1733 str = skipwhite(str); | |
1734 if (*str == NUL) | |
1735 return; | |
1736 char1 = *str++; | |
1737 char2 = *str++; | |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1738 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1739 if (!check_digraph_chars_valid(char1, char2)) |
7 | 1740 return; |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1741 |
7 | 1742 str = skipwhite(str); |
1743 if (!VIM_ISDIGIT(*str)) | |
1744 { | |
25306
078edc1821bf
patch 8.2.3190: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
25294
diff
changeset
|
1745 emsg(_(e_number_expected)); |
7 | 1746 return; |
1747 } | |
1748 n = getdigits(&str); | |
1749 | |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1750 registerdigraph(char1, char2, n); |
7 | 1751 } |
1752 } | |
1753 | |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1754 #if defined(USE_UNICODE_DIGRAPHS) |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1755 static void |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1756 digraph_header(char *msg) |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1757 { |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1758 if (msg_col > 0) |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1759 msg_putchar('\n'); |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1760 msg_outtrans_attr((char_u *)msg, HL_ATTR(HLF_CM)); |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1761 msg_putchar('\n'); |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1762 } |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1763 #endif |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1764 |
7 | 1765 void |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1766 listdigraphs(int use_headers) |
7 | 1767 { |
1768 int i; | |
1769 digr_T *dp; | |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1770 result_T previous = 0; |
7 | 1771 |
1772 msg_putchar('\n'); | |
1773 | |
1774 dp = digraphdefault; | |
30481
ac6b2ee967f1
patch 9.0.0576: unused loop variables
Bram Moolenaar <Bram@vim.org>
parents:
29980
diff
changeset
|
1775 while (dp->char1 != NUL && !got_int) |
7 | 1776 { |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1777 #if defined(USE_UNICODE_DIGRAPHS) |
7 | 1778 digr_T tmp; |
1779 | |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
1780 // May need to convert the result to 'encoding'. |
7 | 1781 tmp.char1 = dp->char1; |
1782 tmp.char2 = dp->char2; | |
1783 tmp.result = getexactdigraph(tmp.char1, tmp.char2, FALSE); | |
1784 if (tmp.result != 0 && tmp.result != tmp.char2 | |
1785 && (has_mbyte || tmp.result <= 255)) | |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1786 printdigraph(&tmp, use_headers ? &previous : NULL); |
7 | 1787 #else |
1788 | |
1789 if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result | |
15595
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15470
diff
changeset
|
1790 && (has_mbyte || dp->result <= 255)) |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1791 printdigraph(dp, use_headers ? &previous : NULL); |
7 | 1792 #endif |
1793 ++dp; | |
1794 ui_breakcheck(); | |
1795 } | |
1796 | |
1797 dp = (digr_T *)user_digraphs.ga_data; | |
1798 for (i = 0; i < user_digraphs.ga_len && !got_int; ++i) | |
1799 { | |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1800 #if defined(USE_UNICODE_DIGRAPHS) |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1801 if (previous >= 0 && use_headers) |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1802 digraph_header(_("Custom")); |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1803 previous = -1; |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1804 #endif |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1805 printdigraph(dp, NULL); |
7 | 1806 ui_breakcheck(); |
1807 ++dp; | |
1808 } | |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29173
diff
changeset
|
1809 |
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29173
diff
changeset
|
1810 // clear screen, because some digraphs may be wrong, in which case we |
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29173
diff
changeset
|
1811 // messed up ScreenLines |
29812
68ef14b21d01
patch 9.0.0245: mechanism to prevent recursive screen updating is incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29732
diff
changeset
|
1812 set_must_redraw(UPD_CLEAR); |
7 | 1813 } |
1814 | |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1815 static void |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
1816 digraph_getlist_appendpair(digr_T *dp, list_T *l) |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1817 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1818 char_u buf[30]; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1819 char_u *p; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1820 list_T *l2; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1821 listitem_T *li, *li2; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1822 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1823 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1824 li = listitem_alloc(); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1825 if (li == NULL) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1826 return; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1827 list_append(l, li); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1828 li->li_tv.v_type = VAR_LIST; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1829 li->li_tv.v_lock = 0; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1830 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1831 l2 = list_alloc(); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1832 li->li_tv.vval.v_list = l2; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1833 if (l2 == NULL) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1834 return; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1835 ++l2->lv_refcount; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1836 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1837 li2 = listitem_alloc(); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1838 if (li2 == NULL) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1839 return; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1840 list_append(l2, li2); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1841 li2->li_tv.v_type = VAR_STRING; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1842 li2->li_tv.v_lock = 0; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1843 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1844 buf[0] = dp->char1; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1845 buf[1] = dp->char2; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1846 buf[2] = NUL; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1847 li2->li_tv.vval.v_string = vim_strsave(&buf[0]); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1848 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1849 li2 = listitem_alloc(); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1850 if (li2 == NULL) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1851 return; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1852 list_append(l2, li2); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1853 li2->li_tv.v_type = VAR_STRING; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1854 li2->li_tv.v_lock = 0; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1855 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1856 p = buf; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1857 if (has_mbyte) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1858 p += (*mb_char2bytes)(dp->result, p); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1859 else |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1860 *p++ = (char_u)dp->result; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1861 *p = NUL; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1862 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1863 li2->li_tv.vval.v_string = vim_strsave(buf); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1864 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1865 |
25567
0082503ff2ff
patch 8.2.3320: some local functions are not static
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
1866 static void |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
1867 digraph_getlist_common(int list_all, typval_T *rettv) |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1868 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1869 int i; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1870 digr_T *dp; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1871 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1872 if (rettv_list_alloc(rettv) == FAIL) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1873 return; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1874 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1875 if (list_all) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1876 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1877 dp = digraphdefault; |
30481
ac6b2ee967f1
patch 9.0.0576: unused loop variables
Bram Moolenaar <Bram@vim.org>
parents:
29980
diff
changeset
|
1878 while (dp->char1 != NUL && !got_int) |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1879 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1880 #ifdef USE_UNICODE_DIGRAPHS |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1881 digr_T tmp; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1882 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1883 tmp.char1 = dp->char1; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1884 tmp.char2 = dp->char2; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1885 tmp.result = getexactdigraph(tmp.char1, tmp.char2, FALSE); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1886 if (tmp.result != 0 && tmp.result != tmp.char2 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1887 && (has_mbyte || tmp.result <= 255)) |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
1888 digraph_getlist_appendpair(&tmp, rettv->vval.v_list); |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1889 #else |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1890 if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1891 && (has_mbyte || dp->result <= 255)) |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
1892 digraph_getlist_appendpair(dp, rettv->vval.v_list); |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1893 #endif |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1894 ++dp; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1895 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1896 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1897 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1898 dp = (digr_T *)user_digraphs.ga_data; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1899 for (i = 0; i < user_digraphs.ga_len && !got_int; ++i) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1900 { |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
1901 digraph_getlist_appendpair(dp, rettv->vval.v_list); |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1902 ++dp; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1903 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1904 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
1905 |
17789
0f7ae8010787
patch 8.1.1891: functions used in one file are global
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
1906 static struct dg_header_entry { |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1907 int dg_start; |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1908 char *dg_header; |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1909 } header_table[] = { |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1910 {DG_START_LATIN, N_("Latin supplement")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1911 {DG_START_GREEK, N_("Greek and Coptic")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1912 {DG_START_CYRILLIC, N_("Cyrillic")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1913 {DG_START_HEBREW, N_("Hebrew")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1914 {DG_START_ARABIC, N_("Arabic")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1915 {DG_START_LATIN_EXTENDED, N_("Latin extended")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1916 {DG_START_GREEK_EXTENDED, N_("Greek extended")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1917 {DG_START_PUNCTUATION, N_("Punctuation")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1918 {DG_START_SUB_SUPER, N_("Super- and subscripts")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1919 {DG_START_CURRENCY, N_("Currency")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1920 {DG_START_OTHER1, N_("Other")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1921 {DG_START_ROMAN, N_("Roman numbers")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1922 {DG_START_ARROWS, N_("Arrows")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1923 {DG_START_MATH, N_("Mathematical operators")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1924 {DG_START_TECHNICAL, N_("Technical")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1925 {DG_START_OTHER2, N_("Other")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1926 {DG_START_DRAWING, N_("Box drawing")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1927 {DG_START_BLOCK, N_("Block elements")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1928 {DG_START_SHAPES, N_("Geometric shapes")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1929 {DG_START_SYMBOLS, N_("Symbols")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1930 {DG_START_DINGBATS, N_("Dingbats")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1931 {DG_START_CJK_SYMBOLS, N_("CJK symbols and punctuation")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1932 {DG_START_HIRAGANA, N_("Hiragana")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1933 {DG_START_KATAKANA, N_("Katakana")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1934 {DG_START_BOPOMOFO, N_("Bopomofo")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1935 {DG_START_OTHER3, N_("Other")}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1936 {0xfffffff, NULL}, |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1937 }; |
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1938 |
7 | 1939 static void |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1940 printdigraph(digr_T *dp, result_T *previous) |
7 | 1941 { |
1942 char_u buf[30]; | |
1943 char_u *p; | |
1944 | |
1945 int list_width; | |
1946 | |
15595
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15470
diff
changeset
|
1947 if ((dy_flags & DY_UHEX) || has_mbyte) |
7 | 1948 list_width = 13; |
1949 else | |
1950 list_width = 11; | |
1951 | |
31531
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1952 if (dp->result == 0) |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1953 return; |
15152
1ef429366fd4
patch 8.1.0586: :digraph output is not easy to read
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
1954 |
31531
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1955 #if defined(USE_UNICODE_DIGRAPHS) |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1956 if (previous != NULL) |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1957 { |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1958 int i; |
7 | 1959 |
31531
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1960 for (i = 0; header_table[i].dg_header != NULL; ++i) |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1961 if (*previous < header_table[i].dg_start |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1962 && dp->result >= header_table[i].dg_start |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1963 && dp->result < header_table[i + 1].dg_start) |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1964 { |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1965 digraph_header(_(header_table[i].dg_header)); |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1966 break; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1967 } |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1968 *previous = dp->result; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1969 } |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1970 #endif |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1971 if (msg_col > Columns - list_width) |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1972 msg_putchar('\n'); |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1973 if (msg_col) |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1974 while (msg_col % list_width != 0) |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1975 msg_putchar(' '); |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1976 |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1977 p = buf; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1978 *p++ = dp->char1; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1979 *p++ = dp->char2; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1980 *p++ = ' '; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1981 *p = NUL; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1982 msg_outtrans(buf); |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1983 p = buf; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1984 if (has_mbyte) |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1985 { |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1986 // add a space to draw a composing char on |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1987 if (enc_utf8 && utf_iscomposing(dp->result)) |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1988 *p++ = ' '; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1989 p += (*mb_char2bytes)(dp->result, p); |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1990 } |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1991 else |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1992 *p++ = (char_u)dp->result; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1993 *p = NUL; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1994 msg_outtrans_attr(buf, HL_ATTR(HLF_8)); |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1995 p = buf; |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1996 if (char2cells(dp->result) == 1) |
7 | 1997 *p++ = ' '; |
31531
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1998 vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result); |
6e24001000ed
patch 9.0.1098: code uses too much indent
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
1999 msg_outtrans(buf); |
7 | 2000 } |
2001 | |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2002 # ifdef FEAT_EVAL |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2003 /* |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2004 * Get the two digraph characters from a typval. |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2005 * Return OK or FAIL. |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2006 */ |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2007 static int |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2008 get_digraph_chars(typval_T *arg, int *char1, int *char2) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2009 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2010 char_u buf_chars[NUMBUFLEN]; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2011 char_u *chars = tv_get_string_buf_chk(arg, buf_chars); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2012 char_u *p = chars; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2013 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2014 if (p != NULL) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2015 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2016 if (*p != NUL) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2017 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2018 *char1 = mb_cptr2char_adv(&p); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2019 if (*p != NUL) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2020 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2021 *char2 = mb_cptr2char_adv(&p); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2022 if (*p == NUL) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2023 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2024 if (check_digraph_chars_valid(*char1, *char2)) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2025 return OK; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2026 return FAIL; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2027 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2028 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2029 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2030 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2031 semsg(_(e_digraph_must_be_just_two_characters_str), chars); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2032 return FAIL; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2033 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2034 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2035 static int |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2036 digraph_set_common(typval_T *argchars, typval_T *argdigraph) |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2037 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2038 int char1, char2; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2039 char_u *digraph; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2040 char_u *p; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2041 char_u buf_digraph[NUMBUFLEN]; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2042 varnumber_T n; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2043 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2044 if (get_digraph_chars(argchars, &char1, &char2) == FAIL) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2045 return FALSE; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2046 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2047 digraph = tv_get_string_buf_chk(argdigraph, buf_digraph); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2048 if (digraph == NULL) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2049 return FALSE; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2050 p = digraph; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2051 n = mb_cptr2char_adv(&p); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2052 if (*p != NUL) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2053 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2054 semsg(_(e_digraph_argument_must_be_one_character_str), digraph); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2055 return FALSE; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2056 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2057 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2058 registerdigraph(char1, char2, (int)n); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2059 return TRUE; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2060 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2061 # endif |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2062 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
2063 #endif // FEAT_DIGRAPHS |
7 | 2064 |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2065 #if defined(FEAT_EVAL) || defined(PROTO) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2066 /* |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2067 * "digraph_get()" function |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2068 */ |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2069 void |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2070 f_digraph_get(typval_T *argvars, typval_T *rettv) |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2071 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2072 # ifdef FEAT_DIGRAPHS |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2073 int code; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2074 char_u buf[NUMBUFLEN]; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2075 char_u *digraphs; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2076 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2077 rettv->v_type = VAR_STRING; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2078 rettv->vval.v_string = NULL; // Return empty string for failure |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25378
diff
changeset
|
2079 |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25378
diff
changeset
|
2080 if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25378
diff
changeset
|
2081 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25378
diff
changeset
|
2082 |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2083 digraphs = tv_get_string_chk(&argvars[0]); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2084 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2085 if (digraphs == NULL) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2086 return; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2087 else if (STRLEN(digraphs) != 2) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2088 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2089 semsg(_(e_digraph_must_be_just_two_characters_str), digraphs); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2090 return; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2091 } |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2092 code = digraph_get(digraphs[0], digraphs[1], FALSE); |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2093 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2094 if (has_mbyte) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2095 buf[(*mb_char2bytes)(code, buf)] = NUL; |
31804
50555279168b
patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents:
31667
diff
changeset
|
2096 else |
50555279168b
patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents:
31667
diff
changeset
|
2097 { |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2098 buf[0] = code; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2099 buf[1] = NUL; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2100 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2101 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2102 rettv->vval.v_string = vim_strsave(buf); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2103 # else |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2104 emsg(_(e_no_digraphs_version)); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2105 # endif |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2106 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2107 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2108 /* |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2109 * "digraph_getlist()" function |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2110 */ |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2111 void |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2112 f_digraph_getlist(typval_T *argvars, typval_T *rettv) |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2113 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2114 # ifdef FEAT_DIGRAPHS |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2115 int flag_list_all; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2116 |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25567
diff
changeset
|
2117 if (in_vim9script() && check_for_opt_bool_arg(argvars, 0) == FAIL) |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25378
diff
changeset
|
2118 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25378
diff
changeset
|
2119 |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2120 if (argvars[0].v_type == VAR_UNKNOWN) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2121 flag_list_all = FALSE; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2122 else |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2123 { |
28809
d0241e74bfdb
patch 8.2.4928: various white space and cosmetic mistakes
Bram Moolenaar <Bram@vim.org>
parents:
28773
diff
changeset
|
2124 int error = FALSE; |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2125 varnumber_T flag = tv_get_number_chk(&argvars[0], &error); |
28809
d0241e74bfdb
patch 8.2.4928: various white space and cosmetic mistakes
Bram Moolenaar <Bram@vim.org>
parents:
28773
diff
changeset
|
2126 |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2127 if (error) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2128 return; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2129 flag_list_all = flag ? TRUE : FALSE; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2130 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2131 |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2132 digraph_getlist_common(flag_list_all, rettv); |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2133 # else |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2134 emsg(_(e_no_digraphs_version)); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2135 # endif |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2136 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2137 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2138 /* |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2139 * "digraph_set()" function |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2140 */ |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2141 void |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2142 f_digraph_set(typval_T *argvars, typval_T *rettv) |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2143 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2144 # ifdef FEAT_DIGRAPHS |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2145 rettv->v_type = VAR_BOOL; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2146 rettv->vval.v_number = VVAL_FALSE; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2147 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25378
diff
changeset
|
2148 if (in_vim9script() |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25378
diff
changeset
|
2149 && (check_for_string_arg(argvars, 0) == FAIL |
25759
ea0820d05257
patch 8.2.3415: Vim9: not all function argument types are properly checked
Bram Moolenaar <Bram@vim.org>
parents:
25567
diff
changeset
|
2150 || check_for_string_arg(argvars, 1) == FAIL)) |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25378
diff
changeset
|
2151 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25378
diff
changeset
|
2152 |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2153 if (!digraph_set_common(&argvars[0], &argvars[1])) |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2154 return; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2155 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2156 rettv->vval.v_number = VVAL_TRUE; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2157 # else |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2158 emsg(_(e_no_digraphs_version)); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2159 # endif |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2160 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2161 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2162 /* |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2163 * "digraph_setlist()" function |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2164 */ |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2165 void |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2166 f_digraph_setlist(typval_T * argvars, typval_T *rettv) |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2167 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2168 # ifdef FEAT_DIGRAPHS |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2169 list_T *pl, *l; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2170 listitem_T *pli; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2171 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2172 rettv->v_type = VAR_BOOL; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2173 rettv->vval.v_number = VVAL_FALSE; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2174 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2175 if (argvars[0].v_type != VAR_LIST) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2176 { |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2177 emsg(_(e_digraph_setlist_argument_must_be_list_of_lists_with_two_items)); |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2178 return; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2179 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2180 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2181 pl = argvars[0].vval.v_list; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2182 if (pl == NULL) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2183 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2184 // Empty list always results in success. |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2185 rettv->vval.v_number = VVAL_TRUE; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2186 return; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2187 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2188 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2189 FOR_ALL_LIST_ITEMS(pl, pli) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2190 { |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2191 if (pli->li_tv.v_type != VAR_LIST) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2192 { |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2193 emsg(_(e_digraph_setlist_argument_must_be_list_of_lists_with_two_items)); |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2194 return; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2195 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2196 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2197 l = pli->li_tv.vval.v_list; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2198 if (l == NULL || l->lv_len != 2) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2199 { |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2200 emsg(_(e_digraph_setlist_argument_must_be_list_of_lists_with_two_items)); |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2201 return; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2202 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2203 |
25378
890fd8211202
patch 8.2.3226: new digraph functions use old naming scheme
Bram Moolenaar <Bram@vim.org>
parents:
25306
diff
changeset
|
2204 if (!digraph_set_common(&l->lv_first->li_tv, |
25294
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2205 &l->lv_first->li_next->li_tv)) |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2206 return; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2207 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2208 rettv->vval.v_number = VVAL_TRUE; |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2209 # else |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2210 emsg(_(e_no_digraphs_version)); |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2211 # endif |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2212 } |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2213 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2214 #endif // FEAT_EVAL |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2215 |
c626fd34b66f
patch 8.2.3184: cannot add a digraph with a leading space
Bram Moolenaar <Bram@vim.org>
parents:
22172
diff
changeset
|
2216 |
7 | 2217 #if defined(FEAT_KEYMAP) || defined(PROTO) |
2218 | |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
2219 // structure used for b_kmap_ga.ga_data |
7 | 2220 typedef struct |
2221 { | |
2222 char_u *from; | |
2223 char_u *to; | |
2224 } kmap_T; | |
2225 | |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
2226 #define KMAP_MAXLEN 20 // maximum length of "from" or "to" |
7 | 2227 |
7799
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
7408
diff
changeset
|
2228 static void keymap_unload(void); |
7 | 2229 |
2230 /* | |
1869 | 2231 * Set up key mapping tables for the 'keymap' option. |
2232 * Returns NULL if OK, an error message for failure. This only needs to be | |
2233 * used when setting the option, not later when the value has already been | |
2234 * checked. | |
7 | 2235 */ |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15152
diff
changeset
|
2236 char * |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
2237 keymap_init(void) |
7 | 2238 { |
2239 curbuf->b_kmap_state &= ~KEYMAP_INIT; | |
2240 | |
2241 if (*curbuf->b_p_keymap == NUL) | |
2242 { | |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
2243 // Stop any active keymap and clear the table. Also remove |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
2244 // b:keymap_name, as no keymap is active now. |
7 | 2245 keymap_unload(); |
1308 | 2246 do_cmdline_cmd((char_u *)"unlet! b:keymap_name"); |
7 | 2247 } |
2248 else | |
2249 { | |
2250 char_u *buf; | |
1869 | 2251 size_t buflen; |
7 | 2252 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
2253 // Source the keymap file. It will contain a ":loadkeymap" command |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
2254 // which will call ex_loadkeymap() below. |
15595
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15470
diff
changeset
|
2255 buflen = STRLEN(curbuf->b_p_keymap) + STRLEN(p_enc) + 14; |
16764
ef00b6bc186b
patch 8.1.1384: using "int" for alloc() often results in compiler warnings
Bram Moolenaar <Bram@vim.org>
parents:
15595
diff
changeset
|
2256 buf = alloc(buflen); |
7 | 2257 if (buf == NULL) |
25306
078edc1821bf
patch 8.2.3190: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
25294
diff
changeset
|
2258 return e_out_of_memory; |
7 | 2259 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
2260 // try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath' |
1869 | 2261 vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim", |
2262 curbuf->b_p_keymap, p_enc); | |
8524
2f57bbe870ea
commit https://github.com/vim/vim/commit/7f8989dd8a627af2185df381195351a913f3777f
Christian Brabandt <cb@256bit.org>
parents:
8212
diff
changeset
|
2263 if (source_runtime(buf, 0) == FAIL) |
7 | 2264 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
2265 // try finding "keymap/'keymap'.vim" in 'runtimepath' |
1869 | 2266 vim_snprintf((char *)buf, buflen, "keymap/%s.vim", |
2267 curbuf->b_p_keymap); | |
8524
2f57bbe870ea
commit https://github.com/vim/vim/commit/7f8989dd8a627af2185df381195351a913f3777f
Christian Brabandt <cb@256bit.org>
parents:
8212
diff
changeset
|
2268 if (source_runtime(buf, 0) == FAIL) |
7 | 2269 { |
2270 vim_free(buf); | |
26917
d91aea2a612c
patch 8.2.3987: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26602
diff
changeset
|
2271 return N_(e_keymap_file_not_found); |
7 | 2272 } |
2273 } | |
2274 vim_free(buf); | |
2275 } | |
2276 | |
2277 return NULL; | |
2278 } | |
2279 | |
2280 /* | |
2281 * ":loadkeymap" command: load the following lines as the keymap. | |
2282 */ | |
2283 void | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
2284 ex_loadkeymap(exarg_T *eap) |
7 | 2285 { |
2286 char_u *line; | |
2287 char_u *p; | |
2288 char_u *s; | |
2289 kmap_T *kp; | |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
2290 #define KMAP_LLEN 200 // max length of "to" and "from" together |
7 | 2291 char_u buf[KMAP_LLEN + 11]; |
2292 int i; | |
2293 char_u *save_cpo = p_cpo; | |
2294 | |
28139
f34afadbef47
patch 8.2.4594: need to write script to a file to be able to source them
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
2295 if (!sourcing_a_script(eap)) |
7 | 2296 { |
26602
fac6673086df
patch 8.2.3830: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
25759
diff
changeset
|
2297 emsg(_(e_using_loadkeymap_not_in_sourced_file)); |
7 | 2298 return; |
2299 } | |
2300 | |
2301 /* | |
2302 * Stop any active keymap and clear the table. | |
2303 */ | |
2304 keymap_unload(); | |
2305 | |
2306 curbuf->b_kmap_state = 0; | |
27028
c9474ae175f4
patch 8.2.4043: using int for second argument of ga_init2()
Bram Moolenaar <Bram@vim.org>
parents:
26958
diff
changeset
|
2307 ga_init2(&curbuf->b_kmap_ga, sizeof(kmap_T), 20); |
7 | 2308 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
2309 // Set 'cpoptions' to "C" to avoid line continuation. |
7 | 2310 p_cpo = (char_u *)"C"; |
2311 | |
2312 /* | |
2313 * Get each line of the sourced file, break at the end. | |
2314 */ | |
2315 for (;;) | |
2316 { | |
17178
40c4cb095d53
patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents:
16764
diff
changeset
|
2317 line = eap->getline(0, eap->cookie, 0, TRUE); |
7 | 2318 if (line == NULL) |
2319 break; | |
2320 | |
2321 p = skipwhite(line); | |
2322 if (*p != '"' && *p != NUL && ga_grow(&curbuf->b_kmap_ga, 1) == OK) | |
2323 { | |
2324 kp = (kmap_T *)curbuf->b_kmap_ga.ga_data + curbuf->b_kmap_ga.ga_len; | |
2325 s = skiptowhite(p); | |
20751
d9a2e5dcfd9f
patch 8.2.0928: many type casts are used for vim_strnsave()
Bram Moolenaar <Bram@vim.org>
parents:
18777
diff
changeset
|
2326 kp->from = vim_strnsave(p, s - p); |
7 | 2327 p = skipwhite(s); |
2328 s = skiptowhite(p); | |
20751
d9a2e5dcfd9f
patch 8.2.0928: many type casts are used for vim_strnsave()
Bram Moolenaar <Bram@vim.org>
parents:
18777
diff
changeset
|
2329 kp->to = vim_strnsave(p, s - p); |
7 | 2330 |
2331 if (kp->from == NULL || kp->to == NULL | |
839 | 2332 || STRLEN(kp->from) + STRLEN(kp->to) >= KMAP_LLEN |
2333 || *kp->from == NUL || *kp->to == NUL) | |
7 | 2334 { |
839 | 2335 if (kp->to != NULL && *kp->to == NUL) |
26958
d92e0d85923f
patch 8.2.4008: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26917
diff
changeset
|
2336 emsg(_(e_empty_keymap_entry)); |
7 | 2337 vim_free(kp->from); |
2338 vim_free(kp->to); | |
2339 } | |
2340 else | |
2341 ++curbuf->b_kmap_ga.ga_len; | |
2342 } | |
2343 vim_free(line); | |
2344 } | |
2345 | |
2346 /* | |
2347 * setup ":lnoremap" to map the keys | |
2348 */ | |
2349 for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i) | |
2350 { | |
274 | 2351 vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s %s", |
7 | 2352 ((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].from, |
2353 ((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].to); | |
29173
1ec1ba7e7728
patch 8.2.5106: default cmdwin mappings are re-mappable
Bram Moolenaar <Bram@vim.org>
parents:
28809
diff
changeset
|
2354 (void)do_map(MAPTYPE_NOREMAP, buf, MODE_LANGMAP, FALSE); |
7 | 2355 } |
2356 | |
2357 p_cpo = save_cpo; | |
2358 | |
2359 curbuf->b_kmap_state |= KEYMAP_LOADED; | |
2360 status_redraw_curbuf(); | |
2361 } | |
2362 | |
2363 /* | |
2364 * Stop using 'keymap'. | |
2365 */ | |
2366 static void | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
2367 keymap_unload(void) |
7 | 2368 { |
2369 char_u buf[KMAP_MAXLEN + 10]; | |
2370 int i; | |
2371 char_u *save_cpo = p_cpo; | |
1624 | 2372 kmap_T *kp; |
7 | 2373 |
2374 if (!(curbuf->b_kmap_state & KEYMAP_LOADED)) | |
2375 return; | |
2376 | |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
2377 // Set 'cpoptions' to "C" to avoid line continuation. |
7 | 2378 p_cpo = (char_u *)"C"; |
2379 | |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
2380 // clear the ":lmap"s |
1624 | 2381 kp = (kmap_T *)curbuf->b_kmap_ga.ga_data; |
7 | 2382 for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i) |
2383 { | |
1624 | 2384 vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s", kp[i].from); |
29173
1ec1ba7e7728
patch 8.2.5106: default cmdwin mappings are re-mappable
Bram Moolenaar <Bram@vim.org>
parents:
28809
diff
changeset
|
2385 (void)do_map(MAPTYPE_UNMAP, buf, MODE_LANGMAP, FALSE); |
7 | 2386 } |
13121
3321582cae78
patch 8.0.1435: memory leak in test_arabic
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
2387 keymap_clear(&curbuf->b_kmap_ga); |
7 | 2388 |
2389 p_cpo = save_cpo; | |
2390 | |
2391 ga_clear(&curbuf->b_kmap_ga); | |
2392 curbuf->b_kmap_state &= ~KEYMAP_LOADED; | |
2393 status_redraw_curbuf(); | |
2394 } | |
2395 | |
13121
3321582cae78
patch 8.0.1435: memory leak in test_arabic
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
2396 void |
3321582cae78
patch 8.0.1435: memory leak in test_arabic
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
2397 keymap_clear(garray_T *kmap) |
3321582cae78
patch 8.0.1435: memory leak in test_arabic
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
2398 { |
3321582cae78
patch 8.0.1435: memory leak in test_arabic
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
2399 int i; |
3321582cae78
patch 8.0.1435: memory leak in test_arabic
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
2400 kmap_T *kp = (kmap_T *)kmap->ga_data; |
3321582cae78
patch 8.0.1435: memory leak in test_arabic
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
2401 |
3321582cae78
patch 8.0.1435: memory leak in test_arabic
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
2402 for (i = 0; i < kmap->ga_len; ++i) |
3321582cae78
patch 8.0.1435: memory leak in test_arabic
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
2403 { |
3321582cae78
patch 8.0.1435: memory leak in test_arabic
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
2404 vim_free(kp[i].from); |
3321582cae78
patch 8.0.1435: memory leak in test_arabic
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
2405 vim_free(kp[i].to); |
3321582cae78
patch 8.0.1435: memory leak in test_arabic
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
2406 } |
3321582cae78
patch 8.0.1435: memory leak in test_arabic
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
2407 } |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
17853
diff
changeset
|
2408 #endif // FEAT_KEYMAP |