Skip to content

Commit 79bbe33

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents c90e801 + 6a06363 commit 79bbe33

8 files changed

Lines changed: 383 additions & 219 deletions

File tree

runtime/tools/unicode.vim

Lines changed: 130 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ func! ParseFoldProps()
3232
if line !~ '^#' && line !~ '^\s*$'
3333
let l = split(line, '\s*;\s*', 1)
3434
if len(l) != 4
35-
echoerr 'Found ' . len(l) . ' items in line ' . lnum . ', expected 4'
36-
return
35+
echoerr 'Found ' . len(l) . ' items in line ' . lnum . ', expected 4'
36+
return
3737
endif
3838
call add(s:foldprops, l)
3939
endif
@@ -50,8 +50,8 @@ func! ParseWidthProps()
5050
if line !~ '^#' && line !~ '^\s*$'
5151
let l = split(line, '\s*;\s*', 1)
5252
if len(l) != 2
53-
echoerr 'Found ' . len(l) . ' items in line ' . lnum . ', expected 2'
54-
return
53+
echoerr 'Found ' . len(l) . ' items in line ' . lnum . ', expected 2'
54+
return
5555
endif
5656
call add(s:widthprops, l)
5757
endif
@@ -72,18 +72,18 @@ func! BuildCaseTable(name, index)
7272
let n = ('0x' . p[0]) + 0
7373
let nl = ('0x' . p[a:index]) + 0
7474
if start >= 0 && add == nl - n && (step == 0 || n - end == step)
75-
" continue with same range.
76-
let step = n - end
77-
let end = n
75+
" continue with same range.
76+
let step = n - end
77+
let end = n
7878
else
79-
if start >= 0
80-
" produce previous range
81-
call Range(ranges, start, end, step, add)
82-
endif
83-
let start = n
84-
let end = n
85-
let step = 0
86-
let add = nl - n
79+
if start >= 0
80+
" produce previous range
81+
call Range(ranges, start, end, step, add)
82+
endif
83+
let start = n
84+
let end = n
85+
let step = 0
86+
let add = nl - n
8787
endif
8888
endif
8989
endfor
@@ -115,18 +115,18 @@ func! BuildFoldTable()
115115
let n = ('0x' . p[0]) + 0
116116
let nl = ('0x' . p[2]) + 0
117117
if start >= 0 && add == nl - n && (step == 0 || n - end == step)
118-
" continue with same range.
119-
let step = n - end
120-
let end = n
118+
" continue with same range.
119+
let step = n - end
120+
let end = n
121121
else
122-
if start >= 0
123-
" produce previous range
124-
call Range(ranges, start, end, step, add)
125-
endif
126-
let start = n
127-
let end = n
128-
let step = 0
129-
let add = nl - n
122+
if start >= 0
123+
" produce previous range
124+
call Range(ranges, start, end, step, add)
125+
endif
126+
let start = n
127+
let end = n
128+
let step = 0
129+
let add = nl - n
130130
endif
131131
endif
132132
endfor
@@ -160,15 +160,15 @@ func! BuildCombiningTable()
160160
if p[2] == 'Mn' || p[2] == 'Mc' || p[2] == 'Me'
161161
let n = ('0x' . p[0]) + 0
162162
if start >= 0 && end + 1 == n
163-
" continue with same range.
164-
let end = n
163+
" continue with same range.
164+
let end = n
165165
else
166-
if start >= 0
167-
" produce previous range
168-
call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
169-
endif
170-
let start = n
171-
let end = n
166+
if start >= 0
167+
" produce previous range
168+
call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
169+
endif
170+
let start = n
171+
let end = n
172172
endif
173173
endif
174174
endfor
@@ -197,47 +197,57 @@ func! BuildWidthTable(pattern, tableName)
197197
for p in s:widthprops
198198
if p[1][0] =~ a:pattern
199199
if p[0] =~ '\.\.'
200-
" It is a range. we don't check for composing char then.
201-
let rng = split(p[0], '\.\.')
202-
if len(rng) != 2
203-
echoerr "Cannot parse range: '" . p[0] . "' in width table"
204-
endif
205-
let n = ('0x' . rng[0]) + 0
206-
let n_last = ('0x' . rng[1]) + 0
200+
" It is a range. we don't check for composing char then.
201+
let rng = split(p[0], '\.\.')
202+
if len(rng) != 2
203+
echoerr "Cannot parse range: '" . p[0] . "' in width table"
204+
endif
205+
let n = ('0x' . rng[0]) + 0
206+
let n_last = ('0x' . rng[1]) + 0
207207
else
208-
let n = ('0x' . p[0]) + 0
209-
let n_last = n
208+
let n = ('0x' . p[0]) + 0
209+
let n_last = n
210210
endif
211211
" Find this char in the data table.
212212
while 1
213-
let dn = ('0x' . s:dataprops[dataidx][0]) + 0
214-
if dn >= n
215-
break
216-
endif
217-
let dataidx += 1
213+
let dn = ('0x' . s:dataprops[dataidx][0]) + 0
214+
if dn >= n
215+
break
216+
endif
217+
let dataidx += 1
218218
endwhile
219219
if dn != n && n_last == n
220-
echoerr "Cannot find character " . n . " in data table"
220+
echoerr "Cannot find character " . n . " in data table"
221221
endif
222222
" Only use the char when it's not a composing char.
223223
" But use all chars from a range.
224224
let dp = s:dataprops[dataidx]
225225
if n_last > n || (dp[2] != 'Mn' && dp[2] != 'Mc' && dp[2] != 'Me')
226-
if start >= 0 && end + 1 == n
227-
" continue with same range.
228-
else
229-
if start >= 0
230-
" produce previous range
231-
call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
232-
endif
233-
let start = n
234-
endif
235-
let end = n_last
226+
if start >= 0 && end + 1 == n
227+
" continue with same range.
228+
else
229+
if start >= 0
230+
" produce previous range
231+
call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
232+
if a:pattern == 'A'
233+
call add(s:ambitable, [start, end])
234+
else
235+
call add(s:doubletable, [start, end])
236+
endif
237+
endif
238+
let start = n
239+
endif
240+
let end = n_last
236241
endif
237242
endif
238243
endfor
239244
if start >= 0
240245
call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
246+
if a:pattern == 'A'
247+
call add(s:ambitable, [start, end])
248+
else
249+
call add(s:doubletable, [start, end])
250+
endif
241251
endif
242252

243253
" New buffer to put the result in.
@@ -253,21 +263,72 @@ endfunc
253263

254264
" Build the amoji width table in a new buffer.
255265
func! BuildEmojiTable(pattern, tableName)
256-
let ranges = []
257-
for line in map(filter(filter(getline(1, '$'), 'v:val=~"^[1-9]"'), 'v:val=~a:pattern'), 'matchstr(v:val,"^\\S\\+")')
266+
let alltokens = []
267+
let widthtokens = []
268+
let lines = map(filter(filter(getline(1, '$'), 'v:val=~"^[1-9]"'), 'v:val=~a:pattern'), 'matchstr(v:val,"^\\S\\+")')
269+
for n in range(len(lines))
270+
let line = lines[n]
258271
let token = split(line, '\.\.')
272+
let first = ('0x' . token[0]) + 0
259273
if len(token) == 1
260-
call add(token, token[0])
274+
let last = first
275+
else
276+
let last = ('0x' . token[1]) + 0
277+
endif
278+
279+
let token = [first, last]
280+
if len(alltokens) > 0 && (token[0] - 1 == alltokens[-1][1])
281+
let alltokens[-1][1] = token[1]
282+
else
283+
call add(alltokens, token)
284+
endif
285+
286+
" exclude characters that are in the "ambiguous" or "doublewidth" table
287+
for ambi in s:ambitable
288+
if first >= ambi[0] && first <= ambi[1]
289+
let first = ambi[1] + 1
290+
endif
291+
if last >= ambi[0] && last <= ambi[1]
292+
let last = ambi[0] - 1
293+
endif
294+
endfor
295+
for double in s:doubletable
296+
if first >= double[0] && first <= double[1]
297+
let first = double[1] + 1
298+
endif
299+
if last >= double[0] && last <= double[1]
300+
let last = double[0] - 1
301+
endif
302+
endfor
303+
304+
if first <= last
305+
let token = [first, last]
306+
if len(widthtokens) > 0 && (token[0] - 1 == widthtokens[-1][1])
307+
let widthtokens[-1][1] = token[1]
308+
else
309+
call add(widthtokens, token)
310+
endif
261311
endif
262-
call add(ranges, printf("\t{0x%04x, 0x%04x},", "0x".token[0], "0x".token[1]))
263312
endfor
313+
let allranges = map(alltokens, 'printf("\t{0x%04x, 0x%04x},", v:val[0], v:val[1])')
314+
let widthranges = map(widthtokens, 'printf("\t{0x%04x, 0x%04x},", v:val[0], v:val[1])')
264315

265316
" New buffer to put the result in.
266317
new
267-
exe "file " . a:tableName
268-
call setline(1, " static struct interval " . a:tableName . "[] =")
318+
exe "file " . a:tableName . '_all'
319+
call setline(1, " static struct interval " . a:tableName . "_all[] =")
269320
call setline(2, " {")
270-
call append('$', ranges)
321+
call append('$', allranges)
322+
call setline('$', getline('$')[:-2]) " remove last comma
323+
call setline(line('$') + 1, " };")
324+
wincmd p
325+
326+
" New buffer to put the result in.
327+
new
328+
exe "file " . a:tableName . '_width'
329+
call setline(1, " static struct interval " . a:tableName . "_width[] =")
330+
call setline(2, " {")
331+
call append('$', widthranges)
271332
call setline('$', getline('$')[:-2]) " remove last comma
272333
call setline(line('$') + 1, " };")
273334
wincmd p
@@ -307,13 +368,16 @@ edit http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt
307368
call ParseWidthProps()
308369

309370
" Build the double width table.
371+
let s:doubletable = []
310372
call BuildWidthTable('[WF]', 'doublewidth')
311373

312374
" Build the ambiguous width table.
375+
let s:ambitable = []
313376
call BuildWidthTable('A', 'ambiguous')
314377

315378
" Edit the emoji text file. Requires the netrw plugin.
316379
edit http://www.unicode.org/Public/emoji/3.0/emoji-data.txt
317380

318381
" Build the emoji table. Ver. 1.0 - 6.0
382+
" Must come after the "ambiguous" table
319383
call BuildEmojiTable('; Emoji\s\+# [1-6]\.[0-9]', 'emoji')

src/Makefile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,7 +1989,6 @@ test1 \
19891989
test_match_conceal \
19901990
test_nested_function \
19911991
test_options \
1992-
test_qf_title \
19931992
test_ruby \
19941993
test_search_mbyte \
19951994
test_signs \
@@ -1999,16 +1998,16 @@ test1 \
19991998
test_wordcount \
20001999
test_writefile \
20012000
test2 test3 test4 test5 test6 test7 test8 test9 \
2002-
test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 \
2001+
test11 test12 test13 test14 test15 test16 test17 test18 test19 \
20032002
test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \
20042003
test30 test31 test32 test33 test34 test35 test36 test37 test38 test39 \
20052004
test40 test41 test42 test43 test44 test45 test46 test47 test48 test49 \
20062005
test50 test51 test52 test53 test54 test55 test56 test57 test58 test59 \
20072006
test60 test61 test62 test63 test64 test65 test66 test67 test68 test69 \
20082007
test70 test71 test72 test73 test74 test75 test76 test77 test78 test79 \
20092008
test80 test81 test82 test83 test84 test85 test86 test87 test88 test89 \
2010-
test90 test91 test92 test93 test94 test95 test96 test97 test98 test99 \
2011-
test100 test101 test102 test103 test104 test105 test106 test107 test108:
2009+
test90 test91 test92 test93 test94 test95 test97 test98 test99 \
2010+
test100 test101 test102 test103 test104 test105 test107 test108:
20122011
cd testdir; rm -f [email protected]; $(MAKE) -f Makefile [email protected] VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
20132012

20142013
# Run individual NEW style test, assuming that Vim was already compiled.
@@ -2020,11 +2019,14 @@ test_arglist \
20202019
test_channel \
20212020
test_cursor_func \
20222021
test_delete \
2022+
test_ex_undo \
2023+
test_expr \
20232024
test_expand \
20242025
test_feedkeys \
20252026
test_file_perm \
20262027
test_glob2regpat \
20272028
test_hardcopy \
2029+
test_help_tagjump \
20282030
test_history \
20292031
test_increment \
20302032
test_join \
@@ -2033,6 +2035,7 @@ test_arglist \
20332035
test_lispwords \
20342036
test_menu \
20352037
test_packadd \
2038+
test_partial \
20362039
test_perl \
20372040
test_quickfix \
20382041
test_reltime \
@@ -2041,11 +2044,13 @@ test_arglist \
20412044
test_sort \
20422045
test_syn_attr \
20432046
test_syntax \
2047+
test_timers \
20442048
test_undolevels \
20452049
test_unlet \
20462050
test_viminfo \
20472051
test_viml \
20482052
test_visual \
2053+
test_window_id \
20492054
test_alot:
20502055
cd testdir; rm -f [email protected] test.log messages; $(MAKE) -f Makefile [email protected] VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
20512056
@if test -f testdir/test.log; then \
@@ -2127,11 +2132,11 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \
21272132
$(DEST_FTP) $(DEST_AUTO) $(DEST_AUTO)/xml $(DEST_PLUG) \
21282133
$(DEST_TUTOR) $(DEST_SPELL) $(DEST_COMP)
21292134
-$(SHELL) ./installman.sh install $(DEST_MAN) "" $(INSTALLMANARGS)
2130-
@echo generating help tags
21312135
# Generate the help tags with ":helptags" to handle all languages.
21322136
# Move the distributed tags file aside and restore it, to avoid it being
21332137
# different from the repository.
2134-
cd $(HELPSOURCE); mv -f tags tags.dist
2138+
cd $(HELPSOURCE); if test -f tags; then mv -f tags tags.dist; fi
2139+
@echo generating help tags
21352140
-@cd $(HELPSOURCE); $(MAKE) VIMEXE=$(DEST_BIN)/$(VIMTARGET) vimtags
21362141
cd $(HELPSOURCE); \
21372142
files=`ls *.txt tags`; \
@@ -2141,7 +2146,7 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \
21412146
chmod $(HELPMOD) $$files
21422147
$(INSTALL_DATA) $(HELPSOURCE)/*.pl $(DEST_HELP)
21432148
chmod $(SCRIPTMOD) $(DEST_HELP)/*.pl
2144-
cd $(HELPSOURCE); mv -f tags.dist tags
2149+
cd $(HELPSOURCE); if test -f tags.dist; then mv -f tags.dist tags; fi
21452150
# install the menu files
21462151
$(INSTALL_DATA) $(SCRIPTSOURCE)/menu.vim $(SYS_MENU_FILE)
21472152
chmod $(VIMSCRIPTMOD) $(SYS_MENU_FILE)

src/channel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,8 +2118,8 @@ channel_part_info(channel_T *channel, dict_T *dict, char *name, int part)
21182118
{
21192119
chanpart_T *chanpart = &channel->ch_part[part];
21202120
char namebuf[20];
2121-
int tail;
2122-
char *s;
2121+
size_t tail;
2122+
char *s = "";
21232123

21242124
STRCPY(namebuf, name);
21252125
STRCAT(namebuf, "_");

0 commit comments

Comments
 (0)