aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clint-ignored-files.txt2
-rw-r--r--config/config.h.in1
-rw-r--r--runtime/doc/cmdline.txt4
-rw-r--r--runtime/doc/eval.txt18
-rw-r--r--runtime/doc/options.txt5
-rw-r--r--runtime/doc/os_win32.txt2
-rw-r--r--runtime/doc/pattern.txt4
-rw-r--r--runtime/doc/syntax.txt28
-rw-r--r--runtime/doc/todo.txt60
-rw-r--r--runtime/doc/usr_04.txt4
-rw-r--r--runtime/filetype.vim8
-rw-r--r--runtime/ftplugin/dockerfile.vim16
-rw-r--r--runtime/ftplugin/vim.vim11
-rw-r--r--runtime/indent/json.vim169
-rw-r--r--runtime/scripts.vim6
-rw-r--r--runtime/syntax/asciidoc.vim4
-rw-r--r--runtime/syntax/dockerfile.vim24
-rw-r--r--runtime/syntax/tex.vim113
-rw-r--r--src/nvim/CMakeLists.txt3
-rw-r--r--src/nvim/eval.c4
-rw-r--r--src/nvim/globals.h8
-rw-r--r--src/nvim/hardcopy.c195
-rw-r--r--src/nvim/hardcopy.h6
-rw-r--r--src/nvim/keymap.c6
-rw-r--r--src/nvim/mark.c5
-rw-r--r--src/nvim/normal.c2
-rw-r--r--src/nvim/ops.c12
-rw-r--r--src/nvim/option.c9
-rw-r--r--src/nvim/os/input.c7
-rw-r--r--src/nvim/search.c22
-rw-r--r--src/nvim/sha256.c103
-rw-r--r--src/nvim/sha256.h9
-rw-r--r--src/nvim/syntax.c2
-rw-r--r--src/nvim/term.c251
-rw-r--r--src/nvim/testdir/test39.in9
-rw-r--r--src/nvim/testdir/test39.okbin514 -> 584 bytes
-rw-r--r--src/nvim/testdir/test53.in7
-rw-r--r--src/nvim/testdir/test53.ok6
-rw-r--r--src/nvim/version.c4
-rw-r--r--third-party/CMakeLists.txt18
40 files changed, 720 insertions, 447 deletions
diff --git a/clint-ignored-files.txt b/clint-ignored-files.txt
index 078337b777..1d9b6f9a7f 100644
--- a/clint-ignored-files.txt
+++ b/clint-ignored-files.txt
@@ -106,8 +106,6 @@ src/nvim/screen.c
src/nvim/screen.h
src/nvim/search.c
src/nvim/search.h
-src/nvim/sha256.c
-src/nvim/sha256.h
src/nvim/sign_defs.h
src/nvim/spell.c
src/nvim/spell.h
diff --git a/config/config.h.in b/config/config.h.in
index 005eb1ccb0..0a2aa4786e 100644
--- a/config/config.h.in
+++ b/config/config.h.in
@@ -79,7 +79,6 @@
#define FEAT_BROWSE
#define FEAT_CSCOPE
#define FEAT_MOUSE
-#define FEAT_MOUSE_DEC
#define FEAT_MOUSE_NET
#define FEAT_MOUSE_SGR
#define FEAT_MOUSE_TTY
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index 8b5a6b2f5c..db338a2a56 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -1,4 +1,4 @@
-*cmdline.txt* For Vim version 7.4. Last change: 2014 Aug 16
+*cmdline.txt* For Vim version 7.4. Last change: 2014 Sep 06
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -56,7 +56,7 @@ history tables:
These are completely separate. Each history can only be accessed when
entering the same type of line.
Use the 'history' option to set the number of lines that are remembered
-(default: 20).
+(default: 50).
Notes:
- When you enter a command-line that is exactly the same as an older one, the
old one is removed (to avoid repeated commands moving older commands out of
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index a62fa82d12..6ffa37ac39 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.4. Last change: 2014 Aug 16
+*eval.txt* For Vim version 7.4. Last change: 2014 Sep 09
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1102,9 +1102,9 @@ are known inside the current Vim session. Using expand() will first try using
the environment variables known inside the current Vim session. If that
fails, a shell will be used to expand the variable. This can be slow, but it
does expand all variables that the shell knows about. Example: >
- :echo $version
- :echo expand("$version")
-The first one probably doesn't echo anything, the second echoes the $version
+ :echo $shell
+ :echo expand("$shell")
+The first one probably doesn't echo anything, the second echoes the $shell
variable (if your shell supports it).
@@ -2632,7 +2632,7 @@ cursor({list})
line.
If {col} is zero, the cursor will stay in the current column.
If {curswant} is given it is used to set the preferred column
- for vertical movment. Otherwise {col} is used.
+ for vertical movement. Otherwise {col} is used.
When 'virtualedit' is used {off} specifies the offset in
screen columns from the start of the character. E.g., a
position within a <Tab> or after the last character.
@@ -2923,7 +2923,8 @@ expand({expr} [, {nosuf} [, {list}]]) *expand()*
<
Expand() can also be used to expand variables and environment
variables that are only known in a shell. But this can be
- slow, because a shell must be started. See |expr-env-expand|.
+ slow, because a shell may be used to do the expansion. See
+ |expr-env-expand|.
The expanded variable is still handled like a list of file
names. When an environment variable cannot be expanded, it is
left unchanged. Thus ":echo expand('$FOOBAR')" results in
@@ -3355,6 +3356,7 @@ getcmdtype() *getcmdtype()*
? backward search command
@ |input()| command
- |:insert| or |:append| command
+ = |i_CTRL-R_=|
Only works when editing the command line, thus requires use of
|c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping.
Returns an empty string otherwise.
@@ -5558,7 +5560,7 @@ setreg({regname}, {value} [,{options}])
Returns zero for success, non-zero for failure.
*E883*
- Note: you may not use |List| containing more then one item to
+ Note: you may not use |List| containing more than one item to
set search and expression registers. Lists containing no
items act like empty strings.
@@ -5707,7 +5709,7 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702*
after Strings, |Lists| after Numbers. For sorting text in the
current buffer use |:sort|.
- When {func} is given and it is is '1' or 'i' then case is
+ When {func} is given and it is '1' or 'i' then case is
ignored.
When {func} is given and it is 'n' then all items will be
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 6e097fc040..4a2646f1c4 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 7.4. Last change: 2014 Aug 09
+*options.txt* For Vim version 7.4. Last change: 2014 Sep 09
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3300,7 +3300,7 @@ A jump table for the options with a short description can be found at |Q_op|.
NOTE: This option is reset when 'compatible' is set.
*'grepformat'* *'gfm'*
-'grepformat' 'gfm' string (default "%f:%l%m,%f %l%m")
+'grepformat' 'gfm' string (default "%f:%l:%m,%f:%l%m,%f %l%m")
global
{not in Vi}
Format to recognize for the ":grep" command output.
@@ -7601,6 +7601,7 @@ A jump table for the options with a short description can be found at |Q_op|.
fold options
options options and mappings local to a window or buffer (not
global values for local options)
+ localoptions same as "options"
slash backslashes in file names replaced with forward
slashes
unix with Unix end-of-line format (single <NL>), even when
diff --git a/runtime/doc/os_win32.txt b/runtime/doc/os_win32.txt
index 2c25850116..14e524e319 100644
--- a/runtime/doc/os_win32.txt
+++ b/runtime/doc/os_win32.txt
@@ -1,4 +1,4 @@
-*os_win32.txt* For Vim version 7.4. Last change: 2012 May 18
+*os_win32.txt* For Vim version 7.4. Last change: 2014 Aug 29
VIM REFERENCE MANUAL by George Reilly
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
index f66ac170ae..322811b7cf 100644
--- a/runtime/doc/pattern.txt
+++ b/runtime/doc/pattern.txt
@@ -1,4 +1,4 @@
-*pattern.txt* For Vim version 7.4. Last change: 2014 Jul 30
+*pattern.txt* For Vim version 7.4. Last change: 2014 Sep 06
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -829,6 +829,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
branch is used. Example: >
/\(.\{-}\zsFab\)\{3}
< Finds the third occurrence of "Fab".
+ This cannot be followed by a multi. *E888*
{not in Vi} {not available when compiled without the |+syntax| feature}
*/\ze*
\ze Matches at any position, and sets the end of the match there: The
@@ -837,6 +838,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
branch is used.
Example: "end\ze\(if\|for\)" matches the "end" in "endif" and
"endfor".
+ This cannot be followed by a multi. |E888|
{not in Vi} {not available when compiled without the |+syntax| feature}
*/\%^* *start-of-file*
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 35ea3ad7bc..5cd4bd5447 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -1,4 +1,4 @@
-*syntax.txt* For Vim version 7.4. Last change: 2014 Jun 27
+*syntax.txt* For Vim version 7.4. Last change: 2014 Sep 09
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -501,7 +501,7 @@ inserted for that purpose if no line numbers are shown. This ID attribute
takes the form of L123 for single-buffer HTML pages, or W2L123 for diff-view
pages, and is used to jump to a specific line (in a specific window of a diff
view). Javascript is inserted to open any closed dynamic folds
-(|g:html_dynamic_folds|) containing the specificed line before jumping. The
+(|g:html_dynamic_folds|) containing the specified line before jumping. The
javascript also allows omitting the window ID in the url, and the leading L.
For example: >
@@ -2975,6 +2975,7 @@ TEX *tex.vim* *ft-tex-syntax* *latex-syntax*
Tex: Taking Advantage of Conceal Mode |tex-conceal|
Tex: Selective Conceal Mode |g:tex_conceal|
Tex: Controlling iskeyword |g:tex_isk|
+ Tex: Fine Subscript and Superscript Control |tex-supersub|
*tex-folding* *g:tex_fold_enabled*
Tex: Want Syntax Folding? ~
@@ -3068,6 +3069,7 @@ selectively to enable just some syntax highlighting: >
<
As an example, let g:tex_fast= "M" will allow math-associated highlighting
but suppress all the other region-based syntax highlighting.
+(also see: |g:tex_conceal| and |tex-supersub|)
*tex-morecommands* *tex-package*
Tex: Want To Highlight More Commands? ~
@@ -3169,6 +3171,28 @@ syntax highlighting script handles this with the following logic:
* If g:tex_isk exists, then it will be used for the local 'iskeyword'
* Else the local 'iskeyword' will be set to 48-57,a-z,A-Z,192-255
+ *tex-supersub* *g:tex_superscripts* *g:tex_subscripts*
+ Tex: Fine Subscript and Superscript Control~
+
+ See |tex-conceal| for how to enable concealed character replacement.
+
+ See |g:tex_conceal| for selectively concealing accents, bold/italic,
+ math, Greek, and superscripts/subscripts.
+
+ One may exert fine control over which superscripts and subscripts one
+ wants syntax-based concealment for (see |:syn-cchar|). Since not all
+ fonts support all characters, one may override the
+ concealed-replacement lists; by default these lists are given by: >
+
+ let g:tex_superscripts= "[0-9a-zA-W.,:;+-<>/()=]"
+ let g:tex_subscripts= "[0-9aehijklmnoprstuvx,+-/().]"
+<
+ For example, I use Luxi Mono Bold; it doesn't support subscript
+ characters for "hklmnpst", so I put >
+ let g:tex_subscripts= "[0-9aeijoruvx,+-/().]"
+< in ~/.vim/ftplugin/tex/tex.vim in order to avoid having inscrutable
+ utf-8 glyphs appear.
+
TF *tf.vim* *ft-tf-syntax*
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index e4ac9a55a9..2d5a89ce8e 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt* For Vim version 7.4. Last change: 2014 Aug 23
+*todo.txt* For Vim version 7.4. Last change: 2014 Sep 09
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -58,30 +58,27 @@ Patch to make getregtype() return the right size for non-linux systems.
(Yasuhiro Matsumoto, 2014 Jul 8)
Breaks test_eval. Inefficient, can we only compute y_width when needed?
-Patch to fix a problem with breakindent. (Christian Brabandt, 2014 Aug 17)
-It's actually not a breakindent problem. With test: Aug 19.
-With renamed test: Aug 20
-
Problem that a previous silent ":throw" causes a following try/catch not to
work. (ZyX, 2013 Sep 28)
-ml_get error when using Python, issue 248.
-
-Patch to fix typos in help files. (Dominique, 2014 Aug 9)
-
-Way to reproduce problem that characters are put on the screen twice in Insert
-mode when using system(). (Jacob Niehus, 2014 Aug 9)
-Related to setting TMODE_COOK. Perhaps we can omit that for system()?
-
Update for Romanian spell file. (Vanilla Ice, 2014 Aug 13)
+Still produces errors.
+Add flag to ignore fifth argument of SFX.
+Conversion from utf-8 to cp1250 can't be without errors.
Patch to remove ETO_IGNORELANGUAGE, it causes Chinese characters not to show
up. (Paul Moore, 2014 Jul 30)
Should it depend on the Windows version? Waiting for feedback.
No longer needed after including DirectX patch?
+Related to issue 255?
+
+Problem with linebreak, adds a test that fails. (Nazri Ramliy, 2014 Sep 6)
+
+Patch to avoid problems with encoding conversion with diff.vim.
+(Yasuhiro Matsumoto, 2014 Sep 1.
Patch by Marcin Szamotulski to add count to :close (2014 Aug 10, update Aug
-14)
+14, Aug 30)
Make ":1close" close the first window.
Make ":+1close" close the next window.
Make ":-1close" close the previous window.
@@ -89,9 +86,16 @@ Can't easily close the help window, like ":pc" closes the preview window and
":ccl" closes the quickfix window. Add ":hclose". (Chris Gaal)
Patch for :helpclose, Christian Brabandt, 2010 Sep 6.
+Patch to fix line formatting bug. (Christian Brabandt, 2014 Sep 7)
+
+Patch to fix ml_get error. (Christian Brabandt, 2014 Sep 7)
+
Patch by Marcin Szamotulski to add +cmd to buffer commands.
(2014 Aug 18)
+Patch to fix encoding of arguments when setting 'encoding'. (Yasuhiro
+Matsumoto, 2014 Sep 4)
+
Patch to fix that system() with empty input fails. (Olaf Dabrunz, 2014 Aug 19)
When using a visual selection of multiple words and doing CTRL-W_] it jumps to
@@ -104,6 +108,8 @@ Completion for :buf does not use 'wildignorecase'. (Akshay H, 2014 May 31)
Patch to handle list with some items locked. (ZyX, 2014 Aug 17)
Prefer the second solution.
+Issue 252. Patch by Christian, 2014 Aug 26.
+
":cd C:\Windows\System32\drivers\etc*" does not work, even though the
directory exists. (Sergio Gallelli, 2013 Dec 29)
@@ -118,13 +124,16 @@ Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15)
Python: ":py raw_input('prompt')" doesn't work. (Manu Hack)
Value returned by virtcol() changes depending on how lines wrap. This is
-inconsistant with the documentation.
+inconsistent with the documentation.
MS-Windows: Crash opening very long file name starting with "\\".
(Christian Brock, 2012 Jun 29)
Syntax highlighting slow (hangs) in SASS file. (Niek Bosch, 2013 Aug 21)
+Patch to allow for a different icon on MS-Windows. (Yasuhiro Matsumoto, 2014
+Sep 7).
+
Adding "~" to 'cdpath' doesn't work for completion? (Davido, 2013 Aug 19)
"hi link" does not respect groups with GUI settings only. (Mark Lodato, 2014
@@ -141,20 +150,18 @@ Spell files use a latin single quote. Unicode also has another single quote:
New OpenOffice spell files support this with ICONV. But they are not
compatible with Vim spell files. The old files can no longer be downloaded.
-Win32: use different args for SearchPath()? (Yasuhiro Matsumoto, 2009 Jan 30)
-Also fixes wrong result from executable().
-Update from Ken Takata, 2014 Jan 10. Newer 2014 Apr 3.
-
Win32: patch to use 64 bit stat() if possible. (Ken Takata, 2014 May 12)
More tests May 14. Update May 29. Update Aug 10.
The garbage collector may use too much stack. Make set_ref_in_item()
iterative instead of recursive. Test program by Marc Weber (2013 Dec 10)
Patch by Ben Fritz, 2014 Jun 22.
+Related: Vim hangs when freeing a lot of objects. Patch by Yasuhiro
+Matsumoto, 2014 Aug 26.
Idea: For a window in the middle (has window above and below it), use
right-mouse-drag on the status line to move a window up/down without changing
-it's height? It's like dragging the status bar above it at the same time.
+its height? It's like dragging the status bar above it at the same time.
Can we make ":unlet $VAR" use unsetenv() to delete the env var?
What for systems that don't have unsetenv()?
@@ -236,7 +243,7 @@ Or should we add a more general mechanism, like lambda functions?
Patch for XDG base directory support. (Jean François Bignolles, 2014 Mar 4)
Remark on the docs. Should not be a compile time feature. But then what?
-Completion of ":e" is ":earlier", whould be ":edit". Complete to the matching
+Completion of ":e" is ":earlier", should be ":edit". Complete to the matching
command instead of doing this alphabetically. (Mikel Jorgensen)
Patch to add v:completed_item. (Shougo Matsu, 2013 Nov 29).
@@ -262,9 +269,6 @@ possible. (Christian Brabandt, 2014 Mar 12, update Aug 22)
Updated spec ftplugin. (Matěj Cepl, 2013 Oct 16)
-Some quickfix messages appear twice. (Gary Johnson, 2014 Feb 16)
-Patch by Christian Brabandt, 2014 Feb 17.
-
Patch to right-align signs. (James Kolb (email james), 2013 Sep 23)
Patch to handle integer overflow. (Aaron Burrow, 2013 Dec 12)
@@ -1437,8 +1441,8 @@ files with "foo/**" in 'path'. (Kalisiak, 2006 July 15)
Additional info: When using the |wildcards| ** globing, vim hangs
indefinitely on lots of directories. The |file-searching| globing, like in
":set path=/**" does not hang as often as with globing with |wildcards|, like
-in ":1find /**/file". This is for a files that unix "find" can find very
-quick. Merging the 2 kinds of globing might make this an easier fix. (Ian
+in ":1find /**/file". This is for files that unix "find" can find very
+quickly. Merging the 2 kinds of globing might make this an easier fix. (Ian
Kelling, 2008 July 4)
When the file name has parenthesis, e.g., "foo (bar).txt", ":!ls '%'" has the
@@ -1886,6 +1890,10 @@ restored. (Luc St-Louis)
Patch to support horizontal scroll wheel in GTK. Untested. (Bjorn Winckler,
2010 Jun 30)
+Add an option for a minimal text length before inserting a line break for
+'textwidth'. Avoids very short lines when a very long word follows.
+(Kartik Agaram)
+
At next release:
- Build a huge version by default.
diff --git a/runtime/doc/usr_04.txt b/runtime/doc/usr_04.txt
index c09cb204c5..5f24c8c6f5 100644
--- a/runtime/doc/usr_04.txt
+++ b/runtime/doc/usr_04.txt
@@ -1,4 +1,4 @@
-*usr_04.txt* For Vim version 7.4. Last change: 2008 Sep 06
+*usr_04.txt* For Vim version 7.4. Last change: 2014 Aug 29
VIM USER MANUAL - by Bram Moolenaar
@@ -186,7 +186,7 @@ commands:
/four<Enter> find the first string "four"
cwfive<Esc> change the word to "five"
n find the next "four"
- . repeat the change to "five'
+ . repeat the change to "five"
n find the next "four"
. repeat the change
etc.
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 40ccee960d..3fc109ac0d 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2014 Aug 23
+" Last Change: 2014 Sep 05
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@@ -526,6 +526,9 @@ au BufNewFile,BufRead configure.in,configure.ac setf config
" CUDA Cumpute Unified Device Architecture
au BufNewFile,BufRead *.cu setf cuda
+" Dockerfile
+au BufNewFile,BufRead Dockerfile setf dockerfile
+
" WildPackets EtherPeek Decoder
au BufNewFile,BufRead *.dcd setf dcd
@@ -1097,6 +1100,9 @@ au BufNewFile,BufRead *.lou,*.lout setf lout
" Lua
au BufNewFile,BufRead *.lua setf lua
+" Luarocks
+au BufNewFile,BufRead *.rockspec setf lua
+
" Linden Scripting Language (Second Life)
au BufNewFile,BufRead *.lsl setf lsl
diff --git a/runtime/ftplugin/dockerfile.vim b/runtime/ftplugin/dockerfile.vim
new file mode 100644
index 0000000000..2e3c447b59
--- /dev/null
+++ b/runtime/ftplugin/dockerfile.vim
@@ -0,0 +1,16 @@
+" Vim filetype plugin
+" Language: Dockerfile
+" Maintainer: Honza Pokorny <http://honza.ca>
+" Last Change: 2014 Aug 29
+
+" Only do this when not done yet for this buffer
+if exists("b:did_ftplugin")
+ finish
+endif
+
+" Don't load another plugin for this buffer
+let b:did_ftplugin = 1
+
+let b:undo_ftplugin = "setl commentstring<"
+
+setlocal commentstring=#\ %s
diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim
index edba37b896..f355d2837d 100644
--- a/runtime/ftplugin/vim.vim
+++ b/runtime/ftplugin/vim.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Vim
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2013 Jun 26
+" Last Change: 2014 Sep 07
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -62,9 +62,12 @@ if exists("loaded_matchit")
\ '\<try\>:\<cat\%[ch]\>:\<fina\%[lly]\>:\<endt\%[ry]\>,' .
\ '\<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,' .
\ '(:)'
- " Ignore ":syntax region" commands, the 'end' argument clobbers if-endif
- let b:match_skip = 'getline(".") =~ "^\\s*sy\\%[ntax]\\s\\+region" ||
- \ synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string"'
+ " Ignore syntax region commands and settings, any 'en*' would clobber
+ " if-endif.
+ " - set spl=de,en
+ " - au! FileType javascript syntax region foldBraces start=/{/ end=/}/ …
+ let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name")
+ \ =~? "comment\\|string\\|vimSynReg\\|vimSet"'
endif
let &cpo = s:cpo_save
diff --git a/runtime/indent/json.vim b/runtime/indent/json.vim
index d50112b934..649f2b8aa5 100644
--- a/runtime/indent/json.vim
+++ b/runtime/indent/json.vim
@@ -1,13 +1,168 @@
" Vim indent file
" Language: JSON
-" Maintainer: David Barnett <daviebdawg+vim@gmail.com>
-" Last Change: 2014 Jul 16
+" Mantainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json
+" Last Change: 2014 Aug 29
+" https://github.com/jakar/vim-json/commit/20b650e22aa750c4ab6a66aa646bdd95d7cd548a#diff-e81fc111b2052e306d126bd9989f7b7c
+" Original Author: Rogerz Zhang <rogerz.zhang at gmail.com> http://github.com/rogerz/vim-json
+" Acknowledgement: Based off of vim-javascript maintained by Darrick Wiebe
+" http://www.vim.org/scripts/script.php?script_id=2765
-if exists('b:did_indent')
- finish
+" 0. Initialization {{{1
+" =================
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
endif
+let b:did_indent = 1
-" JSON is a subset of JavaScript. JavaScript indenting should work fine.
-runtime! indent/javascript.vim
+setlocal nosmartindent
-let b:did_indent = 1
+" Now, set up our indentation expression and keys that trigger it.
+setlocal indentexpr=GetJSONIndent()
+setlocal indentkeys=0{,0},0),0[,0],!^F,o,O,e
+
+" Only define the function once.
+if exists("*GetJSONIndent")
+ finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" 1. Variables {{{1
+" ============
+
+let s:line_term = '\s*\%(\%(\/\/\).*\)\=$'
+" Regex that defines blocks.
+let s:block_regex = '\%({\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term
+
+" 2. Auxiliary Functions {{{1
+" ======================
+
+" Check if the character at lnum:col is inside a string.
+function s:IsInString(lnum, col)
+ return synIDattr(synID(a:lnum, a:col, 1), 'name') == 'jsonString'
+endfunction
+
+" Find line above 'lnum' that isn't empty, or in a string.
+function s:PrevNonBlankNonString(lnum)
+ let lnum = prevnonblank(a:lnum)
+ while lnum > 0
+ " If the line isn't empty or in a string, end search.
+ let line = getline(lnum)
+ if !(s:IsInString(lnum, 1) && s:IsInString(lnum, strlen(line)))
+ break
+ endif
+ let lnum = prevnonblank(lnum - 1)
+ endwhile
+ return lnum
+endfunction
+
+" Check if line 'lnum' has more opening brackets than closing ones.
+function s:LineHasOpeningBrackets(lnum)
+ let open_0 = 0
+ let open_2 = 0
+ let open_4 = 0
+ let line = getline(a:lnum)
+ let pos = match(line, '[][(){}]', 0)
+ while pos != -1
+ let idx = stridx('(){}[]', line[pos])
+ if idx % 2 == 0
+ let open_{idx} = open_{idx} + 1
+ else
+ let open_{idx - 1} = open_{idx - 1} - 1
+ endif
+ let pos = match(line, '[][(){}]', pos + 1)
+ endwhile
+ return (open_0 > 0) . (open_2 > 0) . (open_4 > 0)
+endfunction
+
+function s:Match(lnum, regex)
+ let col = match(getline(a:lnum), a:regex) + 1
+ return col > 0 && !s:IsInString(a:lnum, col) ? col : 0
+endfunction
+
+" 3. GetJSONIndent Function {{{1
+" =========================
+
+function GetJSONIndent()
+ " 3.1. Setup {{{2
+ " ----------
+
+ " Set up variables for restoring position in file. Could use v:lnum here.
+ let vcol = col('.')
+
+ " 3.2. Work on the current line {{{2
+ " -----------------------------
+
+ " Get the current line.
+ let line = getline(v:lnum)
+ let ind = -1
+
+ " If we got a closing bracket on an empty line, find its match and indent
+ " according to it.
+ let col = matchend(line, '^\s*[]}]')
+
+ if col > 0 && !s:IsInString(v:lnum, col)
+ call cursor(v:lnum, col)
+ let bs = strpart('{}[]', stridx('}]', line[col - 1]) * 2, 2)
+
+ let pairstart = escape(bs[0], '[')
+ let pairend = escape(bs[1], ']')
+ let pairline = searchpair(pairstart, '', pairend, 'bW')
+
+ if pairline > 0
+ let ind = indent(pairline)
+ else
+ let ind = virtcol('.') - 1
+ endif
+
+ return ind
+ endif
+
+ " If we are in a multi-line string, don't do anything to it.
+ if s:IsInString(v:lnum, matchend(line, '^\s*') + 1)
+ return indent('.')
+ endif
+
+ " 3.3. Work on the previous line. {{{2
+ " -------------------------------
+
+ let lnum = prevnonblank(v:lnum - 1)
+
+ if lnum == 0
+ return 0
+ endif
+
+ " Set up variables for current line.
+ let line = getline(lnum)
+ let ind = indent(lnum)
+
+ " If the previous line ended with a block opening, add a level of indent.
+ " if s:Match(lnum, s:block_regex)
+ " return indent(lnum) + &sw
+ " endif
+
+ " If the previous line contained an opening bracket, and we are still in it,
+ " add indent depending on the bracket type.
+ if line =~ '[[({]'
+ let counts = s:LineHasOpeningBrackets(lnum)
+ if counts[0] == '1' || counts[1] == '1' || counts[2] == '1'
+ return ind + &sw
+ else
+ call cursor(v:lnum, vcol)
+ end
+ endif
+
+ " }}}2
+
+ return ind
+endfunction
+
+" }}}1
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim:set sw=2 sts=2 ts=8 noet:
diff --git a/runtime/scripts.vim b/runtime/scripts.vim
index 93206b8e6e..b62b0a5db8 100644
--- a/runtime/scripts.vim
+++ b/runtime/scripts.vim
@@ -1,7 +1,7 @@
" Vim support file to detect file types in scripts
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last change: 2013 May 24
+" Last change: 2014 Aug 24
" This file is called by an autocommand for every file that has just been
" loaded into a buffer. It checks if the type of file can be recognized by
@@ -314,6 +314,10 @@ else
elseif s:line1 =~ '^==\d\+== valgrind' || s:line3 =~ '^==\d\+== Using valgrind'
set ft=valgrind
+ " Go docs
+ elseif s:line1 =~ '^PACKAGE DOCUMENTATION$'
+ set ft=godoc
+
" Renderman Interface Bytestream
elseif s:line1 =~ '^##RenderMan'
set ft=rib
diff --git a/runtime/syntax/asciidoc.vim b/runtime/syntax/asciidoc.vim
index 1303db7cf2..ccb079e06b 100644
--- a/runtime/syntax/asciidoc.vim
+++ b/runtime/syntax/asciidoc.vim
@@ -5,6 +5,7 @@
" URL: http://asciidoc.org/
" Licence: GPL (http://www.gnu.org)
" Remarks: Vim 6 or greater
+" Last Update: 2014 Aug 29 (see Issue 240)
" Limitations:
"
" - Nested quoted text formatting is highlighted according to the outer
@@ -155,7 +156,8 @@ hi def link asciidocQuotedAttributeList Special
hi def link asciidocQuotedBold Special
hi def link asciidocQuotedDoubleQuoted Label
hi def link asciidocQuotedEmphasized2 Type
-hi def link asciidocQuotedEmphasized Type
+hi asciidocQuotedEmphasizedItalic term=italic cterm=italic gui=italic
+hi def link asciidocQuotedEmphasized asciidocQuotedEmphasizedItalic
hi def link asciidocQuotedMonospaced2 Identifier
hi def link asciidocQuotedMonospaced Identifier
hi def link asciidocQuotedSingleQuoted Label
diff --git a/runtime/syntax/dockerfile.vim b/runtime/syntax/dockerfile.vim
new file mode 100644
index 0000000000..d1693cba41
--- /dev/null
+++ b/runtime/syntax/dockerfile.vim
@@ -0,0 +1,24 @@
+" dockerfile.vim - Syntax highlighting for Dockerfiles
+" Maintainer: Honza Pokorny <http://honza.ca>
+" Version: 0.5
+" Last Change: 2014 Aug 29
+" License: BSD
+
+
+if exists("b:current_syntax")
+ finish
+endif
+
+let b:current_syntax = "dockerfile"
+
+syntax case ignore
+
+syntax match dockerfileKeyword /\v^\s*(ONBUILD\s+)?(ADD|CMD|ENTRYPOINT|ENV|EXPOSE|FROM|MAINTAINER|RUN|USER|VOLUME|WORKDIR|COPY)\s/
+
+syntax region dockerfileString start=/\v"/ skip=/\v\\./ end=/\v"/
+
+syntax match dockerfileComment "\v^\s*#.*$"
+
+hi def link dockerfileString String
+hi def link dockerfileKeyword Keyword
+hi def link dockerfileComment Comment
diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim
index 31114bc093..3f719e8244 100644
--- a/runtime/syntax/tex.vim
+++ b/runtime/syntax/tex.vim
@@ -1,8 +1,8 @@
" Vim syntax file
" Language: TeX
" Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM>
-" Last Change: Mar 20, 2014
-" Version: 81
+" Last Change: Sep 09, 2014
+" Version: 82
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX
"
" Notes: {{{1
@@ -88,6 +88,12 @@ if !exists("g:tex_conceal")
else
let s:tex_conceal= g:tex_conceal
endif
+if !exists("g:tex_superscripts")
+ let g:tex_superscripts= "[0-9a-zA-W.,:;+-<>/()=]"
+endif
+if !exists("g:tex_subscripts")
+ let g:tex_subscripts= "[0-9aehijklmnoprstuvx,+-/().]"
+endif
" Determine whether or not to use "*.sty" mode {{{1
" The user may override the normal determination by setting
@@ -331,22 +337,22 @@ syn match texSpaceCodeChar "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)" contained
if s:tex_fast =~ 'p'
if !exists("g:tex_nospell") || !g:tex_nospell
if g:tex_fold_enabled && has("folding")
- syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup,@Spell
+ syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup,@Spell
syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup,@Spell
syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup,@Spell
syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup,@Spell
- syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup,@Spell
+ syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup,@Spell
syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSubSectionGroup,@Spell
syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texParaGroup,@Spell
syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@Spell
syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup,@Spell
syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup,@Spell
else
- syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell
+ syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell
syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell
syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup,@Spell
syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup,@Spell
- syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell
+ syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell
syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell
syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup,@Spell
syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@Spell
@@ -355,22 +361,22 @@ if s:tex_fast =~ 'p'
endif
else
if g:tex_fold_enabled && has("folding")
- syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup
+ syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup
syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup
syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup
syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup
- syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup
+ syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup
syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSubSectionGroup
syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texParaGroup
syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup
syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup
syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup
else
- syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup
+ syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup
syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup
syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup
syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup
- syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup
+ syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup
syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup
syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup
syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup
@@ -620,7 +626,7 @@ if s:tex_fast =~ 'r'
syn region texRefZone matchgroup=texStatement start="\\\(page\|eq\)ref{" end="}\|%stopzone\>" contains=@texRefGroup
syn region texRefZone matchgroup=texStatement start="\\v\=ref{" end="}\|%stopzone\>" contains=@texRefGroup
syn region texRefOption contained matchgroup=Delimiter start='\[' end=']' contains=@texRefGroup,texRefZone nextgroup=texRefOption,texCite
- syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup,texRefZone,texCite
+ syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup,texRefZone,texCite
endif
syn match texRefZone '\\cite\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite
@@ -1045,8 +1051,11 @@ if has("conceal") && &enc == 'utf-8'
syn region texSubscript matchgroup=Delimiter start='_{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSubscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
endif
fun! s:SuperSub(group,leader,pat,cchar)
- exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar
- exe 'syn match '.a:group."s '".a:pat."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s'
+ if a:pat =~ '^\\' || (a:leader == '\^' && a:pat =~ g:tex_superscripts) || (a:leader == '_' && a:pat =~ g:tex_subscripts)
+" call Decho("SuperSub: group<".a:group."> leader<".a:leader."> pat<".a:pat."> cchar<".a:cchar.">")
+ exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar
+ exe 'syn match '.a:group."s '".a:pat."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s'
+ endif
endfun
call s:SuperSub('texSuperscript','\^','0','⁰')
call s:SuperSub('texSuperscript','\^','1','¹')
@@ -1170,44 +1179,44 @@ if has("conceal") && &enc == 'utf-8'
let i= i + 1
endfor
endfun
- " \` \' \^ \" \~ \. \= \c \H \k \r \u \v
- call s:Accents('a','à','á','â','ä','ã','ȧ','ā',' ',' ','ą','å','ă','ǎ')
- call s:Accents('A','À','Á','Â','Ä','Ã','Ȧ','Ā',' ',' ','Ą','Å','Ă','Ǎ')
- call s:Accents('c',' ','ć','ĉ',' ',' ','ċ',' ','ç',' ',' ',' ',' ','č')
- call s:Accents('C',' ','Ć','Ĉ',' ',' ','Ċ',' ','Ç',' ',' ',' ',' ','Č')
- call s:Accents('d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ď')
- call s:Accents('D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ď')
- call s:Accents('e','è','é','ê','ë','ẽ','ė','ē','ȩ',' ','ę',' ','ĕ','ě')
- call s:Accents('E','È','É','Ê','Ë','Ẽ','Ė','Ē','Ȩ',' ','Ę',' ','Ĕ','Ě')
- call s:Accents('g',' ','ǵ','ĝ',' ',' ','ġ',' ','ģ',' ',' ',' ','ğ','ǧ')
- call s:Accents('G',' ','Ǵ','Ĝ',' ',' ','Ġ',' ','Ģ',' ',' ',' ','Ğ','Ǧ')
- call s:Accents('h',' ',' ','ĥ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ȟ')
- call s:Accents('H',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ȟ')
- call s:Accents('i','ì','í','î','ï','ĩ','į','ī',' ',' ','į',' ','ĭ','ǐ')
- call s:Accents('I','Ì','Í','Î','Ï','Ĩ','İ','Ī',' ',' ','Į',' ','Ĭ','Ǐ')
- call s:Accents('J',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ǰ')
- call s:Accents('k',' ',' ',' ',' ',' ',' ',' ','ķ',' ',' ',' ',' ','ǩ')
- call s:Accents('K',' ',' ',' ',' ',' ',' ',' ','Ķ',' ',' ',' ',' ','Ǩ')
- call s:Accents('l',' ','ĺ','ľ',' ',' ',' ',' ','ļ',' ',' ',' ',' ','ľ')
- call s:Accents('L',' ','Ĺ','Ľ',' ',' ',' ',' ','Ļ',' ',' ',' ',' ','Ľ')
- call s:Accents('n',' ','ń',' ',' ','ñ',' ',' ','ņ',' ',' ',' ',' ','ň')
- call s:Accents('N',' ','Ń',' ',' ','Ñ',' ',' ','Ņ',' ',' ',' ',' ','Ň')
- call s:Accents('o','ò','ó','ô','ö','õ','ȯ','ō',' ','ő','ǫ',' ','ŏ','ǒ')
- call s:Accents('O','Ò','Ó','Ô','Ö','Õ','Ȯ','Ō',' ','Ő','Ǫ',' ','Ŏ','Ǒ')
- call s:Accents('r',' ','ŕ',' ',' ',' ',' ',' ','ŗ',' ',' ',' ',' ','ř')
- call s:Accents('R',' ','Ŕ',' ',' ',' ',' ',' ','Ŗ',' ',' ',' ',' ','Ř')
- call s:Accents('s',' ','ś','ŝ',' ',' ',' ',' ','ş',' ','ȿ',' ',' ','š')
- call s:Accents('S',' ','Ś','Ŝ',' ',' ',' ',' ','Ş',' ',' ',' ',' ','Š')
- call s:Accents('t',' ',' ',' ',' ',' ',' ',' ','ţ',' ',' ',' ',' ','ť')
- call s:Accents('T',' ',' ',' ',' ',' ',' ',' ','Ţ',' ',' ',' ',' ','Ť')
- call s:Accents('u','ù','ú','û','ü','ũ',' ','ū',' ','ű','ų','ů','ŭ','ǔ')
- call s:Accents('U','Ù','Ú','Û','Ü','Ũ',' ','Ū',' ','Ű','Ų','Ů','Ŭ','Ǔ')
- call s:Accents('w',' ',' ','ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ')
- call s:Accents('W',' ',' ','Ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ')
- call s:Accents('y','ỳ','ý','ŷ','ÿ','ỹ',' ',' ',' ',' ',' ',' ',' ',' ')
- call s:Accents('Y','Ỳ','Ý','Ŷ','Ÿ','Ỹ',' ',' ',' ',' ',' ',' ',' ',' ')
- call s:Accents('z',' ','ź',' ',' ',' ','ż',' ',' ',' ',' ',' ',' ','ž')
- call s:Accents('Z',' ','Ź',' ',' ',' ','Ż',' ',' ',' ',' ',' ',' ','Ž')
+ " \` \' \^ \" \~ \. \= \c \H \k \r \u \v
+ call s:Accents('a','à','á','â','ä','ã','ȧ','ā',' ',' ','ą','å','ă','ǎ')
+ call s:Accents('A','À','Á','Â','Ä','Ã','Ȧ','Ā',' ',' ','Ą','Å','Ă','Ǎ')
+ call s:Accents('c',' ','ć','ĉ',' ',' ','ċ',' ','ç',' ',' ',' ',' ','č')
+ call s:Accents('C',' ','Ć','Ĉ',' ',' ','Ċ',' ','Ç',' ',' ',' ',' ','Č')
+ call s:Accents('d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ď')
+ call s:Accents('D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ď')
+ call s:Accents('e','è','é','ê','ë','ẽ','ė','ē','ȩ',' ','ę',' ','ĕ','ě')
+ call s:Accents('E','È','É','Ê','Ë','Ẽ','Ė','Ē','Ȩ',' ','Ę',' ','Ĕ','Ě')
+ call s:Accents('g',' ','ǵ','ĝ',' ',' ','ġ',' ','ģ',' ',' ',' ','ğ','ǧ')
+ call s:Accents('G',' ','Ǵ','Ĝ',' ',' ','Ġ',' ','Ģ',' ',' ',' ','Ğ','Ǧ')
+ call s:Accents('h',' ',' ','ĥ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ȟ')
+ call s:Accents('H',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ȟ')
+ call s:Accents('i','ì','í','î','ï','ĩ','į','ī',' ',' ','į',' ','ĭ','ǐ')
+ call s:Accents('I','Ì','Í','Î','Ï','Ĩ','İ','Ī',' ',' ','Į',' ','Ĭ','Ǐ')
+ call s:Accents('J',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ǰ')
+ call s:Accents('k',' ',' ',' ',' ',' ',' ',' ','ķ',' ',' ',' ',' ','ǩ')
+ call s:Accents('K',' ',' ',' ',' ',' ',' ',' ','Ķ',' ',' ',' ',' ','Ǩ')
+ call s:Accents('l',' ','ĺ','ľ',' ',' ',' ',' ','ļ',' ',' ',' ',' ','ľ')
+ call s:Accents('L',' ','Ĺ','Ľ',' ',' ',' ',' ','Ļ',' ',' ',' ',' ','Ľ')
+ call s:Accents('n',' ','ń',' ',' ','ñ',' ',' ','ņ',' ',' ',' ',' ','ň')
+ call s:Accents('N',' ','Ń',' ',' ','Ñ',' ',' ','Ņ',' ',' ',' ',' ','Ň')
+ call s:Accents('o','ò','ó','ô','ö','õ','ȯ','ō',' ','ő','ǫ',' ','ŏ','ǒ')
+ call s:Accents('O','Ò','Ó','Ô','Ö','Õ','Ȯ','Ō',' ','Ő','Ǫ',' ','Ŏ','Ǒ')
+ call s:Accents('r',' ','ŕ',' ',' ',' ',' ',' ','ŗ',' ',' ',' ',' ','ř')
+ call s:Accents('R',' ','Ŕ',' ',' ',' ',' ',' ','Ŗ',' ',' ',' ',' ','Ř')
+ call s:Accents('s',' ','ś','ŝ',' ',' ',' ',' ','ş',' ','ȿ',' ',' ','š')
+ call s:Accents('S',' ','Ś','Ŝ',' ',' ',' ',' ','Ş',' ',' ',' ',' ','Š')
+ call s:Accents('t',' ',' ',' ',' ',' ',' ',' ','ţ',' ',' ',' ',' ','ť')
+ call s:Accents('T',' ',' ',' ',' ',' ',' ',' ','Ţ',' ',' ',' ',' ','Ť')
+ call s:Accents('u','ù','ú','û','ü','ũ',' ','ū',' ','ű','ų','ů','ŭ','ǔ')
+ call s:Accents('U','Ù','Ú','Û','Ü','Ũ',' ','Ū',' ','Ű','Ų','Ů','Ŭ','Ǔ')
+ call s:Accents('w',' ',' ','ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ')
+ call s:Accents('W',' ',' ','Ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ')
+ call s:Accents('y','ỳ','ý','ŷ','ÿ','ỹ',' ',' ',' ',' ',' ',' ',' ',' ')
+ call s:Accents('Y','Ỳ','Ý','Ŷ','Ÿ','Ỹ',' ',' ',' ',' ',' ',' ',' ',' ')
+ call s:Accents('z',' ','ź',' ',' ',' ','ż',' ',' ',' ',' ',' ',' ','ž')
+ call s:Accents('Z',' ','Ź',' ',' ',' ','Ż',' ',' ',' ',' ',' ',' ','Ž')
call s:Accents('\\i','ì','í','î','ï','ĩ','į',' ',' ',' ',' ',' ','ĭ',' ')
" \` \' \^ \" \~ \. \= \c \H \k \r \u \v
delfun s:Accents
@@ -1252,7 +1261,7 @@ endif
if did_tex_syntax_inits == 1
let did_tex_syntax_inits= 2
" TeX highlighting groups which should share similar highlighting
- if !exists("s:tex_no_error")
+ if !exists("g:tex_no_error")
if !exists("g:tex_no_math")
HiLink texBadMath texError
HiLink texMathDelimBad texError
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index c688c3d330..5fe52e3323 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -59,7 +59,6 @@ set(CONV_SOURCES
fileio.c
fold.c
getchar.c
- hardcopy.c
if_cscope.c
indent.c
keymap.c
@@ -81,11 +80,9 @@ set(CONV_SOURCES
regexp.c
screen.c
search.c
- sha256.c
spell.c
syntax.c
tag.c
- term.c
ui.c
version.c
window.c)
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index ef921fdb8a..9974315d3f 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -4498,7 +4498,7 @@ static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
{
char_u *p;
char_u *name;
- int extra = 0;
+ unsigned int extra = 0;
/*
* Find the end of the string, skipping backslashed characters.
@@ -5129,7 +5129,7 @@ void list_append_list(list_T *list, list_T *itemlist)
li->li_tv.v_lock = 0;
li->li_tv.vval.v_list = itemlist;
list_append(list, li);
- ++list->lv_refcount;
+ ++itemlist->lv_refcount;
}
/*
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index f53a780efe..11a7e9ecac 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -497,14 +497,6 @@ EXTERN bool mouse_past_bottom INIT(= false); /* mouse below last line */
EXTERN bool mouse_past_eol INIT(= false); /* mouse right of line */
EXTERN int mouse_dragging INIT(= 0); /* extending Visual area with
mouse dragging */
-/*
- * When the DEC mouse has been pressed but not yet released we enable
- * automatic querys for the mouse position.
- */
-EXTERN int WantQueryMouse INIT(= FALSE);
-
-
-
/* Value set from 'diffopt'. */
EXTERN int diff_context INIT(= 6); /* context for folds */
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index f1f619066a..d072277d38 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -10,6 +10,7 @@
* hardcopy.c: printing to paper
*/
+#include <assert.h>
#include <errno.h>
#include <string.h>
#include <inttypes.h>
@@ -82,11 +83,11 @@
* void mch_print_set_font(int Bold, int Italic, int Underline);
* Called whenever the font style changes.
*
- * void mch_print_set_bg(long_u bgcol);
+ * void mch_print_set_bg(uint32_t bgcol);
* Called to set the background color for the following text. Parameter is an
* RGB value.
*
- * void mch_print_set_fg(long_u fgcol);
+ * void mch_print_set_fg(uint32_t fgcol);
* Called to set the foreground color for the following text. Parameter is an
* RGB value.
*
@@ -124,30 +125,28 @@ static option_table_T printer_opts[OPT_PRINT_NUM_OPTIONS]
;
-static const long_u cterm_color_8[8] =
-{
- (long_u)0x000000L, (long_u)0xff0000L, (long_u)0x00ff00L, (long_u)0xffff00L,
- (long_u)0x0000ffL, (long_u)0xff00ffL, (long_u)0x00ffffL, (long_u)0xffffffL
+static const uint32_t cterm_color_8[8] = {
+ 0x000000, 0xff0000, 0x00ff00, 0xffff00,
+ 0x0000ff, 0xff00ff, 0x00ffff, 0xffffff
};
-static const long_u cterm_color_16[16] =
-{
- (long_u)0x000000L, (long_u)0x0000c0L, (long_u)0x008000L, (long_u)0x004080L,
- (long_u)0xc00000L, (long_u)0xc000c0L, (long_u)0x808000L, (long_u)0xc0c0c0L,
- (long_u)0x808080L, (long_u)0x6060ffL, (long_u)0x00ff00L, (long_u)0x00ffffL,
- (long_u)0xff8080L, (long_u)0xff40ffL, (long_u)0xffff00L, (long_u)0xffffffL
+static const uint32_t cterm_color_16[16] = {
+ 0x000000, 0x0000c0, 0x008000, 0x004080,
+ 0xc00000, 0xc000c0, 0x808000, 0xc0c0c0,
+ 0x808080, 0x6060ff, 0x00ff00, 0x00ffff,
+ 0xff8080, 0xff40ff, 0xffff00, 0xffffff
};
static int current_syn_id;
-#define PRCOLOR_BLACK (long_u)0
-#define PRCOLOR_WHITE (long_u)0xFFFFFFL
+#define PRCOLOR_BLACK 0
+#define PRCOLOR_WHITE 0xffffff
static int curr_italic;
static int curr_bold;
static int curr_underline;
-static long_u curr_bg;
-static long_u curr_fg;
+static uint32_t curr_bg;
+static uint32_t curr_fg;
static int page_count;
# define OPT_MBFONT_USECOURIER 0
@@ -176,7 +175,7 @@ typedef struct {
int print_pos; /* virtual column for computing TABs */
colnr_T column; /* byte column */
linenr_T file_line; /* line nr in the buffer */
- long_u bytes_printed; /* bytes printed so far */
+ size_t bytes_printed; /* bytes printed so far */
int ff; /* seen form feed character */
} prt_pos_T;
@@ -340,14 +339,14 @@ static char_u *parse_list_options(char_u *option_str, option_table_T *table, int
* If using a dark background, the colors will probably be too bright to show
* up well on white paper, so reduce their brightness.
*/
-static long_u darken_rgb(long_u rgb)
+static uint32_t darken_rgb(uint32_t rgb)
{
return ((rgb >> 17) << 16)
+ (((rgb & 0xff00) >> 9) << 8)
+ ((rgb & 0xff) >> 1);
}
-static long_u prt_get_term_color(int colorindex)
+static uint32_t prt_get_term_color(int colorindex)
{
/* TODO: Should check for xterm with 88 or 256 colors. */
if (t_colors > 8)
@@ -358,8 +357,8 @@ static long_u prt_get_term_color(int colorindex)
static void prt_get_attr(int hl_id, prt_text_attr_T *pattr, int modec)
{
int colorindex;
- long_u fg_color;
- long_u bg_color;
+ uint32_t fg_color;
+ uint32_t bg_color;
char *color;
pattr->bold = (highlight_has_attr(hl_id, HL_BOLD, modec) != NULL);
@@ -391,7 +390,7 @@ static void prt_get_attr(int hl_id, prt_text_attr_T *pattr, int modec)
pattr->bg_color = bg_color;
}
-static void prt_set_fg(long_u fg)
+static void prt_set_fg(uint32_t fg)
{
if (fg != curr_fg) {
curr_fg = fg;
@@ -399,7 +398,7 @@ static void prt_set_fg(long_u fg)
}
}
-static void prt_set_bg(long_u bg)
+static void prt_set_bg(uint32_t bg)
{
if (bg != curr_bg) {
curr_bg = bg;
@@ -455,8 +454,11 @@ static void prt_line_number(prt_settings_T *psettings, int page_line, linenr_T l
*/
int prt_header_height(void)
{
- if (printer_opts[OPT_PRINT_HEADERHEIGHT].present)
- return printer_opts[OPT_PRINT_HEADERHEIGHT].number;
+ if (printer_opts[OPT_PRINT_HEADERHEIGHT].present) {
+ assert(printer_opts[OPT_PRINT_HEADERHEIGHT].number >= INT_MIN
+ && printer_opts[OPT_PRINT_HEADERHEIGHT].number <= INT_MAX);
+ return (int)printer_opts[OPT_PRINT_HEADERHEIGHT].number;
+ }
return 2;
}
@@ -503,7 +505,8 @@ static void prt_header(prt_settings_T *psettings, int pagenum, linenr_T lnum)
if (prt_use_number())
width += PRINT_NUMBER_WIDTH;
- tbuf = xmalloc(width + IOSIZE);
+ assert(width >= 0);
+ tbuf = xmalloc((size_t)width + IOSIZE);
if (*p_header != NUL) {
linenr_T tmp_lnum, tmp_topline, tmp_botline;
@@ -524,7 +527,7 @@ static void prt_header(prt_settings_T *psettings, int pagenum, linenr_T lnum)
printer_page_num = pagenum;
use_sandbox = was_set_insecurely((char_u *)"printheader", 0);
- build_stl_str_hl(curwin, tbuf, (size_t)(width + IOSIZE),
+ build_stl_str_hl(curwin, tbuf, (size_t)width + IOSIZE,
p_header, use_sandbox,
' ', width, NULL, NULL);
@@ -582,7 +585,7 @@ void ex_hardcopy(exarg_T *eap)
linenr_T lnum;
int collated_copies, uncollated_copies;
prt_settings_T settings;
- long_u bytes_to_print = 0;
+ size_t bytes_to_print = 0;
int page_line;
int jobsplit;
@@ -655,15 +658,15 @@ void ex_hardcopy(exarg_T *eap)
* Estimate the total lines to be printed
*/
for (lnum = eap->line1; lnum <= eap->line2; lnum++)
- bytes_to_print += (long_u)STRLEN(skipwhite(ml_get(lnum)));
+ bytes_to_print += STRLEN(skipwhite(ml_get(lnum)));
if (bytes_to_print == 0) {
MSG(_("No text to be printed"));
goto print_fail_no_begin;
}
/* Set colors and font to normal. */
- curr_bg = (long_u)0xffffffffL;
- curr_fg = (long_u)0xffffffffL;
+ curr_bg = 0xffffffff;
+ curr_fg = 0xffffffff;
curr_italic = MAYBE;
curr_bold = MAYBE;
curr_underline = MAYBE;
@@ -728,13 +731,10 @@ void ex_hardcopy(exarg_T *eap)
if (got_int || settings.user_abort)
goto print_fail;
- sprintf((char *)IObuff, _("Printing page %d (%d%%)"),
- page_count + 1 + side,
- prtpos.bytes_printed > 1000000
- ? (int)(prtpos.bytes_printed /
- (bytes_to_print / 100))
- : (int)((prtpos.bytes_printed * 100)
- / bytes_to_print));
+ assert(prtpos.bytes_printed * 100 > prtpos.bytes_printed);
+ sprintf((char *)IObuff, _("Printing page %d (%zu%%)"),
+ page_count + 1 + side,
+ prtpos.bytes_printed * 100 / bytes_to_print);
if (!mch_print_begin_page(IObuff))
goto print_fail;
@@ -820,7 +820,7 @@ static colnr_T hardcopy_line(prt_settings_T *psettings, int page_line, prt_pos_T
int need_break = FALSE;
int outputlen;
int tab_spaces;
- long_u print_pos;
+ int print_pos;
prt_text_attr_T attr;
int id;
@@ -900,7 +900,7 @@ static colnr_T hardcopy_line(prt_settings_T *psettings, int page_line, prt_pos_T
}
ppos->lead_spaces = tab_spaces;
- ppos->print_pos = (int)print_pos;
+ ppos->print_pos = print_pos;
/*
* Start next line of file if we clip lines, or have reached end of the
@@ -1240,19 +1240,19 @@ static char_u *prt_ps_file_name = NULL;
* Various offsets and dimensions in default PostScript user space (points).
* Used for text positioning calculations
*/
-static float prt_page_width;
-static float prt_page_height;
-static float prt_left_margin;
-static float prt_right_margin;
-static float prt_top_margin;
-static float prt_bottom_margin;
-static float prt_line_height;
-static float prt_first_line_height;
-static float prt_char_width;
-static float prt_number_width;
-static float prt_bgcol_offset;
-static float prt_pos_x_moveto = 0.0;
-static float prt_pos_y_moveto = 0.0;
+static double prt_page_width;
+static double prt_page_height;
+static double prt_left_margin;
+static double prt_right_margin;
+static double prt_top_margin;
+static double prt_bottom_margin;
+static double prt_line_height;
+static double prt_first_line_height;
+static double prt_char_width;
+static double prt_number_width;
+static double prt_bgcol_offset;
+static double prt_pos_x_moveto = 0.0;
+static double prt_pos_y_moveto = 0.0;
/*
* Various control variables used to decide when and how to change the
@@ -1272,7 +1272,7 @@ static int prt_do_bgcol;
static int prt_bgcol;
static int prt_new_bgcol;
static int prt_attribute_change;
-static float prt_text_run;
+static double prt_text_run;
static int prt_page_num;
static int prt_bufsiz;
@@ -1304,11 +1304,10 @@ static int prt_half_width;
static char *prt_ascii_encoding;
static char_u prt_hexchar[] = "0123456789abcdef";
-static void prt_write_file_raw_len(char_u *buffer, int bytes)
+static void prt_write_file_raw_len(char_u *buffer, size_t bytes)
{
if (!prt_file_error
- && fwrite(buffer, sizeof(char_u), bytes, prt_ps_fd)
- != (size_t)bytes) {
+ && fwrite(buffer, sizeof(char_u), bytes, prt_ps_fd) != bytes) {
EMSG(_("E455: Error writing to PostScript output file"));
prt_file_error = TRUE;
}
@@ -1316,10 +1315,10 @@ static void prt_write_file_raw_len(char_u *buffer, int bytes)
static void prt_write_file(char_u *buffer)
{
- prt_write_file_len(buffer, (int)STRLEN(buffer));
+ prt_write_file_len(buffer, STRLEN(buffer));
}
-static void prt_write_file_len(char_u *buffer, int bytes)
+static void prt_write_file_len(char_u *buffer, size_t bytes)
{
prt_write_file_raw_len(buffer, bytes);
}
@@ -1398,15 +1397,11 @@ static void prt_dup_cidfont(char *original_name, char *new_name)
*/
static void prt_real_bits(double real, int precision, int *pinteger, int *pfraction)
{
- int i;
- int integer;
- float fraction;
-
- integer = (int)real;
- fraction = (float)(real - integer);
- if (real < (double)integer)
+ int integer = (int)real;
+ double fraction = real - integer;
+ if (real < integer)
fraction = -fraction;
- for (i = 0; i < precision; i++)
+ for (int i = 0; i < precision; i++)
fraction *= 10.0;
*pinteger = integer;
@@ -1463,7 +1458,7 @@ static void prt_flush_buffer(void)
if (!GA_EMPTY(&prt_ps_buffer)) {
/* Any background color must be drawn first */
if (prt_do_bgcol && (prt_new_bgcol != PRCOLOR_WHITE)) {
- int r, g, b;
+ unsigned int r, g, b;
if (prt_do_moveto) {
prt_write_real(prt_pos_x_moveto, 2);
@@ -1505,7 +1500,8 @@ static void prt_flush_buffer(void)
prt_write_string("<");
else
prt_write_string("(");
- prt_write_file_raw_len(prt_ps_buffer.ga_data, prt_ps_buffer.ga_len);
+ assert(prt_ps_buffer.ga_len >= 0);
+ prt_write_file_raw_len(prt_ps_buffer.ga_data, (size_t)prt_ps_buffer.ga_len);
if (prt_out_mbyte)
prt_write_string(">");
else
@@ -1954,32 +1950,34 @@ void mch_print_cleanup(void)
}
}
-static float to_device_units(int idx, double physsize, int def_number)
+static double to_device_units(int idx, double physsize, int def_number)
{
- float ret;
- int u;
+ double ret;
int nr;
- u = prt_get_unit(idx);
+ int u = prt_get_unit(idx);
if (u == PRT_UNIT_NONE) {
u = PRT_UNIT_PERC;
nr = def_number;
- } else
- nr = printer_opts[idx].number;
+ } else {
+ assert(printer_opts[idx].number >= INT_MIN
+ && printer_opts[idx].number <= INT_MAX);
+ nr = (int)printer_opts[idx].number;
+ }
switch (u) {
case PRT_UNIT_INCH:
- ret = (float)(nr * PRT_PS_DEFAULT_DPI);
+ ret = nr * PRT_PS_DEFAULT_DPI;
break;
case PRT_UNIT_MM:
- ret = (float)(nr * PRT_PS_DEFAULT_DPI) / (float)25.4;
+ ret = nr * PRT_PS_DEFAULT_DPI / 25.4;
break;
case PRT_UNIT_POINT:
- ret = (float)nr;
+ ret = nr;
break;
case PRT_UNIT_PERC:
default:
- ret = (float)(physsize * nr) / 100;
+ ret = physsize * nr / 100;
break;
}
@@ -2022,7 +2020,8 @@ static int prt_get_cpl(void)
static void prt_build_cid_fontname(int font, char_u *name, int name_len)
{
- char *fontname = xstrndup((char *)name, name_len);
+ assert(name_len >= 0);
+ char *fontname = xstrndup((char *)name, (size_t)name_len);
prt_ps_mb_font.ps_fontname[font] = fontname;
}
@@ -2408,7 +2407,7 @@ static int prt_add_resource(struct prt_ps_resource_S *resource)
}
if (bytes_read == 0)
break;
- prt_write_file_raw_len(resource_buffer, (int)bytes_read);
+ prt_write_file_raw_len(resource_buffer, bytes_read);
if (prt_file_error) {
fclose(fd_resource);
return FALSE;
@@ -2851,8 +2850,8 @@ int mch_print_begin_page(char_u *str)
prt_dsc_noarg("EndPageSetup");
/* We have reset the font attributes, force setting them again. */
- curr_bg = (long_u)0xffffffff;
- curr_fg = (long_u)0xffffffff;
+ curr_bg = 0xffffffff;
+ curr_fg = 0xffffffff;
curr_bold = MAYBE;
return !prt_file_error;
@@ -2863,8 +2862,8 @@ int mch_print_blank_page(void)
return mch_print_begin_page(NULL) ? (mch_print_end_page()) : FALSE;
}
-static float prt_pos_x = 0;
-static float prt_pos_y = 0;
+static double prt_pos_x = 0;
+static double prt_pos_y = 0;
void mch_print_start_line(int margin, int page_line)
{
@@ -2885,8 +2884,8 @@ int mch_print_text_out(char_u *p, int len)
int need_break;
char_u ch;
char_u ch_buff[8];
- float char_width;
- float next_pos;
+ double char_width;
+ double next_pos;
int in_ascii;
int half_width;
@@ -2959,7 +2958,7 @@ int mch_print_text_out(char_u *p, int len)
prt_need_font = FALSE;
}
if (prt_need_fgcol) {
- int r, g, b;
+ unsigned int r, g, b;
r = ((unsigned)prt_fgcol & 0xff0000) >> 16;
g = ((unsigned)prt_fgcol & 0xff00) >> 8;
b = prt_fgcol & 0xff;
@@ -3003,9 +3002,9 @@ int mch_print_text_out(char_u *p, int len)
*/
do {
ch = prt_hexchar[(unsigned)(*p) >> 4];
- ga_append(&prt_ps_buffer, ch);
+ ga_append(&prt_ps_buffer, (char)ch);
ch = prt_hexchar[(*p) & 0xf];
- ga_append(&prt_ps_buffer, ch);
+ ga_append(&prt_ps_buffer, (char)ch);
p++;
} while (--len);
} else {
@@ -3032,13 +3031,13 @@ int mch_print_text_out(char_u *p, int len)
default:
sprintf((char *)ch_buff, "%03o", (unsigned int)ch);
- ga_append(&prt_ps_buffer, ch_buff[0]);
- ga_append(&prt_ps_buffer, ch_buff[1]);
- ga_append(&prt_ps_buffer, ch_buff[2]);
+ ga_append(&prt_ps_buffer, (char)ch_buff[0]);
+ ga_append(&prt_ps_buffer, (char)ch_buff[1]);
+ ga_append(&prt_ps_buffer, (char)ch_buff[2]);
break;
}
} else
- ga_append(&prt_ps_buffer, ch);
+ ga_append(&prt_ps_buffer, (char)ch);
}
/* Need to free any translated characters */
@@ -3080,16 +3079,18 @@ void mch_print_set_font(int iBold, int iItalic, int iUnderline)
}
}
-void mch_print_set_bg(long_u bgcol)
+void mch_print_set_bg(uint32_t bgcol)
{
+ assert(bgcol <= INT_MAX);
prt_bgcol = (int)bgcol;
prt_attribute_change = TRUE;
prt_need_bgcol = TRUE;
}
-void mch_print_set_fg(long_u fgcol)
+void mch_print_set_fg(uint32_t fgcol)
{
- if (fgcol != (long_u)prt_fgcol) {
+ assert(fgcol <= INT_MAX);
+ if ((int)fgcol != prt_fgcol) {
prt_fgcol = (int)fgcol;
prt_attribute_change = TRUE;
prt_need_fgcol = TRUE;
diff --git a/src/nvim/hardcopy.h b/src/nvim/hardcopy.h
index fa171db989..9a74396ef4 100644
--- a/src/nvim/hardcopy.h
+++ b/src/nvim/hardcopy.h
@@ -1,12 +1,14 @@
#ifndef NVIM_HARDCOPY_H
#define NVIM_HARDCOPY_H
+#include <stdint.h>
+
/*
* Structure to hold printing color and font attributes.
*/
typedef struct {
- long_u fg_color;
- long_u bg_color;
+ uint32_t fg_color;
+ uint32_t bg_color;
int bold;
int italic;
int underline;
diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c
index 33eaf35555..251926c01a 100644
--- a/src/nvim/keymap.c
+++ b/src/nvim/keymap.c
@@ -487,7 +487,7 @@ char_u *get_special_key_name(int c, int modifiers)
* If there is a match, srcp is advanced to after the <> name.
* dst[] must be big enough to hold the result (up to six characters)!
*/
-int
+unsigned int
trans_special (
char_u **srcp,
char_u *dst,
@@ -729,9 +729,9 @@ int get_special_key_code(char_u *name)
return 0;
}
-char_u *get_key_name(int i)
+char_u *get_key_name(size_t i)
{
- if (i >= (int)KEY_NAMES_TABLE_LEN)
+ if (i >= KEY_NAMES_TABLE_LEN)
return NULL;
return key_names_table[i].name;
}
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index 4ded438f52..ef9f0ca408 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -127,6 +127,7 @@ int setmark_pos(int c, pos_T *pos, int fnum)
return OK;
}
if (isupper(c)) {
+ assert(c >= 'A' && c <= 'Z');
i = c - 'A';
namedfm[i].fmark.mark = *pos;
namedfm[i].fmark.fnum = fnum;
@@ -1219,8 +1220,10 @@ int read_viminfo_filemark(vir_T *virp, int force)
}
} else if (VIM_ISDIGIT(*str))
fm = &namedfm[*str - '0' + NMARKS];
- else
+ else { // is uppercase
+ assert(*str >= 'A' && *str <= 'Z');
fm = &namedfm[*str - 'A'];
+ }
if (fm != NULL && (fm->fmark.mark.lnum == 0 || force)) {
str = skipwhite(str + 1);
fm->fmark.mark.lnum = getdigits(&str);
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index e1dc2b93d9..e1aed23e8c 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -11,6 +11,7 @@
* the operators.
*/
+#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <string.h>
@@ -388,6 +389,7 @@ static int find_command(int cmdchar)
/* If the character is in the first part: The character is the index into
* nv_cmd_idx[]. */
+ assert(nv_max_linear < (int)NV_CMDS_SIZE);
if (cmdchar <= nv_max_linear)
return nv_cmd_idx[cmdchar];
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 9b33b6732c..3cefc9f623 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -515,17 +515,17 @@ static void block_insert(oparg_T *oap, char_u *s, int b_insert, struct block_def
}
if (has_mbyte && spaces > 0) {
+ int off;
+
// Avoid starting halfway a multi-byte character.
if (b_insert) {
- int off = (*mb_head_off)(oldp, oldp + offset + spaces);
- spaces -= off;
- count -= off;
+ off = (*mb_head_off)(oldp, oldp + offset + spaces);
} else {
- int off = (*mb_off_next)(oldp, oldp + offset);
+ off = (*mb_off_next)(oldp, oldp + offset);
offset += off;
- spaces = 0;
- count = 0;
}
+ spaces -= off;
+ count -= off;
}
newp = (char_u *) xmalloc((size_t)(STRLEN(oldp) + s_len + count + 1));
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 1c07bef3e3..20e983b253 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -887,7 +887,7 @@ static struct vimoption
SCRIPTID_INIT},
{"history", "hi", P_NUM|P_VIM,
(char_u *)&p_hi, PV_NONE,
- {(char_u *)0L, (char_u *)20L} SCRIPTID_INIT},
+ {(char_u *)0L, (char_u *)50L} SCRIPTID_INIT},
{"hkmap", "hk", P_BOOL|P_VI_DEF|P_VIM,
(char_u *)&p_hkmap, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
@@ -7257,7 +7257,6 @@ int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***
{
int num_normal = 0; /* Nr of matching non-term-code settings */
int num_term = 0; /* Nr of matching terminal code settings */
- int opt_idx;
int match;
int count = 0;
char_u *str;
@@ -7283,7 +7282,7 @@ int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***
(*file)[count++] = vim_strsave((char_u *)names[match]);
}
}
- for (opt_idx = 0; (str = (char_u *)options[opt_idx].fullname) != NULL;
+ for (size_t opt_idx = 0; (str = (char_u *)options[opt_idx].fullname) != NULL;
opt_idx++) {
if (options[opt_idx].var == NULL)
continue;
@@ -7326,7 +7325,7 @@ int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***
* Check terminal key codes, these are not in the option table
*/
if (xp->xp_context != EXPAND_BOOL_SETTINGS && num_normal == 0) {
- for (opt_idx = 0; (str = get_termcode(opt_idx)) != NULL; opt_idx++) {
+ for (size_t opt_idx = 0; (str = get_termcode(opt_idx)) != NULL; opt_idx++) {
if (!isprint(str[0]) || !isprint(str[1]))
continue;
@@ -7363,7 +7362,7 @@ int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***
* Check special key names.
*/
regmatch->rm_ic = TRUE; /* ignore case here */
- for (opt_idx = 0; (str = get_key_name(opt_idx)) != NULL; opt_idx++) {
+ for (size_t opt_idx = 0; (str = get_key_name(opt_idx)) != NULL; opt_idx++) {
name_buf[0] = '<';
STRCPY(name_buf + 1, str);
STRCAT(name_buf, ">");
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index cddc28fac9..c0d588f4ef 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -184,7 +184,7 @@ size_t input_enqueue(String keys)
while (rbuffer_available(input_buffer) >= 6 && ptr < end) {
uint8_t buf[6] = {0};
- int new_size = trans_special((uint8_t **)&ptr, buf, false);
+ unsigned int new_size = trans_special((uint8_t **)&ptr, buf, false);
if (!new_size) {
// copy the character unmodified
@@ -195,7 +195,7 @@ size_t input_enqueue(String keys)
new_size = handle_mouse_event(&ptr, buf, new_size);
// TODO(tarruda): Don't produce past unclosed '<' characters, except if
// there's a lot of characters after the '<'
- rbuffer_write(input_buffer, (char *)buf, (size_t)new_size);
+ rbuffer_write(input_buffer, (char *)buf, new_size);
}
size_t rv = (size_t)(ptr - keys.data);
@@ -205,7 +205,8 @@ size_t input_enqueue(String keys)
// Mouse event handling code(Extract row/col if available and detect multiple
// clicks)
-static int handle_mouse_event(char **ptr, uint8_t *buf, int bufsize)
+static unsigned int handle_mouse_event(char **ptr, uint8_t *buf,
+ unsigned int bufsize)
{
int mouse_code = 0;
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 5158e6cd86..d3946a9b63 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -3757,7 +3757,6 @@ current_quote (
/*
* Find next search match under cursor, cursor at end.
* Used while an operator is pending, and in Visual mode.
- * TODO: redo only works when used in operator pending mode
*/
int
current_search (
@@ -3792,7 +3791,7 @@ current_search (
orig_pos = pos = curwin->w_cursor;
/* Is the pattern is zero-width? */
- int one_char = is_one_char(spats[last_idx].pat);
+ int one_char = is_one_char(spats[last_idx].pat, true);
if (one_char == -1) {
p_ws = old_p_ws;
return FAIL; /* pattern not found */
@@ -3840,6 +3839,10 @@ current_search (
int flags = forward ? SEARCH_END : 0;
pos_T start_pos = pos;
+ /* Check again from the current cursor position,
+ * since the next match might actually be only one char wide */
+ one_char = is_one_char(spats[last_idx].pat, false);
+
/* move to match, except for zero-width matches, in which case, we are
* already on the next match */
if (!one_char)
@@ -3878,24 +3881,33 @@ current_search (
/*
* Check if the pattern is one character or zero-width.
+ * If move is true, check from the beginning of the buffer,
+ * else from the current cursor position.
* Returns TRUE, FALSE or -1 for failure.
*/
-static int is_one_char(char_u *pattern)
+static int is_one_char(char_u *pattern, bool move)
{
regmmatch_T regmatch;
int nmatched = 0;
int result = -1;
pos_T pos;
int save_called_emsg = called_emsg;
+ int flag = 0;
if (search_regcomp(pattern, RE_SEARCH, RE_SEARCH,
SEARCH_KEEP, &regmatch) == FAIL)
return -1;
/* move to match */
- clearpos(&pos);
+ if (move) {
+ clearpos(&pos);
+ } else {
+ pos = curwin->w_cursor;
+ /* accept a match at the cursor position */
+ flag = SEARCH_START;
+ }
if (searchit(curwin, curbuf, &pos, FORWARD, spats[last_idx].pat, 1,
- SEARCH_KEEP, RE_SEARCH, 0, NULL) != FAIL) {
+ SEARCH_KEEP + flag, RE_SEARCH, 0, NULL) != FAIL) {
/* Zero-width pattern should match somewhere, then we can check if
* start and end are in the same position. */
called_emsg = FALSE;
diff --git a/src/nvim/sha256.c b/src/nvim/sha256.c
index b11ee2293c..e5e29768af 100644
--- a/src/nvim/sha256.c
+++ b/src/nvim/sha256.c
@@ -12,12 +12,13 @@
/// 2. sha2_seed() generates a random header.
/// sha256_self_test() is implicitly called once.
-#include <inttypes.h>
-#include <string.h>
+#include <stddef.h> // for size_t
+#include <stdio.h> // for snprintf().
+#include <stdlib.h> // for rand_r().
-#include "nvim/os/time.h"
-#include "nvim/vim.h"
-#include "nvim/sha256.h"
+#include "nvim/os/time.h" // for os_hrtime().
+#include "nvim/sha256.h" // for context_sha256_T
+#include "nvim/vim.h" // for STRCPY()/STRLEN().
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "sha256.c.generated.h"
@@ -51,9 +52,10 @@ void sha256_start(context_sha256_T *ctx)
ctx->state[7] = 0x5BE0CD19;
}
-static void sha256_process(context_sha256_T *ctx, char_u data[64])
+static void sha256_process(context_sha256_T *ctx,
+ const char_u data[SHA256_BUFFER_SIZE])
{
- uint32_t temp1, temp2, W[64];
+ uint32_t temp1, temp2, W[SHA256_BUFFER_SIZE];
uint32_t A, B, C, D, E, F, G, H;
GET_UINT32(W[0], data, 0);
@@ -179,24 +181,23 @@ static void sha256_process(context_sha256_T *ctx, char_u data[64])
ctx->state[7] += H;
}
-void sha256_update(context_sha256_T *ctx, char_u *input, uint32_t length)
+void sha256_update(context_sha256_T *ctx, const char_u *input, size_t length)
{
- uint32_t left, fill;
-
if (length == 0) {
return;
}
- left = ctx->total[0] & 0x3F;
- fill = 64 - left;
+ uint32_t left = ctx->total[0] & (SHA256_BUFFER_SIZE-1); // left < buf size
- ctx->total[0] += length;
+ ctx->total[0] += (uint32_t) length;
ctx->total[0] &= 0xFFFFFFFF;
if (ctx->total[0] < length) {
ctx->total[1]++;
}
+ size_t fill = SHA256_BUFFER_SIZE - left;
+
if (left && (length >= fill)) {
memcpy((void *)(ctx->buffer + left), (void *)input, fill);
sha256_process(ctx, ctx->buffer);
@@ -205,10 +206,10 @@ void sha256_update(context_sha256_T *ctx, char_u *input, uint32_t length)
left = 0;
}
- while (length >= 64) {
+ while (length >= SHA256_BUFFER_SIZE) {
sha256_process(ctx, input);
- length -= 64;
- input += 64;
+ length -= SHA256_BUFFER_SIZE;
+ input += SHA256_BUFFER_SIZE;
}
if (length) {
@@ -216,14 +217,14 @@ void sha256_update(context_sha256_T *ctx, char_u *input, uint32_t length)
}
}
-static char_u sha256_padding[64] = {
+static char_u sha256_padding[SHA256_BUFFER_SIZE] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-void sha256_finish(context_sha256_T *ctx, char_u digest[32])
+void sha256_finish(context_sha256_T *ctx, char_u digest[SHA256_SUM_SIZE])
{
uint32_t last, padn;
uint32_t high, low;
@@ -251,6 +252,7 @@ void sha256_finish(context_sha256_T *ctx, char_u digest[32])
PUT_UINT32(ctx->state[7], digest, 28);
}
+#define SHA_STEP 2
/// Gets the hex digest of the buffer.
///
@@ -261,25 +263,25 @@ void sha256_finish(context_sha256_T *ctx, char_u digest[32])
///
/// @returns hex digest of "buf[buf_len]" in a static array.
/// if "salt" is not NULL also do "salt[salt_len]".
-char_u *sha256_bytes(char_u *buf, int buf_len, char_u *salt, int salt_len)
+char_u *sha256_bytes(const char_u *restrict buf, size_t buf_len,
+ const char_u *restrict salt, size_t salt_len)
{
- char_u sha256sum[32];
- static char_u hexit[65];
- int j;
+ char_u sha256sum[SHA256_SUM_SIZE];
+ static char_u hexit[SHA256_BUFFER_SIZE + 1]; // buf size + NULL
context_sha256_T ctx;
sha256_self_test();
sha256_start(&ctx);
- sha256_update(&ctx, buf, buf_len);
+ sha256_update(&ctx, buf, buf_len);
if (salt != NULL) {
sha256_update(&ctx, salt, salt_len);
}
sha256_finish(&ctx, sha256sum);
- for (j = 0; j < 32; j++) {
- sprintf((char *) hexit + j * 2, "%02x", sha256sum[j]);
+ for (size_t j = 0; j < SHA256_SUM_SIZE; j++) {
+ snprintf((char *) hexit + j * SHA_STEP, SHA_STEP+1, "%02x", sha256sum[j]);
}
hexit[sizeof(hexit) - 1] = '\0';
return hexit;
@@ -303,51 +305,51 @@ static char *sha_self_test_vector[] = {
/// Perform a test on the SHA256 algorithm.
///
-/// @return FAIL or OK.
-int sha256_self_test(void)
+/// @returns true if not failures generated.
+bool sha256_self_test(void)
{
- int i, j;
- char output[65];
+ char output[SHA256_BUFFER_SIZE + 1]; // buf size + NULL
context_sha256_T ctx;
char_u buf[1000];
- char_u sha256sum[32];
- static int failures = 0;
+ char_u sha256sum[SHA256_SUM_SIZE];
char_u *hexit;
- static int sha256_self_tested = 0;
- if (sha256_self_tested > 0) {
- return failures > 0 ? FAIL : OK;
+ static bool sha256_self_tested = false;
+ static bool failures = false;
+
+ if (sha256_self_tested) {
+ return failures == false;
}
- sha256_self_tested = 1;
+ sha256_self_tested = true;
- for (i = 0; i < 3; i++) {
+ for (size_t i = 0; i < 3; i++) {
if (i < 2) {
hexit = sha256_bytes((char_u *) sha_self_test_msg[i],
- (int) STRLEN(sha_self_test_msg[i]),
+ STRLEN(sha_self_test_msg[i]),
NULL, 0);
STRCPY(output, hexit);
} else {
sha256_start(&ctx);
memset(buf, 'a', 1000);
- for (j = 0; j < 1000; j++) {
+ for (size_t j = 0; j < 1000; j++) {
sha256_update(&ctx, (char_u *) buf, 1000);
}
sha256_finish(&ctx, sha256sum);
- for (j = 0; j < 32; j++) {
- sprintf(output + j * 2, "%02x", sha256sum[j]);
+ for (size_t j = 0; j < SHA256_SUM_SIZE; j++) {
+ snprintf(output + j * SHA_STEP, SHA_STEP+1, "%02x", sha256sum[j]);
}
}
- if (memcmp(output, sha_self_test_vector[i], 64)) {
- failures++;
+ if (memcmp(output, sha_self_test_vector[i], SHA256_BUFFER_SIZE)) {
+ failures = true;
output[sizeof(output) - 1] = '\0';
// printf("sha256_self_test %d failed %s\n", i, output);
}
}
- return failures > 0 ? FAIL : OK;
+ return failures == false;
}
/// Fill "header[header_len]" with random_data.
@@ -357,20 +359,21 @@ int sha256_self_test(void)
/// @param header_len
/// @param salt
/// @param salt_len
-void sha2_seed(char_u *header, int header_len, char_u *salt, int salt_len)
+void sha2_seed(char_u *restrict header, size_t header_len,
+ char_u *restrict salt, size_t salt_len)
{
static char_u random_data[1000];
- char_u sha256sum[32];
+ char_u sha256sum[SHA256_SUM_SIZE];
context_sha256_T ctx;
- srand((unsigned int) os_hrtime());
+ unsigned int seed = (unsigned int) os_hrtime();
- int i;
- for (i = 0; i < (int) sizeof(random_data) - 1; i++) {
- random_data[i] = (char_u) ((os_hrtime() ^ rand()) & 0xff);
+ size_t i;
+ for (i = 0; i < sizeof(random_data) - 1; i++) {
+ random_data[i] = (char_u) ((os_hrtime() ^ (uint64_t)rand_r(&seed)) & 0xff);
}
sha256_start(&ctx);
- sha256_update(&ctx, (char_u *) random_data, sizeof(random_data));
+ sha256_update(&ctx, random_data, sizeof(random_data));
sha256_finish(&ctx, sha256sum);
// put first block into header.
diff --git a/src/nvim/sha256.h b/src/nvim/sha256.h
index c8ffa94cc4..a118826542 100644
--- a/src/nvim/sha256.h
+++ b/src/nvim/sha256.h
@@ -1,10 +1,17 @@
#ifndef NVIM_SHA256_H
#define NVIM_SHA256_H
+#include <stdint.h> // for uint32_t
+
+#include "nvim/types.h" // for char_u
+
+#define SHA256_BUFFER_SIZE 64
+#define SHA256_SUM_SIZE 32
+
typedef struct {
uint32_t total[2];
uint32_t state[8];
- char_u buffer[64];
+ char_u buffer[SHA256_BUFFER_SIZE];
} context_sha256_T;
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 6787ca8080..f35da39bb3 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -6593,7 +6593,7 @@ do_highlight (
* Copy characters from arg[] to buf[], translating <> codes.
*/
for (p = arg, off = 0; off < 100 - 6 && *p; ) {
- len = trans_special(&p, buf + off, FALSE);
+ len = (int)trans_special(&p, buf + off, FALSE);
if (len > 0) /* recognized special char */
off += len;
else /* copy as normal char */
diff --git a/src/nvim/term.c b/src/nvim/term.c
index ceec140670..dfc42632c6 100644
--- a/src/nvim/term.c
+++ b/src/nvim/term.c
@@ -22,6 +22,7 @@
*/
#define tgetstr tgetstr_defined_wrong
+#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <stdbool.h>
@@ -1065,8 +1066,8 @@ static void parse_builtin_tcap(char_u *term)
term_strings[p->bt_entry] = (char_u *)p->bt_string;
}
} else {
- name[0] = KEY2TERMCAP0((int)p->bt_entry);
- name[1] = KEY2TERMCAP1((int)p->bt_entry);
+ name[0] = (char_u)KEY2TERMCAP0(p->bt_entry);
+ name[1] = (char_u)KEY2TERMCAP1(p->bt_entry);
if (find_termcode(name) == NULL)
add_termcode(name, (char_u *)p->bt_string, term_8bit);
}
@@ -1255,7 +1256,7 @@ int set_termname(char_u *term)
UP = (char *)TGETSTR("up", &tp);
p = TGETSTR("pc", &tp);
if (p)
- PC = *p;
+ PC = (char)*p;
}
} else /* try == 0 || try == 2 */
#endif /* HAVE_TGETENT */
@@ -1478,7 +1479,7 @@ int set_termname(char_u *term)
void
set_mouse_termcode (
- int n, /* KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE */
+ char_u n, /* KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE */
char_u *s
)
{
@@ -1490,7 +1491,7 @@ set_mouse_termcode (
# if (defined(UNIX) && defined(FEAT_MOUSE_TTY)) || defined(PROTO)
void
del_mouse_termcode (
- int n /* KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE */
+ char_u n /* KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE */
)
{
char_u name[2] = { n, KE_FILLER };
@@ -1690,7 +1691,7 @@ bool term_is_8bit(char_u *name)
* <Esc>] -> <M-C-]>
* <Esc>O -> <M-C-O>
*/
-static int term_7to8bit(char_u *p)
+static char_u term_7to8bit(char_u *p)
{
if (*p == ESC) {
if (p[1] == '[')
@@ -1801,7 +1802,9 @@ void term_write(char_u *s, size_t len)
#ifdef UNIX
if (p_wd) { // Unix is too fast, slow down a bit more
- os_microdelay(p_wd);
+ assert(p_wd >= 0
+ && (sizeof(long) <= sizeof(uint64_t) || p_wd <= UINT64_MAX));
+ os_microdelay((uint64_t)p_wd);
}
#endif
}
@@ -1843,7 +1846,7 @@ void out_flush_check(void)
* This should not be used for outputting text on the screen (use functions
* like msg_puts() and screen_putchar() for that).
*/
-void out_char(unsigned c)
+void out_char(char_u c)
{
#if defined(UNIX) || defined(MACOS_X_UNIX)
if (c == '\n') /* turn LF into CR-LF (CRMOD doesn't seem to do this) */
@@ -1861,7 +1864,7 @@ void out_char(unsigned c)
/*
* out_char_nf(c): like out_char(), but don't flush when p_wd is set
*/
-static void out_char_nf(unsigned c)
+static void out_char_nf(char_u c)
{
#if defined(UNIX) || defined(MACOS_X_UNIX)
if (c == '\n') /* turn LF into CR-LF (CRMOD doesn't seem to do this) */
@@ -2112,31 +2115,6 @@ void ttest(int pairs)
t_colors = atoi((char *)T_CCO);
}
-#if defined(FEAT_GUI) || defined(PROTO)
-/*
- * Interpret the next string of bytes in buf as a long integer, with the most
- * significant byte first. Note that it is assumed that buf has been through
- * inchar(), so that NUL and K_SPECIAL will be represented as three bytes each.
- * Puts result in val, and returns the number of bytes read from buf
- * (between sizeof(long_u) and 2 * sizeof(long_u)), or -1 if not enough bytes
- * were present.
- */
-static int get_long_from_buf(char_u *buf, long_u *val)
-{
- char_u bytes[sizeof(long_u)];
-
- *val = 0;
- int len = get_bytes_from_buf(buf, bytes, (int)sizeof(long_u));
- if (len != -1) {
- for (int i = 0; i < (int)sizeof(long_u); i++) {
- int shift = 8 * (sizeof(long_u) - 1 - i);
- *val += (long_u)bytes[i] << shift;
- }
- }
- return len;
-}
-#endif
-
#if defined(FEAT_GUI) \
|| (defined(FEAT_MOUSE) && (!defined(UNIX) || defined(FEAT_MOUSE_XTERM) \
|| defined(FEAT_MOUSE_GPM) || defined(FEAT_SYSMOUSE)))
@@ -2203,8 +2181,8 @@ void limit_screen_size(void)
*/
void win_new_shellsize(void)
{
- static int old_Rows = 0;
- static int old_Columns = 0;
+ static long old_Rows = 0;
+ static long old_Columns = 0;
if (old_Rows != Rows) {
/* if 'window' uses the whole screen, keep it using that */
@@ -2234,11 +2212,10 @@ void shell_resized(void)
*/
void shell_resized_check(void)
{
- int old_Rows = Rows;
- int old_Columns = Columns;
+ long old_Rows = Rows;
+ long old_Columns = Columns;
- if (!exiting
- ) {
+ if (!exiting) {
(void)ui_get_shellsize();
check_shellsize();
if (old_Rows != Rows || old_Columns != Columns)
@@ -2588,13 +2565,13 @@ static struct termcode {
int modlen; /* length of part before ";*~". */
} *termcodes = NULL;
-static int tc_max_len = 0; /* number of entries that termcodes[] can hold */
-static int tc_len = 0; /* current number of entries in termcodes[] */
+static size_t tc_max_len = 0; /* number of entries that termcodes[] can hold */
+static size_t tc_len = 0; /* current number of entries in termcodes[] */
void clear_termcodes(void)
{
- while (tc_len > 0)
+ while (tc_len != 0)
free(termcodes[--tc_len].code);
free(termcodes);
termcodes = NULL;
@@ -2621,7 +2598,7 @@ void clear_termcodes(void)
void add_termcode(char_u *name, char_u *string, int flags)
{
struct termcode *new_tc;
- int i, j;
+ size_t i, j;
if (string == NULL || *string == NUL) {
del_termcode(name);
@@ -2635,7 +2612,7 @@ void add_termcode(char_u *name, char_u *string, int flags)
STRMOVE(s, s + 1);
s[0] = term_7to8bit(string);
}
- int len = (int)STRLEN(s);
+ size_t len = STRLEN(s);
need_gather = true; // need to fill termleader[]
@@ -2666,15 +2643,14 @@ void add_termcode(char_u *name, char_u *string, int flags)
* Exact match: May replace old code.
*/
if (termcodes[i].name[1] == name[1]) {
- if (flags == ATC_FROM_TERM && (j = termcode_star(
- termcodes[i].code,
- termcodes[i].len)) > 0) {
+ if (flags == ATC_FROM_TERM
+ && (j = termcode_star(termcodes[i].code, termcodes[i].len)) > 0) {
/* Don't replace ESC[123;*X or ESC O*X with another when
* invoked from got_code_from_term(). */
- if (len == termcodes[i].len - j
+ assert(termcodes[i].len >= 0);
+ if (len == (size_t)termcodes[i].len - j
&& STRNCMP(s, termcodes[i].code, len - 1) == 0
- && s[len - 1]
- == termcodes[i].code[termcodes[i].len - 1]) {
+ && s[len - 1] == termcodes[i].code[termcodes[i].len - 1]) {
/* They are equal but for the ";*": don't add it. */
free(s);
return;
@@ -2698,14 +2674,15 @@ void add_termcode(char_u *name, char_u *string, int flags)
termcodes[i].name[0] = name[0];
termcodes[i].name[1] = name[1];
termcodes[i].code = s;
- termcodes[i].len = len;
+ assert(len <= INT_MAX);
+ termcodes[i].len = (int)len;
/* For xterm we recognize special codes like "ESC[42;*X" and "ESC O*X" that
* accept modifiers. */
termcodes[i].modlen = 0;
- j = termcode_star(s, len);
+ j = termcode_star(s, (int)len);
if (j > 0)
- termcodes[i].modlen = len - 1 - j;
+ termcodes[i].modlen = (int)(len - 1 - j);
++tc_len;
}
@@ -2714,7 +2691,7 @@ void add_termcode(char_u *name, char_u *string, int flags)
* The "X" can be any character.
* Return 0 if not found, 2 for ;*X and 1 for O*X and <M-O>*X.
*/
-static int termcode_star(char_u *code, int len)
+static unsigned int termcode_star(char_u *code, int len)
{
/* Shortest is <M-O>*X. With ; shortest is <CSI>1;*X */
if (len >= 3 && code[len - 2] == '*') {
@@ -2728,13 +2705,13 @@ static int termcode_star(char_u *code, int len)
char_u *find_termcode(char_u *name)
{
- for (int i = 0; i < tc_len; ++i)
+ for (size_t i = 0; i < tc_len; ++i)
if (termcodes[i].name[0] == name[0] && termcodes[i].name[1] == name[1])
return termcodes[i].code;
return NULL;
}
-char_u *get_termcode(int i)
+char_u *get_termcode(size_t i)
{
if (i >= tc_len)
return NULL;
@@ -2748,7 +2725,7 @@ void del_termcode(char_u *name)
need_gather = true; // need to fill termleader[]
- for (int i = 0; i < tc_len; ++i)
+ for (size_t i = 0; i < tc_len; ++i)
if (termcodes[i].name[0] == name[0] && termcodes[i].name[1] == name[1]) {
del_termcode_idx(i);
return;
@@ -2756,11 +2733,11 @@ void del_termcode(char_u *name)
/* not found. Give error message? */
}
-static void del_termcode_idx(int idx)
+static void del_termcode_idx(size_t idx)
{
free(termcodes[idx].code);
--tc_len;
- for (int i = idx; i < tc_len; ++i)
+ for (size_t i = idx; i < tc_len; ++i)
termcodes[i] = termcodes[i + 1];
}
@@ -2772,8 +2749,8 @@ static void switch_to_8bit(void)
{
/* Only need to do something when not already using 8-bit codes. */
if (!term_is_8bit(T_NAME)) {
- for (int i = 0; i < tc_len; ++i) {
- int c = term_7to8bit(termcodes[i].code);
+ for (size_t i = 0; i < tc_len; ++i) {
+ char_u c = term_7to8bit(termcodes[i].code);
if (c != 0) {
STRMOVE(termcodes[i].code + 1, termcodes[i].code + 2);
termcodes[i].code[0] = c;
@@ -2837,19 +2814,18 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
int extra;
char_u string[MAX_KEY_CODE_LEN + 1];
int i, j;
- int idx = 0;
# if !defined(UNIX) || defined(FEAT_MOUSE_XTERM) || defined(FEAT_GUI) \
|| defined(FEAT_MOUSE_GPM) || defined(FEAT_SYSMOUSE)
char_u bytes[6];
int num_bytes;
# endif
- int mouse_code = 0; /* init for GCC */
+ long mouse_code = 0; /* init for GCC */
int is_click, is_drag;
- int wheel_code = 0;
- int current_button;
- static int held_button = MOUSE_RELEASE;
+ long wheel_code = 0;
+ long current_button;
+ static long held_button = MOUSE_RELEASE;
static int orig_num_clicks = 1;
- static int orig_mouse_code = 0x0;
+ static long orig_mouse_code = 0x0;
int cpo_koffset;
cpo_koffset = (vim_strchr(p_cpo, CPO_KOFFSET) != NULL);
@@ -2912,6 +2888,7 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
key_name[1] = NUL; /* no key name found yet */
modifiers = 0; /* no modifiers yet */
+ size_t idx;
{
for (idx = 0; idx < tc_len; ++idx) {
/*
@@ -2936,10 +2913,10 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
*/
if (termcodes[idx].name[0] == 'K'
&& VIM_ISDIGIT(termcodes[idx].name[1])) {
- for (j = idx + 1; j < tc_len; ++j)
- if (termcodes[j].len == slen &&
- STRNCMP(termcodes[idx].code,
- termcodes[j].code, slen) == 0) {
+ for (size_t j = idx + 1; j < tc_len; ++j)
+ if (termcodes[j].len == slen
+ && STRNCMP(termcodes[idx].code,
+ termcodes[j].code, slen) == 0) {
idx = j;
break;
}
@@ -3261,11 +3238,15 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
if (key_name[0] == KS_SGR_MOUSE)
mouse_code += 32;
- mouse_col = getdigits(&p) - 1;
+ long digits = getdigits(&p);
+ assert(digits >= INT_MIN && digits <= INT_MAX);
+ mouse_col = (int)digits - 1;
if (*p++ != ';')
return -1;
- mouse_row = getdigits(&p) - 1;
+ digits = getdigits(&p);
+ assert(digits >= INT_MIN && digits <= INT_MAX);
+ mouse_row = (int)digits - 1;
if (key_name[0] == KS_SGR_MOUSE && *p == 'm')
mouse_code |= MOUSE_RELEASE;
else if (*p != 'M')
@@ -3331,7 +3312,7 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
}
# endif /* !UNIX || FEAT_MOUSE_XTERM */
if (key_name[0] == (int)KS_NETTERM_MOUSE) {
- int mc, mr;
+ long mc, mr;
/* expect a rather limited sequence like: balancing {
* \033}6,45\r
@@ -3345,8 +3326,10 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
if (*p++ != '\r')
return -1;
- mouse_col = mc - 1;
- mouse_row = mr - 1;
+ assert(mc - 1 >= INT_MIN && mc - 1 <= INT_MAX);
+ mouse_col = (int)(mc - 1);
+ assert(mr - 1 >= INT_MIN && mr - 1 <= INT_MAX);
+ mouse_row = (int)(mr - 1);
mouse_code = MOUSE_LEFT;
slen += (int)(p - (tp + slen));
}
@@ -3401,7 +3384,7 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
* The page coordinate may be omitted if the locator is on
* page one (the default). We ignore it anyway.
*/
- int Pe, Pb, Pr, Pc;
+ long Pe, Pb, Pr, Pc;
p = tp + slen;
@@ -3448,23 +3431,19 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
if (Pb) {
held_button = mouse_code;
mouse_code |= MOUSE_DRAG;
- WantQueryMouse = TRUE;
}
is_drag = TRUE;
showmode();
break;
case 2: mouse_code = MOUSE_LEFT;
- WantQueryMouse = TRUE;
break;
case 3: mouse_code = MOUSE_RELEASE | MOUSE_LEFT;
break;
case 4: mouse_code = MOUSE_MIDDLE;
- WantQueryMouse = TRUE;
break;
case 5: mouse_code = MOUSE_RELEASE | MOUSE_MIDDLE;
break;
case 6: mouse_code = MOUSE_RIGHT;
- WantQueryMouse = TRUE;
break;
case 7: mouse_code = MOUSE_RELEASE | MOUSE_RIGHT;
break;
@@ -3474,8 +3453,10 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
default: return -1; /* should never occur */
}
- mouse_col = Pc - 1;
- mouse_row = Pr - 1;
+ assert(Pc - 1 >= INT_MIN && Pc - 1 <= INT_MAX);
+ mouse_col = (int)(Pc - 1);
+ assert(Pr - 1 >= INT_MIN && Pr - 1 <= INT_MAX);
+ mouse_row = (int)(Pr - 1);
slen += (int)(p - (tp + slen));
}
@@ -3506,7 +3487,7 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
// compute the time elapsed since the previous mouse click and
// convert it from ns to ms because p_mouset is stored as ms
- long timediff = (long) (mouse_time - orig_mouse_time) / 1E6;
+ long timediff = (long) (mouse_time - orig_mouse_time) / 1000000;
orig_mouse_time = mouse_time;
if (mouse_code == orig_mouse_code
@@ -3562,9 +3543,11 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
modifiers |= MOD_MASK_ALT;
key_name[1] = (wheel_code & 1)
? (int)KE_MOUSEUP : (int)KE_MOUSEDOWN;
- } else
- key_name[1] = get_pseudo_mouse_code(current_button,
- is_click, is_drag);
+ } else {
+ assert(current_button >= INT_MIN && current_button <= INT_MAX);
+ key_name[1] = (char_u)get_pseudo_mouse_code((int)current_button,
+ is_click, is_drag);
+ }
}
@@ -3584,13 +3567,13 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
if (modifiers != 0) {
string[new_slen++] = K_SPECIAL;
string[new_slen++] = (int)KS_MODIFIER;
- string[new_slen++] = modifiers;
+ string[new_slen++] = (char_u)modifiers;
}
}
/* Finally, add the special key code to our string */
- key_name[0] = KEY2TERMCAP0(key);
- key_name[1] = KEY2TERMCAP1(key);
+ key_name[0] = (char_u)KEY2TERMCAP0(key);
+ key_name[1] = (char_u)KEY2TERMCAP1(key);
if (key_name[0] == KS_KEY) {
/* from ":set <M-b>=xx" */
if (has_mbyte)
@@ -3674,10 +3657,10 @@ replace_termcodes (
int special /* always accept <key> notation */
)
{
- int i;
- int slen;
- int key;
- int dlen = 0;
+ ssize_t i;
+ size_t slen;
+ char_u key;
+ size_t dlen = 0;
char_u *src;
int do_backslash; /* backslash is a special character */
int do_special; /* recognize <> key codes */
@@ -3731,7 +3714,7 @@ replace_termcodes (
result[dlen++] = (int)KS_EXTRA;
result[dlen++] = (int)KE_SNR;
sprintf((char *)result + dlen, "%" PRId64, (int64_t)current_SID);
- dlen += (int)STRLEN(result + dlen);
+ dlen += STRLEN(result + dlen);
result[dlen++] = '_';
continue;
}
@@ -3836,14 +3819,17 @@ replace_termcodes (
* Find a termcode with keys 'src' (must be NUL terminated).
* Return the index in termcodes[], or -1 if not found.
*/
-int find_term_bykeys(char_u *src)
+ssize_t find_term_bykeys(char_u *src)
{
- int slen = (int)STRLEN(src);
-
- for (int i = 0; i < tc_len; ++i) {
- if (slen == termcodes[i].len
- && STRNCMP(termcodes[i].code, src, (size_t)slen) == 0)
- return i;
+ size_t slen = STRLEN(src);
+
+ for (size_t i = 0; i < tc_len; ++i) {
+ assert(termcodes[i].len >= 0);
+ if (slen == (size_t)termcodes[i].len
+ && STRNCMP(termcodes[i].code, src, slen) == 0) {
+ assert(i <= SSIZE_MAX);
+ return (ssize_t)i;
+ }
}
return -1;
}
@@ -3865,7 +3851,7 @@ static void gather_termleader(void)
in 8-bit mode */
termleader[len] = NUL;
- for (int i = 0; i < tc_len; ++i)
+ for (size_t i = 0; i < tc_len; ++i)
if (vim_strchr(termleader, termcodes[i].code[0]) == NULL) {
termleader[len++] = termcodes[i].code[0];
termleader[len] = NUL;
@@ -3880,22 +3866,14 @@ static void gather_termleader(void)
*/
void show_termcodes(void)
{
- int col;
- int *items;
- int item_count;
- int run;
- int row, rows;
- int cols;
- int i;
- int len;
-
#define INC3 27 /* try to make three columns */
#define INC2 40 /* try to make two columns */
#define GAP 2 /* spaces between columns */
if (tc_len == 0) /* no terminal codes (must be GUI) */
return;
- items = xmalloc(sizeof(int) * tc_len);
+
+ size_t *items = xmalloc(sizeof(size_t) * tc_len);
/* Highlight title */
MSG_PUTS_TITLE(_("\n--- Terminal keys ---"));
@@ -3906,14 +3884,14 @@ void show_termcodes(void)
* 2. display the medium items (medium length strings)
* 3. display the long items (remaining strings)
*/
- for (run = 1; run <= 3 && !got_int; ++run) {
+ for (int run = 1; run <= 3 && !got_int; ++run) {
/*
* collect the items in items[]
*/
- item_count = 0;
- for (i = 0; i < tc_len; i++) {
- len = show_one_termcode(termcodes[i].name,
- termcodes[i].code, FALSE);
+ size_t item_count = 0;
+ for (size_t i = 0; i < tc_len; i++) {
+ int len = show_one_termcode(termcodes[i].name,
+ termcodes[i].code, FALSE);
if (len <= INC3 - GAP ? run == 1
: len <= INC2 - GAP ? run == 2
: run == 3)
@@ -3923,22 +3901,24 @@ void show_termcodes(void)
/*
* display the items
*/
+ size_t rows, cols;
if (run <= 2) {
- cols = (Columns + GAP) / (run == 1 ? INC3 : INC2);
+ cols = (size_t)(Columns + GAP) / (run == 1 ? INC3 : INC2);
if (cols == 0)
cols = 1;
rows = (item_count + cols - 1) / cols;
} else /* run == 3 */
rows = item_count;
- for (row = 0; row < rows && !got_int; ++row) {
+ for (size_t row = 0; row < rows && !got_int; ++row) {
msg_putchar('\n'); /* go to next line */
if (got_int) /* 'q' typed in more */
break;
- col = 0;
- for (i = row; i < item_count; i += rows) {
- msg_col = col; /* make columns */
+ size_t col = 0;
+ for (size_t i = row; i < item_count; i += rows) {
+ assert(col <= INT_MAX);
+ msg_col = (int)col; /* make columns */
show_one_termcode(termcodes[items[i]].name,
- termcodes[items[i]].code, TRUE);
+ termcodes[items[i]].code, TRUE);
if (run == 2)
col += INC2;
else
@@ -4051,7 +4031,7 @@ static void got_code_from_term(char_u *code, int len)
#define XT_LEN 100
char_u name[3];
char_u str[XT_LEN];
- int i;
+ ssize_t i;
int j = 0;
int c;
@@ -4060,12 +4040,17 @@ static void got_code_from_term(char_u *code, int len)
* Our names are currently all 2 characters. */
if (code[0] == '1' && code[7] == '=' && len / 2 < XT_LEN) {
/* Get the name from the response and find it in the table. */
- name[0] = hexhex2nr(code + 3);
- name[1] = hexhex2nr(code + 5);
+ int byte = hexhex2nr(code + 3);
+ assert(byte != -1);
+ name[0] = (char_u)byte;
+ byte = hexhex2nr(code + 5);
+ assert(byte != -1);
+ name[1] = (char_u)byte;
name[2] = NUL;
for (i = 0; key_names[i] != NULL; ++i) {
if (STRCMP(key_names[i], name) == 0) {
- xt_index_in = i;
+ assert(i <= INT_MAX);
+ xt_index_in = (int)i;
break;
}
}
@@ -4079,7 +4064,7 @@ static void got_code_from_term(char_u *code, int len)
# endif
if (key_names[i] != NULL) {
for (i = 8; (c = hexhex2nr(code + i)) >= 0; i += 2)
- str[j++] = c;
+ str[j++] = (char_u)c;
str[j] = NUL;
if (name[0] == 'C' && name[1] == 'o') {
/* Color count is not a key code. */
@@ -4108,7 +4093,7 @@ static void got_code_from_term(char_u *code, int len)
/* First delete any existing entry with the same code. */
i = find_term_bykeys(str);
if (i >= 0)
- del_termcode_idx(i);
+ del_termcode_idx((size_t)i);
add_termcode(name, str, ATC_FROM_TERM);
}
}
@@ -4196,7 +4181,7 @@ translate_mapping (
}
if (cpo_special && cpo_keycode && c == K_SPECIAL && !modifiers) {
/* try to find special key in termcodes */
- int i;
+ size_t i;
for (i = 0; i < tc_len; ++i)
if (termcodes[i].name[0] == str[1]
&& termcodes[i].name[1] == str[2])
@@ -4230,7 +4215,7 @@ translate_mapping (
|| (c == '<' && !cpo_special) || (c == '\\' && !cpo_bslash))
ga_append(&ga, cpo_bslash ? Ctrl_V : '\\');
if (c)
- ga_append(&ga, c);
+ ga_append(&ga, (char)c);
}
ga_append(&ga, NUL);
return (char_u *)(ga.ga_data);
diff --git a/src/nvim/testdir/test39.in b/src/nvim/testdir/test39.in
index 7d1c672522..18da1b245a 100644
--- a/src/nvim/testdir/test39.in
+++ b/src/nvim/testdir/test39.in
@@ -38,11 +38,14 @@ G$khhhhhkkcmno
/^C23$/
:exe ":norm! l\<C-V>j$hhAab\<Esc>"
:.,/^$/w >> test.out
-:" Test for Visual block insert when virtualedit=all
-:set ve=all
+:" Test for Visual block insert when virtualedit=all and utf-8 encoding
+:set ve=all enc=utf-8
:/\t\tline
:exe ":norm! 07l\<C-V>jjIx\<Esc>"
-:set ve=
+:.,/^$/w >> test.out
+:" Test for Visual block append when virtualedit=all
+:exe ":norm! 012l\<C-v>jjAx\<Esc>"
+:set ve= enc=latin1
:.,/^$/w >> test.out
:" gUe must uppercase a whole word, also when changes to SS
Gothe youtueuu endYpk0wgUe
diff --git a/src/nvim/testdir/test39.ok b/src/nvim/testdir/test39.ok
index d8e901563a..5c517e2223 100644
--- a/src/nvim/testdir/test39.ok
+++ b/src/nvim/testdir/test39.ok
Binary files differ
diff --git a/src/nvim/testdir/test53.in b/src/nvim/testdir/test53.in
index 011c9ae39d..8ca9c9ed29 100644
--- a/src/nvim/testdir/test53.in
+++ b/src/nvim/testdir/test53.in
@@ -79,6 +79,8 @@ ggdgn.
:" test repeating gUgn
/^Depp
gggUgn.
+gg/a:0\@!\zs\d\+
+nygnop
:/^start:/,/^end:/wq! test.out
ENDTEST
@@ -108,6 +110,11 @@ delete first and last chars
uniquepattern uniquepattern
my very excellent mother just served us nachos
for (i=0; i<=10; i++)
+a:10
+
+a:1
+
+a:20
Y
text
Y
diff --git a/src/nvim/testdir/test53.ok b/src/nvim/testdir/test53.ok
index d7ffa6bc51..0c0b9ded16 100644
--- a/src/nvim/testdir/test53.ok
+++ b/src/nvim/testdir/test53.ok
@@ -49,6 +49,12 @@ elete first and last char
uniquepattern
my very excellent mongoose just served us nachos
for (j=0; i<=10; i++)
+a:10
+
+a:1
+1
+
+a:20
text
Y
diff --git a/src/nvim/version.c b/src/nvim/version.c
index c1fe19bb9c..9b87cbe99a 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -179,7 +179,7 @@ static char *(features[]) = {
static int included_patches[] = {
//560 NA
- //559,
+ 559,
//558 NA
//557 NA
//556 NA
@@ -187,7 +187,7 @@ static int included_patches[] = {
//554,
//553,
552,
- //551,
+ 551,
//550,
549,
//548 NA
diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt
index 5abfa23da4..debad7bf85 100644
--- a/third-party/CMakeLists.txt
+++ b/third-party/CMakeLists.txt
@@ -65,17 +65,17 @@ set(LUAROCKS_URL https://github.com/keplerproject/luarocks/archive/0587afbb5fe8c
set(LUAROCKS_SHA1 61a894fd5d61987bf7e7f9c3e0c5de16ba4b68c4)
set(LUAROCKS_MD5 0f53f42909fbcd2c88be303e8f970516)
-set(LIBUNIBILIUM_URL https://github.com/neovim/unibilium/archive/neovim.tar.gz)
-set(LIBUNIBILIUM_SHA1 ab22e465150458a4ea91b72de997a35f25df1bcf)
-set(LIBUNIBILIUM_MD5 b0749651429aa4c619baf44eedcd15c6)
+set(LIBUNIBILIUM_URL https://github.com/mauke/unibilium/archive/520abbc8b26910e2580619f669b5cc2c4ef7f864.tar.gz)
+set(LIBUNIBILIUM_SHA1 c546e5e8861380f5c109a256f25c93419e4076bf)
+set(LIBUNIBILIUM_MD5 d80d1fc45b22b1e92bebd5bf76e8a98b)
-set(LIBTERMKEY_URL https://github.com/neovim/libtermkey/archive/neovim.tar.gz)
-set(LIBTERMKEY_SHA1 a309038a2297fe4905f03a8807723a9aa07c272a)
-set(LIBTERMKEY_MD5 c99e5546da0063fa26dfa7d7f1d5a26f)
+set(LIBTERMKEY_URL https://github.com/neovim/libtermkey/archive/7b3bdafdf589d08478f2493273d4d75636ecc183.tar.gz)
+set(LIBTERMKEY_SHA1 28bfe54dfd9269910a132b51dee7725a2121578d)
+set(LIBTERMKEY_MD5 f0bac9c2467cc80c821be937ea5c13bc)
-set(LIBTICKIT_URL https://github.com/neovim/libtickit/archive/neovim.tar.gz)
-set(LIBTICKIT_SHA1 08a2aa9ab4bacbeeafefac430691089d829fdb13)
-set(LIBTICKIT_MD5 d2d45eb4f2968b068aa5cc310b7f9abd)
+set(LIBTICKIT_URL https://github.com/neovim/libtickit/archive/0430ba2f43fdf1c31bca66def52a2537c581ade5.tar.gz)
+set(LIBTICKIT_SHA1 732b145a4dab06e6f1b40a352424f808730726bf)
+set(LIBTICKIT_MD5 3fcb635e572851472fc5009709d980fe)
if(USE_BUNDLED_LIBUNIBILIUM)
ExternalProject_Add(libunibilium