aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md6
-rw-r--r--runtime/doc/map.txt10
-rw-r--r--runtime/doc/todo.txt83
-rw-r--r--runtime/filetype.vim8
-rw-r--r--runtime/optwin.vim4
-rw-r--r--runtime/syntax/j.vim42
-rw-r--r--runtime/syntax/rst.vim13
-rw-r--r--src/.clang-format12
-rw-r--r--src/nvim/api/buffer.c4
-rw-r--r--src/nvim/api/tabpage.c8
-rw-r--r--src/nvim/api/vim.c40
-rw-r--r--src/nvim/api/window.c4
-rw-r--r--src/nvim/charset.c16
-rw-r--r--src/nvim/edit.c41
-rw-r--r--src/nvim/eval.c19
-rw-r--r--src/nvim/ex_cmds.c4
-rw-r--r--src/nvim/ex_docmd.c2
-rw-r--r--src/nvim/ex_getln.c59
-rw-r--r--src/nvim/fileio.c93
-rw-r--r--src/nvim/if_cscope.c25
-rw-r--r--src/nvim/indent_c.c2
-rw-r--r--src/nvim/mark.c22
-rw-r--r--src/nvim/memline.c11
-rw-r--r--src/nvim/message.c3
-rw-r--r--src/nvim/misc1.c2
-rw-r--r--src/nvim/ops.c43
-rw-r--r--src/nvim/path.c26
-rw-r--r--src/nvim/po/ru.cp1251.po65
-rw-r--r--src/nvim/po/ru.po63
-rw-r--r--src/nvim/popupmnu.c10
-rw-r--r--src/nvim/screen.c6
-rw-r--r--src/nvim/search.c23
-rw-r--r--src/nvim/spell.c22
-rw-r--r--src/nvim/term.c4
-rw-r--r--src/nvim/testdir/Makefile3
-rw-r--r--src/nvim/version.c10
-rw-r--r--test/functional/clipboard/clipboard_provider_spec.lua20
-rw-r--r--test/functional/ui/mouse_spec.lua1
38 files changed, 451 insertions, 378 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ed9aa3cd81..c1b9d50143 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -68,6 +68,11 @@ For new code, please run [`clint.py`][clint] to detect style errors. It is not
perfect and may have false positives and negatives. To have `clint.py` ignore
certain special cases, put `// NOLINT` at the end of the line.
+We also provide a configuration file for [`clang-format` and
+`git-clang-format`][clang-format], which can be used to format code according
+to the style guidelines. Be aware this formatting method might need user
+supervision.
+
#### Commit guidelines
The purpose of these guidelines is to *make reviews easier* and make the VCS logs more valuable.
@@ -93,6 +98,7 @@ The purpose of these guidelines is to *make reviews easier* and make the VCS log
[cla]: https://docs.google.com/forms/d/1u54bpbwzneDIRltFx1TGi2evKxY3w0cOV3vlpj8DPbg/viewform
[clint]: clint.py
+[clang-format]: http://clang.llvm.org/docs/ClangFormat.html
[entry]: https://github.com/neovim/neovim/issues?labels=entry-level&state=open
[imperative]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[style]: http://neovim.org/develop/style-guide.xml
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 5f1c4a6261..1be2827c2c 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -1,4 +1,4 @@
-*map.txt* For Vim version 7.4. Last change: 2014 Sep 30
+*map.txt* For Vim version 7.4. Last change: 2014 Oct 03
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -923,9 +923,11 @@ Examples: ({CURSOR} is where you type a non-keyword character) >
< "test;;" is not expanded
"test ;;" is expanded to "test <endofline>"
-To avoid the abbreviation in insert mode: Type part of the abbreviation, exit
-insert mode with <Esc>, re-enter insert mode with "a" and type the rest. Or
-type CTRL-V before the character after the abbreviation.
+To avoid the abbreviation in Insert mode: Type CTRL-V before the character
+that would trigger the abbreviation. E.g. CTRL-V <Space>. Or type part of
+the abbreviation, exit insert mode with <Esc>, re-enter insert mode with "a"
+and type the rest.
+
To avoid the abbreviation in Command-line mode: Type CTRL-V twice somewhere in
the abbreviation to avoid it to be replaced. A CTRL-V in front of a normal
character is mostly ignored otherwise.
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index b885b041d1..bfe67c2757 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 Oct 02
+*todo.txt* For Vim version 7.4. Last change: 2014 Oct 15
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -35,6 +35,8 @@ not be repeated below, unless there is extra information.
-------------------- Known bugs and current work -----------------------
Regexp problems:
+- The NFA engine does not implement the time limit passed to
+ nfa_regexec_multi()
- Bug with pattern: '\vblock (\d+)\.\n.*\d+%(\1)@<!\.$'
(Lech Lorens, 2014 Feb 3)
- Issue 164: freeze on regexp search.
@@ -58,15 +60,6 @@ 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 'linebreak' when applying an operator. And fix the test not
-actually testing. (Christian Brabandt, 2014 Sep 23)
-
-patch to fix issue 26. (Christian)
-
-Test 11 and 100 do not work properly on Windows.
-Patch by Ken Takata (2014 Sep 25)
-Alternative patch Oct 1.
-
Problem that a previous silent ":throw" causes a following try/catch not to
work. (ZyX, 2013 Sep 28)
@@ -74,15 +67,9 @@ Patch to avoid problems with encoding conversion with diff.vim.
(Yasuhiro Matsumoto, 2014 Sep 1.
Depends on current language, language of file can be different.
-Add books from Steve Oualline to Vim website. (2014 Sep 25)
-
":cd C:\Windows\System32\drivers\etc*" does not work, even though the
directory exists. (Sergio Gallelli, 2013 Dec 29)
-Patch to have the fold and sign column and at the last line of the buffer.
-(Marco Hinz, 2014 Sep 25)
-Alternate suggestion: let all columns continue, also number column.
-
Patch by Marcin Szamotulski to add count to :close (2014 Aug 10, update Aug
14, Aug 30)
Make ":1close" close the first window.
@@ -90,28 +77,31 @@ Patch by Marcin Szamotulski to add count to :close (2014 Aug 10, update Aug
Make ":-1close" close the previous window.
Doesn't look right, asked for updates.
-Patch to handle multi-byte printer name on MS-Windows. (Yasuhiro Matsumoto,
-2014 Sept 28)
-
-Two patches by Christian, 2014 Sep 29:
-- Combination of precedes listchar and 'showbreak' doesn't work well.
-- Moving cursor is off when 'nu' and 'sbr' are set.
-
The entries added by matchaddpos() are returned by getmatches() but can't be
set with setmatches(). (lcd47, 2014 Jun 29)
-Patch to fix window title for a command window on MS-Windows. (Yasuhiro
-Matsumoto, 2014 Sep 28)
-
Patch to fix that 0x80 in abbreviation isn't handled correctly.
(Christian Brabandt, 2014 Oct 1)
+Check for valid yank reg seems wrong. Patch by Zyx, 2014 Oct 12.
+
+":sign-jump" uses first window in buffer instead of current window.
+Patch by James McCoy, 2013 Nov 22. Update 2014 Oct 5.
+
Patch to fix issue 57, on the issue.
Patch for issue 101, maintainer unreachable.
+Gvim: when both Tab and CTRL-I are mapped, use CTRL-I not for Tab.
+
+Patch to fix that last_changedtick is not update on saving. (Christian
+Brabandt, 2014 Oct 10, second one)
+
+substitute() can be slow with long strings. Patch by Ozaki Kiichi, 2014 Oct
+12.
+
Remove restriction in NSIS installer that the end of the path must be "Vim".
-(Tim Lebedkov, 2014 Sep 24)
+(Tim Lebedkov, 2014 Sep 24) Again Oct 12.
Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15)
@@ -119,6 +109,14 @@ Python: ":py raw_input('prompt')" doesn't work. (Manu Hack)
'foldexpr' applies to help. (Paul Marshall, 2014 Sep 24)
+Patch to fix issue 203. (Christian Brabandt, 2014 Oct 8)
+
+Patch to fix issue 253. (Christian Brabandt, 2014 Oct 8)
+
+Patch to fix issue 78. (Christian Brabandt, 2014 Oct 8)
+
+Patch to fix leak in map() with error. (Christian Brabandt, 2014 Oct 11)
+
Value returned by virtcol() changes depending on how lines wrap. This is
inconsistent with the documentation.
@@ -142,9 +140,19 @@ Adding "~" to 'cdpath' doesn't work for completion? (Davido, 2013 Aug 19)
Patch to make closed folds line up. (Charles Campbell, 2014 Sep 12)
+Patch for building a 32bit Vim with 64bit MingW compiler.
+(Michael Soyka, 2014 Oct 15)
+
+Delete old code in os_msdos.c, mch_FullName().
+
"hi link" does not respect groups with GUI settings only. (Mark Lodato, 2014
Jun 8)
+Patch to switch to the BT regexp engine when the NFA engine uses many states.
+(Christian Brabandt, 2014 Oct 3)
+
+Patch to add argument to :cquit. (Thinca, 2014 Oct 12)
+
No error for missing endwhile. (ZyX, 2014 Mar 20)
start_global_changes() plus end_global_changes() causes problem for
@@ -333,9 +341,6 @@ buffer. (2013 Dec 9)
Patch for drag&drop reordering of GUI tab pages reordering.
(Ken Takata, 2013 Nov 22, second one, also by Masamichi Abe)
-":sign-jump" uses first window in buffer instead of current window.
-Patch by James McCoy, 2013 Nov 22.
-
GTK: problem with 'L' in 'guioptions' changing the window width.
(Aaron Cornelius, 2012 Feb 6)
@@ -409,7 +414,7 @@ Patch to allow setting w:quickfix_title via setqflist() and setloclist()
functions. (Christian Brabandt, 2013 May 8, update May 21)
Patch to add getlocstack() / setlocstack(). (Christian Brabandt, 2013 May 14)
Second one. Update May 22.
-Update by Daniel Hahler, 2014 Jul 4, Aug 14.
+Update by Daniel Hahler, 2014 Jul 4, Aug 14, Oct 14, Oct 15.
Patch to make fold updates much faster. (Christian Brabandt, 2012 Dec)
@@ -546,6 +551,10 @@ URXVT:
- Use urxvt mouse support also in xterm. Explanations:
http://www.midnight-commander.org/ticket/2662
+Patch to have the fold and sign column and at the last line of the buffer.
+(Marco Hinz, 2014 Sep 25)
+Alternate suggestion: let all columns continue, also the number column.
+
Patch to add tests for if_xcmdsrv.c., Jul 8, need some more work. (Brian Burns)
New tests Jul 13. Update Jul 17. Discussion Jul 18.
@@ -1002,6 +1011,12 @@ to avoid changing 'eventignore'?
Patch for displaying 0x200c and 0x200d. (Ali Gholami Rudi, 2009 May 6)
Probably needs a bit of work.
+Patch to add farsi handling to arabic.c (Ali Gholami Rudi, 2009 May 2)
+Added test, updates, June 23.
+Updated for 7.4: http://litcave.rudi.ir/farsi_vim.diff
+With modification for Tatweel character: https://dpaste.de/VmFw
+Remark from Ameretat Reith (2014 Oct 13)
+
List of encoding aliases. (Takao Fujiwara, 2009 Jul 18)
Are they all OK? Update Jul 22.
@@ -1020,10 +1035,6 @@ on the first character. (John Beckett, 2010 Aug 7)
Setting 'tags' to "tagsdir/*" does not find "tagsdir/tags". (Steven K. Wong,
2009 Jul 18)
-Patch to add farsi handling to arabic.c (Ali Gholami Rudi, 2009 May 2)
-Added test, updates, June 23.
-Updated for 7.4: http://litcave.rudi.ir/farsi_vim.diff
-
Patch to add "focusonly" to 'scrollopt', so that scrollbind also applies in
window that doesn't have focus. (Jonathon Mah, 2009 Jan 12)
Needs more work.
@@ -1944,7 +1955,7 @@ More patches:
- testdir/Make_dos_sh.mak for running tests with MingW. (Bill Mccarthy, 2008
Sep 13)
- Patch for adding "space" item in 'listchars'. (Jérémie Roquet, 2009 Oct 29,
- Docs patch Oct 30, update David Burgin (glts) 2013 Aug 24)
+ Docs patch Oct 30, update David Burgin (glts) 2013 Aug 24, 2014 Oct 10)
- Replace ccomplete.vim by cppcomplete.vim from www.vim.org? script 1520 by
Vissale Neang. (Martin Stubenschrott) Asked Vissale to make the scripts
more friendly for the Vim distribution.
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 3fc109ac0d..127cf86349 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 Sep 05
+" Last Change: 2014 Oct 09
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@@ -1147,7 +1147,7 @@ au BufNewFile,BufRead *.mv,*.mpl,*.mws setf maple
au BufNewFile,BufRead *.map setf map
" Markdown
-au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,*.mdwn,README.md setf markdown
+au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,*.mdwn,*.md setf markdown
" Mason
au BufNewFile,BufRead *.mason,*.mhtml,*.comp setf mason
@@ -1239,8 +1239,8 @@ au BufNewFile,BufRead *.mod
\ setf modsim3 |
\ endif
-" Modula 2
-au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.md,*.mi setf modula2
+" Modula 2 (.md removed in favor of Markdown)
+au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.mi setf modula2
" Modula 3 (.m3, .i3, .mg, .ig)
au BufNewFile,BufRead *.[mi][3g] setf modula3
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index aebe02fe00..eb96bb7da3 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2014 Aug 06
+" Last Change: 2014 Oct 09
" If there already is an option window, jump to that one.
if bufwinnr("option-window") > 0
@@ -724,6 +724,7 @@ call <SID>OptionG("km", &km)
call <SID>Header("editing text")
call append("$", "undolevels\tmaximum number of changes that can be undone")
+call append("$", "\t(global or local to buffer)")
call append("$", " \tset ul=" . &ul)
call append("$", "undoreload\tmaximum number lines to save for undo on a buffer reload")
call append("$", " \tset ur=" . &ur)
@@ -969,6 +970,7 @@ call <SID>BinOptionG("bk", &bk)
call append("$", "backupskip\tpatterns that specify for which files a backup is not made")
call append("$", " \tset bsk=" . &bsk)
call append("$", "backupcopy\twhether to make the backup as a copy or rename the existing file")
+call append("$", "\t(global or local to buffer)")
call append("$", " \tset bkc=" . &bkc)
call append("$", "backupdir\tlist of directories to put backup files in")
call <SID>OptionG("bdir", &bdir)
diff --git a/runtime/syntax/j.vim b/runtime/syntax/j.vim
index bde954506e..0cdd59b887 100644
--- a/runtime/syntax/j.vim
+++ b/runtime/syntax/j.vim
@@ -2,7 +2,7 @@
" Language: J
" Maintainer: David Bürgin <676c7473@gmail.com>
" URL: https://github.com/glts/vim-j
-" Last Change: 2014-05-25
+" Last Change: 2014-10-05
if exists('b:current_syntax')
finish
@@ -12,7 +12,7 @@ let s:save_cpo = &cpo
set cpo&vim
syntax case match
-syntax sync minlines=50
+syntax sync minlines=100
syntax cluster jStdlibItems contains=jStdlibNoun,jStdlibAdverb,jStdlibConjunction,jStdlibVerb
syntax cluster jPrimitiveItems contains=jNoun,jAdverb,jConjunction,jVerb,jCopula
@@ -30,26 +30,32 @@ syntax keyword jStdlibVerb AND Endian IFDEF Note OR XOR alpha17 alpha27 anddf an
syntax match jStdlibNoun /\<\%(adverb\|conjunction\|dyad\|monad\|noun\|verb\)\>/
syntax match jStdlibVerb /\<\%(assert\|break\|do\)\>\.\@!/
-" Numbers. Matching J numbers is difficult. The regular expression used for
-" the general case roughly embodies this grammar sketch:
+" Numbers. Matching J numbers is difficult. In fact, the job cannot be done
+" with regular expressions alone. Below is a sketch of the pattern used. It
+" accepts most well-formed numbers and rejects most of the ill-formed ones.
+" See http://www.jsoftware.com/help/dictionary/dcons.htm for reference.
"
-" BASE := /_?\d+(\.\d*)?([eE]_?\d+)?/
-" RATIONAL := BASE | BASE r BASE
-" COMPLEX := BASE | BASE (j|a[dr]) BASE
-" JNUMBER := RATIONAL | RATIONAL [px] RATIONAL | COMPLEX | COMPLEX [px] COMPLEX
+" "double1" and "double2" patterns:
+" (_?\d+(\.\d*)?|_\.\d+)([eE]_?\d+)?
+" (_?\d+(\.\d*)?|_\.\d+|\.\d+)([eE]_?\d+)?
"
-" The grammar is implemented as shown in this pseudo-regexp:
+" "rational1" and "rational2" patterns:
+" \k<double1>(r\k<double2>)?|__?
+" \k<double2>(r\k<double2>)?|__?
"
-" base rational complex remainder
-" /\< B ( [r]B ([px]B([r]B)?)? | (j|a[dr])B ([px]B((j|a[dr])B)?)? | [px]B ((j|a[dr]|r)B)? )?/
+" "complex1" and "complex2" patterns:
+" \k<rational1>((j|a[dr])\k<rational2>)?
+" \k<rational2>((j|a[dr])\k<rational2>)?
"
-" All in all, a compromise between correctness and practicality had to be
-" made. See http://www.jsoftware.com/help/dictionary/dcons.htm for reference.
-syntax match jNumber /\<_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(\%(r_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%([px]_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(r_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\)\=\)\=\)\|\%(\%(j\|a[dr]\)_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%([px]_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(\%(j\|a[dr]\)_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\)\=\)\=\)\|\%([px]_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(\%(j\|a[dr]\|r\)_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\)\=\)\)\=/
-syntax match jNumber /\<_\=\d\+\%([eE]\d\+\)\=b_\=[0-9a-z]\+\%(\.[0-9a-z]\+\)\=/
-syntax match jNumber /\<__\=\>/
-syntax match jNumber /\<_\./
-syntax match jNumber /\<_\=\d\+x\>/
+" "basevalue" pattern:
+" _?[0-9a-z]+(\.[0-9a-z]*)?|_?\.[0-9a-z]+
+"
+" all numbers:
+" \b\k<complex1>([px]\k<complex2>)?(b\k<basevalue>)?(?![0-9A-Za-z_.])
+syntax match jNumber /\<_\.[0-9A-Za-z_.]\@!/
+syntax match jNumber /\<_\=\d\+x[0-9A-Za-z_.]\@!/
+syntax match jNumber /\<\%(__\=r_\=\d\+\|_\=\d\+r__\=\)[0-9A-Za-z_.]\@!/
+syntax match jNumber /\<\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\%(\%(j\|a[dr]\)\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\)\=\%([px]\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\%(\%(j\|a[dr]\)\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\)\=\)\=\%(b\%(_\=[0-9a-z]\+\%(\.[0-9a-z]*\)\=\|_\=\.[0-9a-z]\+\)\)\=[0-9A-Za-z_.]\@!/
syntax region jString oneline start=/'/ skip=/''/ end=/'/
diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim
index fce9e5dd3e..c1f25699e7 100644
--- a/runtime/syntax/rst.vim
+++ b/runtime/syntax/rst.vim
@@ -1,8 +1,8 @@
" Vim syntax file
-" Language: reStructuredText documentation format
-" Maintainer: Marshall Ward <marshall.ward@gmail.com>
+" Language: reStructuredText documentation format
+" Maintainer: Marshall Ward <marshall.ward@gmail.com>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2014-08-23
+" Latest Revision: 2014-10-03
if exists("b:current_syntax")
finish
@@ -150,12 +150,19 @@ endif
for code in g:rst_syntax_code_list
unlet! b:current_syntax
+ " guard against setting 'isk' option which might cause problems (issue #108)
+ let prior_isk = &l:iskeyword
exe 'syn include @rst'.code.' syntax/'.code.'.vim'
exe 'syn region rstDirective'.code.' matchgroup=rstDirective fold '
\.'start=#\%(sourcecode\|code\%(-block\)\=\)::\s\+'.code.'\_s*\n\ze\z(\s\+\)# '
\.'skip=#^$# '
\.'end=#^\z1\@!# contains=@NoSpell,@rst'.code
exe 'syn cluster rstDirectives add=rstDirective'.code
+ " reset 'isk' setting, if it has been changed
+ if &l:iskeyword !=# prior_isk
+ let &l:iskeyword = prior_isk
+ endif
+ unlet! prior_isk
endfor
" TODO: Use better syncing.
diff --git a/src/.clang-format b/src/.clang-format
new file mode 100644
index 0000000000..35e545ac4b
--- /dev/null
+++ b/src/.clang-format
@@ -0,0 +1,12 @@
+BasedOnStyle: llvm
+Language: Cpp
+ColumnLimit: 80
+IndentWidth: 2
+TabWidth: 2
+UseTab: Never
+IndentCaseLabels: true
+BreakBeforeBraces: Linux
+AlignEscapedNewlinesLeft: false
+AllowShortFunctionsOnASingleLine: false
+SpacesBeforeTrailingComments: 2
+PenaltyReturnTypeOnItsOwnLine: 200
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index 0292e82038..b4a52f97fb 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -308,7 +308,7 @@ end:
try_end(err);
}
-/// Gets a buffer variable
+/// Gets a buffer-scoped (b:) variable.
///
/// @param buffer The buffer handle
/// @param name The variable name
@@ -325,7 +325,7 @@ Object buffer_get_var(Buffer buffer, String name, Error *err)
return dict_get_value(buf->b_vars, name, err);
}
-/// Sets a buffer variable. Passing 'nil' as value deletes the variable.
+/// Sets a buffer-scoped (b:) variable. 'nil' value deletes the variable.
///
/// @param buffer The buffer handle
/// @param name The variable name
diff --git a/src/nvim/api/tabpage.c b/src/nvim/api/tabpage.c
index cb06825731..1c958118e1 100644
--- a/src/nvim/api/tabpage.c
+++ b/src/nvim/api/tabpage.c
@@ -9,11 +9,11 @@
#include "nvim/memory.h"
#include "nvim/window.h"
-/// Gets the number of windows in a tabpage
+/// Gets the windows in a tabpage
///
/// @param tabpage The tabpage
/// @param[out] err Details of an error that may have occurred
-/// @return The number of windows in `tabpage`
+/// @return The windows in `tabpage`
ArrayOf(Window) tabpage_get_windows(Tabpage tabpage, Error *err)
{
Array rv = ARRAY_DICT_INIT;
@@ -37,7 +37,7 @@ ArrayOf(Window) tabpage_get_windows(Tabpage tabpage, Error *err)
return rv;
}
-/// Gets a tabpage variable
+/// Gets a tab-scoped (t:) variable
///
/// @param tabpage The tab page handle
/// @param name The variable name
@@ -54,7 +54,7 @@ Object tabpage_get_var(Tabpage tabpage, String name, Error *err)
return dict_get_value(tab->tp_vars, name, err);
}
-/// Sets a tabpage variable. Passing 'nil' as value deletes the variable.
+/// Sets a tab-scoped (t:) variable. 'nil' value deletes the variable.
///
/// @param tabpage handle
/// @param name The variable name
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index eab79d970e..45cc3c530b 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -46,7 +46,7 @@ void vim_command(String str, Error *err)
try_end(err);
}
-/// Pass input keys to Neovim
+/// Passes input keys to Neovim
///
/// @param keys to be typed
/// @param mode specifies the mapping options
@@ -90,19 +90,19 @@ void vim_feedkeys(String keys, String mode, Boolean escape_csi)
typebuf_was_filled = true;
}
-/// Pass input keys to Neovim. Unlike `vim_feedkeys`, this will use a
+/// Passes input keys to Neovim. Unlike `vim_feedkeys`, this will use a
/// lower-level input buffer and the call is not deferred.
/// This is the most reliable way to emulate real user input.
///
/// @param keys to be typed
-/// @return The number bytes actually written, which can be lower than
+/// @return The number of bytes actually written, which can be lower than
/// requested if the buffer becomes full.
Integer vim_input(String keys)
{
return (Integer)input_enqueue(keys);
}
-/// Replace any terminal codes with the internal representation
+/// Replaces any terminal codes with the internal representation
///
/// @see replace_termcodes
/// @see cpoptions
@@ -133,7 +133,7 @@ String vim_command_output(String str, Error *err)
return cstr_to_string((char *)get_vim_var_str(VV_COMMAND_OUTPUT));
}
-/// Evaluates the expression str using the vim internal expression
+/// Evaluates the expression str using the Vim internal expression
/// evaluator (see |expression|).
/// Dictionaries and lists are recursively expanded.
///
@@ -178,7 +178,7 @@ Integer vim_strwidth(String str, Error *err)
return (Integer) mb_string2cells((char_u *) str.data);
}
-/// Returns a list of paths contained in 'runtimepath'
+/// Gets a list of paths contained in 'runtimepath'
///
/// @return The list of paths
ArrayOf(String) vim_list_runtime_paths(void)
@@ -201,7 +201,7 @@ ArrayOf(String) vim_list_runtime_paths(void)
// Allocate memory for the copies
rv.items = xmalloc(sizeof(Object) * rv.size);
- // reset the position
+ // Reset the position
rtp = p_rtp;
// Start copying
for (size_t i = 0; i < rv.size && *rtp != NUL; i++) {
@@ -218,7 +218,7 @@ ArrayOf(String) vim_list_runtime_paths(void)
return rv;
}
-/// Changes vim working directory
+/// Changes Vim working directory
///
/// @param dir The new working directory
/// @param[out] err Details of an error that may have occurred
@@ -246,7 +246,7 @@ void vim_change_directory(String dir, Error *err)
try_end(err);
}
-/// Return the current line
+/// Gets the current line
///
/// @param[out] err Details of an error that may have occurred
/// @return The current line string
@@ -265,7 +265,7 @@ void vim_set_current_line(String line, Error *err)
buffer_set_line(curbuf->handle, curwin->w_cursor.lnum - 1, line, err);
}
-/// Delete the current line
+/// Deletes the current line
///
/// @param[out] err Details of an error that may have occurred
void vim_del_current_line(Error *err)
@@ -306,7 +306,7 @@ Object vim_get_vvar(String name, Error *err)
return dict_get_value(&vimvardict, name, err);
}
-/// Get an option value string
+/// Gets an option value string
///
/// @param name The option name
/// @param[out] err Details of an error that may have occurred
@@ -327,7 +327,7 @@ void vim_set_option(String name, Object value, Error *err)
set_option_to(NULL, SREQ_GLOBAL, name, value, err);
}
-/// Write a message to vim output buffer
+/// Writes a message to vim output buffer
///
/// @param str The message
void vim_out_write(String str)
@@ -336,7 +336,7 @@ void vim_out_write(String str)
write_msg(str, false);
}
-/// Write a message to vim error buffer
+/// Writes a message to vim error buffer
///
/// @param str The message
void vim_err_write(String str)
@@ -346,7 +346,7 @@ void vim_err_write(String str)
}
/// Higher level error reporting function that ensures all str contents
-/// are written by sending a trailing linefeed to `vim_wrr_write`
+/// are written by sending a trailing linefeed to `vim_err_write`
///
/// @param str The message
void vim_report_error(String str)
@@ -381,7 +381,7 @@ ArrayOf(Buffer) vim_get_buffers(void)
return rv;
}
-/// Return the current buffer
+/// Gets the current buffer
///
/// @reqturn The buffer handle
Buffer vim_get_current_buffer(void)
@@ -433,7 +433,7 @@ ArrayOf(Window) vim_get_windows(void)
return rv;
}
-/// Return the current window
+/// Gets the current window
///
/// @return The window handle
Window vim_get_current_window(void)
@@ -488,7 +488,7 @@ ArrayOf(Tabpage) vim_get_tabpages(void)
return rv;
}
-/// Return the current tab page
+/// Gets the current tab page
///
/// @return The tab page handle
Tabpage vim_get_current_tabpage(void)
@@ -521,7 +521,7 @@ void vim_set_current_tabpage(Tabpage tabpage, Error *err)
/// Subscribes to event broadcasts
///
-/// @param channel_id The channel id(passed automatically by the dispatcher)
+/// @param channel_id The channel id (passed automatically by the dispatcher)
/// @param event The event type string
void vim_subscribe(uint64_t channel_id, String event)
{
@@ -534,7 +534,7 @@ void vim_subscribe(uint64_t channel_id, String event)
/// Unsubscribes to event broadcasts
///
-/// @param channel_id The channel id(passed automatically by the dispatcher)
+/// @param channel_id The channel id (passed automatically by the dispatcher)
/// @param event The event type string
void vim_unsubscribe(uint64_t channel_id, String event)
{
@@ -568,7 +568,7 @@ Array vim_get_api_info(uint64_t channel_id)
/// later.
///
/// @param message The message to write
-/// @param to_err True if it should be treated as an error message(use
+/// @param to_err true if it should be treated as an error message (use
/// `emsg` instead of `msg` to print each line)
static void write_msg(String message, bool to_err)
{
diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c
index 597c857ad5..f41dafff17 100644
--- a/src/nvim/api/window.c
+++ b/src/nvim/api/window.c
@@ -182,7 +182,7 @@ void window_set_width(Window window, Integer width, Error *err)
try_end(err);
}
-/// Gets a window variable
+/// Gets a window-scoped (w:) variable
///
/// @param window The window handle
/// @param name The variable name
@@ -199,7 +199,7 @@ Object window_get_var(Window window, String name, Error *err)
return dict_get_value(win->w_vars, name, err);
}
-/// Sets a window variable. Passing 'nil' as value deletes the variable.
+/// Sets a window-scoped (w:) variable. 'nil' value deletes the variable.
///
/// @param window The window handle
/// @param name The variable name
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 86d6acc60b..6fb5ebf3e4 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -390,19 +390,13 @@ char_u *transstr(char_u *s) FUNC_ATTR_NONNULL_RET
return res;
}
-/// Convert the string "str[orglen]" to do ignore-case comparing. Uses the
-/// current locale.
+/// Convert the string "str[orglen]" to do ignore-case comparing.
+/// Use the current locale.
///
-/// When "buf" is NULL returns an allocated string (NULL for out-of-memory).
-/// Otherwise puts the result in "buf[buflen]".
-///
-/// @param str
-/// @param orglen
-/// @param buf
-/// @param buflen
-///
-/// @return converted string.
+/// When "buf" is NULL, return an allocated string.
+/// Otherwise, put the result in buf, limited by buflen, and return buf.
char_u* str_foldcase(char_u *str, int orglen, char_u *buf, int buflen)
+ FUNC_ATTR_NONNULL_RET
{
garray_T ga;
int i;
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 03dceaf092..fa4e4b2835 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -1633,11 +1633,6 @@ change_indent (
* put it back again the way we wanted it.
*/
if (State & VREPLACE_FLAG) {
- /* If orig_line didn't allocate, just return. At least we did the job,
- * even if you can't backspace. */
- if (orig_line == NULL)
- return;
-
/* Save new line */
new_line = vim_strsave(get_cursor_line_ptr());
@@ -2437,14 +2432,12 @@ void ins_compl_show_pum(void)
}
}
- if (compl_match_array != NULL) {
- /* Compute the screen column of the start of the completed text.
- * Use the cursor to get all wrapping and other settings right. */
- col = curwin->w_cursor.col;
- curwin->w_cursor.col = compl_col;
- pum_display(compl_match_array, compl_match_arraysize, cur);
- curwin->w_cursor.col = col;
- }
+ /* Compute the screen column of the start of the completed text.
+ * Use the cursor to get all wrapping and other settings right. */
+ col = curwin->w_cursor.col;
+ curwin->w_cursor.col = compl_col;
+ pum_display(compl_match_array, compl_match_arraysize, cur);
+ curwin->w_cursor.col = col;
}
#define DICT_FIRST (1) /* use just first element in "dict" */
@@ -4135,7 +4128,7 @@ static int ins_compl_use_match(int c)
/*
* Do Insert mode completion.
* Called when character "c" was typed, which has a meaning for completion.
- * Returns OK if completion was done, FAIL if something failed (out of mem).
+ * Returns OK if completion was done, FAIL if something failed.
*/
static int ins_complete(int c)
{
@@ -4236,13 +4229,9 @@ static int ins_complete(int c)
compl_length = curs_col - startcol;
}
if (p_ic)
- compl_pattern = str_foldcase(line + compl_col,
- compl_length, NULL, 0);
+ compl_pattern = str_foldcase(line + compl_col, compl_length, NULL, 0);
else
- compl_pattern = vim_strnsave(line + compl_col,
- compl_length);
- if (compl_pattern == NULL)
- return FAIL;
+ compl_pattern = vim_strnsave(line + compl_col, compl_length);
} else if (compl_cont_status & CONT_ADDING) {
char_u *prefix = (char_u *)"\\<";
@@ -4309,12 +4298,9 @@ static int ins_complete(int c)
if (compl_length < 0) /* cursor in indent: empty pattern */
compl_length = 0;
if (p_ic)
- compl_pattern = str_foldcase(line + compl_col, compl_length,
- NULL, 0);
+ compl_pattern = str_foldcase(line + compl_col, compl_length, NULL, 0);
else
compl_pattern = vim_strnsave(line + compl_col, compl_length);
- if (compl_pattern == NULL)
- return FAIL;
} else if (ctrl_x_mode == CTRL_X_FILES) {
/* Go back to just before the first filename character. */
if (startcol > 0) {
@@ -4331,10 +4317,7 @@ static int ins_complete(int c)
compl_col += startcol;
compl_length = (int)curs_col - startcol;
- compl_pattern = addstar(line + compl_col, compl_length,
- EXPAND_FILES);
- if (compl_pattern == NULL)
- return FAIL;
+ compl_pattern = addstar(line + compl_col, compl_length, EXPAND_FILES);
} else if (ctrl_x_mode == CTRL_X_CMDLINE) {
compl_pattern = vim_strnsave(line, curs_col);
set_cmd_context(&compl_xp, compl_pattern,
@@ -5752,6 +5735,8 @@ stop_insert (
if (curwin->w_cursor.lnum != tpos.lnum)
curwin->w_cursor = tpos;
else {
+ /* reset tpos, could have been invalidated in the loop above */
+ tpos = curwin->w_cursor;
tpos.col++;
if (cc != NUL && gchar_pos(&tpos) == NUL) {
++curwin->w_cursor.col; // put cursor back on the NUL
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 87a5ed80e7..a4bd4d89ef 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -11628,18 +11628,12 @@ static void f_or(typval_T *argvars, typval_T *rettv)
*/
static void f_pathshorten(typval_T *argvars, typval_T *rettv)
{
- char_u *p;
-
rettv->v_type = VAR_STRING;
- p = get_tv_string_chk(&argvars[0]);
- if (p == NULL)
- rettv->vval.v_string = NULL;
- else {
- p = vim_strsave(p);
- rettv->vval.v_string = p;
- if (p != NULL)
- shorten_dir(p);
+ rettv->vval.v_string = get_tv_string_chk(&argvars[0]);
+ if (!rettv->vval.v_string) {
+ return;
}
+ rettv->vval.v_string = shorten_dir(vim_strsave(rettv->vval.v_string));
}
/*
@@ -18168,8 +18162,7 @@ void func_dump_profile(FILE *fd)
--todo;
fp = HI2UF(hi);
if (fp->uf_profiling) {
- if (sorttab != NULL)
- sorttab[st_len++] = fp;
+ sorttab[st_len++] = fp;
if (fp->uf_name[0] == K_SPECIAL)
fprintf(fd, "FUNCTION <SNR>%s()\n", fp->uf_name + 3);
@@ -18196,7 +18189,7 @@ void func_dump_profile(FILE *fd)
}
}
- if (sorttab != NULL && st_len > 0) {
+ if (st_len > 0) {
qsort((void *)sorttab, (size_t)st_len, sizeof(ufunc_T *),
prof_total_cmp);
prof_sort_list(fd, sorttab, st_len, "TOTAL", FALSE);
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index b1a7044565..3143363af6 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -4742,7 +4742,6 @@ void ex_help(exarg_T *eap)
tag = vim_strsave(matches[i]);
FreeWild(num_matches, matches);
-
/*
* Re-use an existing help window or open a new one.
* Always open a new one for ":tab help".
@@ -4805,8 +4804,7 @@ void ex_help(exarg_T *eap)
* It is needed for do_tag top open folds under the cursor. */
KeyTyped = old_KeyTyped;
- if (tag != NULL)
- do_tag(tag, DT_HELP, 1, FALSE, TRUE);
+ do_tag(tag, DT_HELP, 1, FALSE, TRUE);
/* Delete the empty buffer if we're not using it. Careful: autocommands
* may have jumped to another window, check that the buffer is not in a
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 065c27013e..f6527db69b 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -8589,8 +8589,6 @@ static char_u *get_view_file(int c)
return NULL;
}
sname = home_replace_save(NULL, curbuf->b_ffname);
- if (sname == NULL)
- return NULL;
/*
* We want a file name without separators, because we're not going to make
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index b942f69f61..a4e8fccc23 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -3033,10 +3033,8 @@ void tilde_replace(char_u *orig_pat, int num_files, char_u **files)
if (orig_pat[0] == '~' && vim_ispathsep(orig_pat[1])) {
for (i = 0; i < num_files; ++i) {
p = home_replace_save(NULL, files[i]);
- if (p != NULL) {
- free(files[i]);
- files[i] = p;
- }
+ free(files[i]);
+ files[i] = p;
}
}
}
@@ -3265,6 +3263,7 @@ addstar (
int len,
int context /* EXPAND_FILES etc. */
)
+ FUNC_ATTR_NONNULL_RET
{
char_u *retval;
int i, j;
@@ -3343,35 +3342,33 @@ addstar (
}
} else {
retval = xmalloc(len + 4);
- if (retval != NULL) {
- STRLCPY(retval, fname, len + 1);
+ STRLCPY(retval, fname, len + 1);
- /*
- * Don't add a star to *, ~, ~user, $var or `cmd`.
- * * would become **, which walks the whole tree.
- * ~ would be at the start of the file name, but not the tail.
- * $ could be anywhere in the tail.
- * ` could be anywhere in the file name.
- * When the name ends in '$' don't add a star, remove the '$'.
- */
- tail = path_tail(retval);
- ends_in_star = (len > 0 && retval[len - 1] == '*');
+ /*
+ * Don't add a star to *, ~, ~user, $var or `cmd`.
+ * * would become **, which walks the whole tree.
+ * ~ would be at the start of the file name, but not the tail.
+ * $ could be anywhere in the tail.
+ * ` could be anywhere in the file name.
+ * When the name ends in '$' don't add a star, remove the '$'.
+ */
+ tail = path_tail(retval);
+ ends_in_star = (len > 0 && retval[len - 1] == '*');
#ifndef BACKSLASH_IN_FILENAME
- for (i = len - 2; i >= 0; --i) {
- if (retval[i] != '\\')
- break;
- ends_in_star = !ends_in_star;
- }
-#endif
- if ((*retval != '~' || tail != retval)
- && !ends_in_star
- && vim_strchr(tail, '$') == NULL
- && vim_strchr(retval, '`') == NULL)
- retval[len++] = '*';
- else if (len > 0 && retval[len - 1] == '$')
- --len;
- retval[len] = NUL;
+ for (i = len - 2; i >= 0; --i) {
+ if (retval[i] != '\\')
+ break;
+ ends_in_star = !ends_in_star;
}
+#endif
+ if ((*retval != '~' || tail != retval)
+ && !ends_in_star
+ && vim_strchr(tail, '$') == NULL
+ && vim_strchr(retval, '`') == NULL)
+ retval[len++] = '*';
+ else if (len > 0 && retval[len - 1] == '$')
+ --len;
+ retval[len] = NUL;
}
return retval;
}
@@ -3506,8 +3503,6 @@ expand_cmdline (
/* add star to file name, or convert to regexp if not exp. files. */
xp->xp_pattern_len = (int)(str + col - xp->xp_pattern);
file_str = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context);
- if (file_str == NULL)
- return EXPAND_UNSUCCESSFUL;
if (p_wic)
options += WILD_ICASE;
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 370584b095..863e44ed9c 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -28,6 +28,7 @@
#include "nvim/ex_docmd.h"
#include "nvim/ex_eval.h"
#include "nvim/fold.h"
+#include "nvim/func_attr.h"
#include "nvim/getchar.h"
#include "nvim/hashtab.h"
#include "nvim/iconv.h"
@@ -2106,6 +2107,7 @@ void set_forced_fenc(exarg_T *eap)
* When *pp is not set to NULL, the result is in allocated memory.
*/
static char_u *next_fenc(char_u **pp)
+ FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET
{
char_u *p;
char_u *r;
@@ -2125,10 +2127,6 @@ static char_u *next_fenc(char_u **pp)
free(r);
r = p;
}
- if (r == NULL) { /* out of memory */
- r = (char_u *)"";
- *pp = NULL;
- }
return r;
}
@@ -4923,54 +4921,51 @@ buf_check_timestamp (
if (mesg != NULL) {
path = home_replace_save(buf, buf->b_fname);
- if (path != NULL) {
- if (!helpmesg)
- mesg2 = "";
- tbuf = xmalloc(STRLEN(path) + STRLEN(mesg) + STRLEN(mesg2) + 2);
- sprintf((char *)tbuf, mesg, path);
- /* Set warningmsg here, before the unimportant and output-specific
- * mesg2 has been appended. */
- set_vim_var_string(VV_WARNINGMSG, tbuf, -1);
- if (can_reload) {
- if (*mesg2 != NUL) {
- STRCAT(tbuf, "\n");
- STRCAT(tbuf, mesg2);
- }
- if (do_dialog(VIM_WARNING, (char_u *)_("Warning"), tbuf,
- (char_u *)_("&OK\n&Load File"), 1, NULL, TRUE) == 2)
- reload = TRUE;
- } else if (State > NORMAL_BUSY || (State & CMDLINE) ||
- already_warned) {
- if (*mesg2 != NUL) {
- STRCAT(tbuf, "; ");
- STRCAT(tbuf, mesg2);
- }
- EMSG(tbuf);
- retval = 2;
- } else {
- if (!autocmd_busy) {
- msg_start();
- msg_puts_attr(tbuf, hl_attr(HLF_E) + MSG_HIST);
- if (*mesg2 != NUL)
- msg_puts_attr((char_u *)mesg2,
- hl_attr(HLF_W) + MSG_HIST);
- msg_clr_eos();
- (void)msg_end();
- if (emsg_silent == 0) {
- out_flush();
- /* give the user some time to think about it */
- os_delay(1000L, true);
-
- /* don't redraw and erase the message */
- redraw_cmdline = FALSE;
- }
- }
- already_warned = TRUE;
+ if (!helpmesg)
+ mesg2 = "";
+ tbuf = xmalloc(STRLEN(path) + STRLEN(mesg) + STRLEN(mesg2) + 2);
+ sprintf((char *)tbuf, mesg, path);
+ /* Set warningmsg here, before the unimportant and output-specific
+ * mesg2 has been appended. */
+ set_vim_var_string(VV_WARNINGMSG, tbuf, -1);
+ if (can_reload) {
+ if (*mesg2 != NUL) {
+ STRCAT(tbuf, "\n");
+ STRCAT(tbuf, mesg2);
+ }
+ if (do_dialog(VIM_WARNING, (char_u *)_("Warning"), tbuf,
+ (char_u *)_("&OK\n&Load File"), 1, NULL, TRUE) == 2)
+ reload = TRUE;
+ } else if (State > NORMAL_BUSY || (State & CMDLINE) || already_warned) {
+ if (*mesg2 != NUL) {
+ STRCAT(tbuf, "; ");
+ STRCAT(tbuf, mesg2);
}
+ EMSG(tbuf);
+ retval = 2;
+ } else {
+ if (!autocmd_busy) {
+ msg_start();
+ msg_puts_attr(tbuf, hl_attr(HLF_E) + MSG_HIST);
+ if (*mesg2 != NUL)
+ msg_puts_attr((char_u *)mesg2,
+ hl_attr(HLF_W) + MSG_HIST);
+ msg_clr_eos();
+ (void)msg_end();
+ if (emsg_silent == 0) {
+ out_flush();
+ /* give the user some time to think about it */
+ os_delay(1000L, true);
- free(path);
- free(tbuf);
+ /* don't redraw and erase the message */
+ redraw_cmdline = FALSE;
+ }
+ }
+ already_warned = TRUE;
}
+
+ free(path);
+ free(tbuf);
}
if (reload) {
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c
index bb41db6168..843cbcf6f9 100644
--- a/src/nvim/if_cscope.c
+++ b/src/nvim/if_cscope.c
@@ -1649,7 +1649,6 @@ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
char *cntxformat = " <<%s>>";
char *context;
char *cstag_msg = _("Cscope tag: %s");
- char *csfmt_str = "%4d %6s ";
assert (num_matches > 0);
@@ -1691,17 +1690,15 @@ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
lno[strlen(lno)-2] = '\0'; /* ignore ;" at the end */
+ const char *csfmt_str = "%4d %6s ";
/* hopefully 'num' (num of matches) will be less than 10^16 */
newsize = strlen(csfmt_str) + 16 + strlen(lno);
if (bufsize < newsize) {
buf = xrealloc(buf, newsize);
bufsize = newsize;
}
- if (buf != NULL) {
- /* csfmt_str = "%4d %6s "; */
- (void)sprintf(buf, csfmt_str, num, lno);
- MSG_PUTS_ATTR(buf, hl_attr(HLF_CM));
- }
+ (void)sprintf(buf, csfmt_str, num, lno);
+ MSG_PUTS_ATTR(buf, hl_attr(HLF_CM));
MSG_PUTS_LONG_ATTR(cs_pathcomponents(fname), hl_attr(HLF_CM));
/* compute the required space for the context */
@@ -1715,16 +1712,14 @@ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
buf = xrealloc(buf, newsize);
bufsize = newsize;
}
- if (buf != NULL) {
- (void)sprintf(buf, cntxformat, context);
-
- /* print the context only if it fits on the same line */
- if (msg_col + (int)strlen(buf) >= (int)Columns)
- msg_putchar('\n');
- msg_advance(12);
- MSG_PUTS_LONG(buf);
+ (void)sprintf(buf, cntxformat, context);
+
+ /* print the context only if it fits on the same line */
+ if (msg_col + (int)strlen(buf) >= (int)Columns)
msg_putchar('\n');
- }
+ msg_advance(12);
+ MSG_PUTS_LONG(buf);
+ msg_putchar('\n');
if (extra != NULL) {
msg_advance(13);
MSG_PUTS_LONG(extra);
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c
index 9c636ebbcc..8310f635c9 100644
--- a/src/nvim/indent_c.c
+++ b/src/nvim/indent_c.c
@@ -1593,8 +1593,6 @@ int get_c_indent(void)
* This is required, because only the most recent line obtained with
* ml_get is valid! */
linecopy = vim_strsave(ml_get(cur_curpos.lnum));
- if (linecopy == NULL)
- return 0;
/*
* In insert mode and the cursor is on a ')' truncate the line at the
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index cfc702f189..5853b535cd 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -506,8 +506,6 @@ void fmarks_check_names(buf_T *buf)
return;
name = home_replace_save(buf, buf->b_ffname);
- if (name == NULL)
- return;
for (i = 0; i < NMARKS + EXTRA_MARKS; ++i)
fmarks_check_one(&namedfm[i], name, buf);
@@ -1327,19 +1325,17 @@ int removable(char_u *name)
size_t n;
name = home_replace_save(NULL, name);
- if (name != NULL) {
- for (p = p_viminfo; *p; ) {
- copy_option_part(&p, part, 51, ", ");
- if (part[0] == 'r') {
- n = STRLEN(part + 1);
- if (MB_STRNICMP(part + 1, name, n) == 0) {
- retval = TRUE;
- break;
- }
+ for (p = p_viminfo; *p; ) {
+ copy_option_part(&p, part, 51, ", ");
+ if (part[0] == 'r') {
+ n = STRLEN(part + 1);
+ if (MB_STRNICMP(part + 1, name, n) == 0) {
+ retval = TRUE;
+ break;
}
}
- free(name);
}
+ free(name);
return retval;
}
@@ -1451,8 +1447,6 @@ void copy_viminfo_marks(vir_T *virp, FILE *fp_out, int count, int eof, int flags
*/
str = skipwhite(line + 1);
str = viminfo_readstring(virp, (int)(str - virp->vir_line), FALSE);
- if (str == NULL)
- continue;
p = str + STRLEN(str);
while (p != str && (*p == NUL || vim_isspace(*p)))
p--;
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 1fa6d6acc6..29b372e057 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -1240,10 +1240,8 @@ theend:
mf_put(mfp, hp, false, false);
mf_close(mfp, false); /* will also free(mfp->mf_fname) */
}
- if (buf != NULL) {
- free(buf->b_ml.ml_stack);
- free(buf);
- }
+ free(buf->b_ml.ml_stack);
+ free(buf);
if (serious_error && called_from_main)
ml_close(curbuf, TRUE);
else {
@@ -3279,10 +3277,7 @@ findswapname (
/*
* we try different names until we find one that does not exist yet
*/
- if (dir_name == NULL) /* out of memory */
- fname = NULL;
- else
- fname = makeswapname(buf_fname, buf->b_ffname, buf, dir_name);
+ fname = makeswapname(buf_fname, buf->b_ffname, buf, dir_name);
for (;; ) {
if (fname == NULL) /* must be out of memory */
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 9cd3814826..87b0253d70 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -1083,8 +1083,7 @@ static void msg_home_replace_attr(char_u *fname, int attr)
char_u *name;
name = home_replace_save(NULL, fname);
- if (name != NULL)
- msg_outtrans_attr(name, attr);
+ msg_outtrans_attr(name, attr);
free(name);
}
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index aa4d2b38db..383e2bf6a5 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -3466,8 +3466,6 @@ get_cmd_output (
i = (int)fread((char *)buffer, (size_t)1, (size_t)len, fd);
fclose(fd);
os_remove((char *)tempname);
- if (buffer == NULL)
- goto done;
if (i != len) {
EMSG2(_(e_notread), tempname);
free(buffer);
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 90cb482ec5..cdd2ddcc12 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -61,7 +61,8 @@
#define DELETION_REGISTER 36
#define CLIP_REGISTER 37
-# define CB_UNNAMEDMASK (CB_UNNAMED | CB_UNNAMEDPLUS)
+#define CB_UNNAMEDMASK (CB_UNNAMED | CB_UNNAMEDPLUS)
+#define CB_LATEST (-1)
/*
* Each yank register is an array of pointers to lines.
*/
@@ -1382,10 +1383,9 @@ int op_delete(oparg_T *oap)
* register. For the black hole register '_' don't yank anything.
*/
if (oap->regname != '_') {
- bool unnamedclip = oap->regname == 0 && (cb_flags & CB_UNNAMEDMASK);
- if (oap->regname != 0 || unnamedclip) {
+ if (oap->regname != 0) {
/* check for read-only register */
- if (!( valid_yank_reg(oap->regname, TRUE) || unnamedclip )) {
+ if (!( valid_yank_reg(oap->regname, TRUE) )) {
beep_flush();
return OK;
}
@@ -1421,6 +1421,9 @@ int op_delete(oparg_T *oap)
oap->regname = 0;
}
+ if(oap->regname == 0 && did_yank) {
+ set_clipboard(CB_LATEST);
+ }
/*
* If there's too much stuff to fit in the yank register, then get a
* confirmation before doing the delete. This is crude, but simple.
@@ -5275,40 +5278,44 @@ static void free_register(struct yankreg *reg)
}
// return target register
-static int adjust_clipboard_name(int *name) {
+static struct yankreg* adjust_clipboard_name(int *name) {
if (*name == '*' || *name == '+') {
if(!eval_has_provider("clipboard")) {
EMSG("clipboard: provider is not available");
- return -1;
+ return NULL;
}
- return CLIP_REGISTER;
- } else if (*name == NUL && (cb_flags & (CB_UNNAMED | CB_UNNAMEDPLUS))) {
+ return &y_regs[CLIP_REGISTER];
+ } else if ((*name == NUL || *name == CB_LATEST) && (cb_flags & CB_UNNAMEDMASK)) {
if(!eval_has_provider("clipboard")) {
if (!clipboard_didwarn_unnamed) {
msg((char_u*)"clipboard: provider not available, ignoring clipboard=unnamed[plus]");
clipboard_didwarn_unnamed = true;
}
- return -1;
+ return NULL;
+ }
+ struct yankreg* target;
+ if (*name == CB_LATEST) {
+ target = y_current;
+ } else {
+ target = &y_regs[0];
}
if (cb_flags & CB_UNNAMEDPLUS) {
*name = '+';
} else {
*name = '*';
}
- return 0; //unnamed
+ return target; // unnamed register
}
// don't do anything for other register names
- return -1;
+ return NULL;
}
static void get_clipboard(int name)
{
- int ireg = adjust_clipboard_name(&name);
- if (ireg < 0) {
+ struct yankreg* reg = adjust_clipboard_name(&name);
+ if (reg == NULL) {
return;
}
-
- struct yankreg *reg = &y_regs[ireg];
free_register(reg);
list_T *args = list_alloc();
@@ -5396,13 +5403,11 @@ err:
static void set_clipboard(int name)
{
- int ireg = adjust_clipboard_name(&name);
- if (ireg < 0) {
+ struct yankreg* reg = adjust_clipboard_name(&name);
+ if (reg == NULL) {
return;
}
- struct yankreg *reg = &y_regs[ireg];
-
list_T *lines = list_alloc();
for (int i = 0; i < reg->y_size; i++) {
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 219dac12de..e5f78440c2 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -239,33 +239,31 @@ int vim_ispathlistsep(int c)
* Shorten the path of a file from "~/foo/../.bar/fname" to "~/f/../.b/fname"
* It's done in-place.
*/
-void shorten_dir(char_u *str)
+char_u *shorten_dir(char_u *str)
{
- char_u *tail, *s, *d;
- int skip = FALSE;
-
- tail = path_tail(str);
- d = str;
- for (s = str;; ++s) {
+ char_u *tail = path_tail(str);
+ char_u *d = str;
+ bool skip = false;
+ for (char_u *s = str;; ++s) {
if (s >= tail) { /* copy the whole tail */
*d++ = *s;
if (*s == NUL)
break;
} else if (vim_ispathsep(*s)) { /* copy '/' and next char */
*d++ = *s;
- skip = FALSE;
+ skip = false;
} else if (!skip) {
*d++ = *s; /* copy next char */
if (*s != '~' && *s != '.') /* and leading "~" and "." */
- skip = TRUE;
+ skip = true;
if (has_mbyte) {
int l = mb_ptr2len(s);
-
while (--l > 0)
*d++ = *++s;
}
}
}
+ return str;
}
/*
@@ -883,11 +881,9 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
}
free(curdir);
- if (in_curdir != NULL) {
- for (int i = 0; i < gap->ga_len; i++)
- free(in_curdir[i]);
- free(in_curdir);
- }
+ for (int i = 0; i < gap->ga_len; i++)
+ free(in_curdir[i]);
+ free(in_curdir);
ga_clear_strings(&path_ga);
vim_regfree(regmatch.regprog);
diff --git a/src/nvim/po/ru.cp1251.po b/src/nvim/po/ru.cp1251.po
index df1bf7873a..4dd4cec235 100644
--- a/src/nvim/po/ru.cp1251.po
+++ b/src/nvim/po/ru.cp1251.po
@@ -7,10 +7,10 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: vim_7.4_ru\n"
+"Project-Id-Version: vim_ru\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-05-26 14:21+0200\n"
-"PO-Revision-Date: 2013-08-31 21:11+0400\n"
+"PO-Revision-Date: 2014-10-10 12:00+0400\n"
"Last-Translator: Sergey Alyoshin <alyoshin.s@gmail.com>\n"
"Language-Team: \n"
"Language: Russian\n"
@@ -820,18 +820,17 @@ msgid "sort() argument"
msgstr " sort()"
#: ../eval.c:13721
-#, fuzzy
msgid "uniq() argument"
-msgstr " add()"
+msgstr " uniq()"
#: ../eval.c:13776
msgid "E702: Sort compare function failed"
msgstr "E702: "
#: ../eval.c:13806
-#, fuzzy
msgid "E882: Uniq compare function failed"
-msgstr "E702: "
+msgstr ""
+"E882: "
#: ../eval.c:14085
msgid "(Invalid)"
@@ -957,18 +956,14 @@ msgid "E129: Function name required"
msgstr "E129: "
#: ../eval.c:17824
-#, fuzzy, c-format
+#, c-format
msgid "E128: Function name must start with a capital or \"s:\": %s"
-msgstr ""
-"E128: "
-": %s"
+msgstr "E128: \"s:\": %s"
#: ../eval.c:17833
-#, fuzzy, c-format
+#, c-format
msgid "E884: Function name cannot contain a colon: %s"
-msgstr ""
-"E128: "
-": %s"
+msgstr "E884: : %s"
#: ../eval.c:18336
#, c-format
@@ -1116,6 +1111,10 @@ msgstr "E138: viminfo %s!"
msgid "Writing viminfo file \"%s\""
msgstr " viminfo \"%s\""
+#, c-format
+msgid "E886: Can't rename viminfo file to %s!"
+msgstr "E886: viminfo %s!"
+
#. Write the info:
#: ../ex_cmds.c:1720
#, c-format
@@ -1358,6 +1357,10 @@ msgstr "E158: : %s"
msgid "E157: Invalid sign ID: %<PRId64>"
msgstr "E157: ID : %<PRId64>"
+#, c-format
+msgid "E885: Not possible to change sign %s"
+msgstr "E885: %s"
+
#: ../ex_cmds.c:6066
msgid " (not supported)"
msgstr " ( )"
@@ -2003,6 +2006,9 @@ msgstr "E344: \"%s\" "
msgid "E345: Can't find file \"%s\" in path"
msgstr "E345: \"%s\" "
+msgid "List or number required"
+msgstr " "
+
#: ../file_search.c:1512
#, c-format
msgid "E346: No more directory \"%s\" found in cdpath"
@@ -4533,6 +4539,13 @@ msgstr ""
msgid "E574: Unknown register type %d"
msgstr "E574: %d"
+msgid ""
+"E883: search pattern and expression register may not contain two or more "
+"lines"
+msgstr ""
+"E883: "
+""
+
#: ../ops.c:5089
#, c-format
msgid "%<PRId64> Cols; "
@@ -4796,6 +4809,19 @@ msgstr ""
"\n"
" "
+msgid "Could not set security context "
+msgstr " "
+
+msgid " for "
+msgstr " "
+
+#. no enough size OR unexpected error
+msgid "Could not get security context "
+msgstr " "
+
+msgid ". Removing it!\n"
+msgstr ". !\n"
+
#: ../os_unix.c:1558 ../os_unix.c:1647
#, c-format
msgid "dlerror = \"%s\""
@@ -5008,6 +5034,10 @@ msgstr "E554: %s{...}"
msgid "External submatches:\n"
msgstr " :\n"
+#, c-format
+msgid "E888: (NFA regexp) cannot repeat %s"
+msgstr "E888: (. ) %s"
+
#: ../regexp.c:7022
msgid ""
"E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be "
@@ -8243,3 +8273,10 @@ msgstr "E446: "
#~ msgstr ""
#~ " : sys.path \n"
#~ " vim.VIM_SPECIAL_PATH sys.path"
+
+#~ msgid ""
+#~ "E887: Sorry, this command is disabled, the Python's site module could not be "
+#~ "loaded."
+#~ msgstr ""
+#~ "E887: , "
+#~ "Python site."
diff --git a/src/nvim/po/ru.po b/src/nvim/po/ru.po
index 0028cbfccd..5bdbc33801 100644
--- a/src/nvim/po/ru.po
+++ b/src/nvim/po/ru.po
@@ -7,10 +7,10 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: vim_7.4_ru\n"
+"Project-Id-Version: vim_ru\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-05-26 14:21+0200\n"
-"PO-Revision-Date: 2013-08-31 21:11+0400\n"
+"PO-Revision-Date: 2014-10-10 12:00+0400\n"
"Last-Translator: Sergey Alyoshin <alyoshin.s@gmail.com>\n"
"Language-Team: \n"
"Language: Russian\n"
@@ -820,18 +820,17 @@ msgid "sort() argument"
msgstr "параметра sort()"
#: ../eval.c:13721
-#, fuzzy
msgid "uniq() argument"
-msgstr "параметра add()"
+msgstr "параметра uniq()"
#: ../eval.c:13776
msgid "E702: Sort compare function failed"
msgstr "E702: Неудачное завершение функции сравнения при сортировке"
#: ../eval.c:13806
-#, fuzzy
msgid "E882: Uniq compare function failed"
-msgstr "E702: Неудачное завершение функции сравнения при сортировке"
+msgstr ""
+"E882: Неудачное завершение функции сравнения при проверке единственности"
#: ../eval.c:14085
msgid "(Invalid)"
@@ -957,18 +956,15 @@ msgid "E129: Function name required"
msgstr "E129: Требуется имя функции"
#: ../eval.c:17824
-#, fuzzy, c-format
+#, c-format
msgid "E128: Function name must start with a capital or \"s:\": %s"
-msgstr ""
-"E128: Имя функции должно начинаться с заглавной буквы или содержать "
+msgstr "E128: Имя функции должно начинаться с заглавной буквы или \"s:\": %s"
"двоеточие: %s"
#: ../eval.c:17833
-#, fuzzy, c-format
+#, c-format
msgid "E884: Function name cannot contain a colon: %s"
-msgstr ""
-"E128: Имя функции должно начинаться с заглавной буквы или содержать "
-"двоеточие: %s"
+msgstr "E884: Имя функции не может содержать двоеточие: %s"
#: ../eval.c:18336
#, c-format
@@ -1116,6 +1112,10 @@ msgstr "E138: Невозможно записать файл viminfo %s!"
msgid "Writing viminfo file \"%s\""
msgstr "Запись файла viminfo \"%s\""
+#, c-format
+msgid "E886: Can't rename viminfo file to %s!"
+msgstr "E886: Невозможно переименовать файл viminfo в %s!"
+
#. Write the info:
#: ../ex_cmds.c:1720
#, c-format
@@ -1358,6 +1358,10 @@ msgstr "E158: Неправильное имя буфера: %s"
msgid "E157: Invalid sign ID: %<PRId64>"
msgstr "E157: Неправильный ID значка: %<PRId64>"
+#, c-format
+msgid "E885: Not possible to change sign %s"
+msgstr "E885: Невозможно изменить значок %s"
+
#: ../ex_cmds.c:6066
msgid " (not supported)"
msgstr " (не поддерживается)"
@@ -4533,6 +4537,12 @@ msgstr ""
msgid "E574: Unknown register type %d"
msgstr "E574: Неизвестный тип регистра %d"
+msgid ""
+"E883: search pattern and expression register may not contain two or more "
+"lines"
+msgstr ""
+"E883: шаблон поиска и регистр выражения не могут содержать двух или более "
+
#: ../ops.c:5089
#, c-format
msgid "%<PRId64> Cols; "
@@ -4801,11 +4811,27 @@ msgstr ""
msgid "dlerror = \"%s\""
msgstr "dlerror = \"%s\""
+msgid "Could not set security context "
+msgstr "Невозможно установить контекст безопасности "
+
+msgid " for "
+msgstr " для "
+
+msgid ". Removing it!\n"
+msgstr ". Будет удалён!\n"
+
+#. no enough size OR unexpected error
+msgid "Could not get security context "
+msgstr "Невозможно получить контекст безопасности "
+
#: ../path.c:1449
#, c-format
msgid "E447: Can't find file \"%s\" in path"
msgstr "E447: Файл \"%s\" не найден по известным путям"
+msgid "List or number required"
+msgstr "Требуется список или число"
+
#: ../quickfix.c:359
#, c-format
msgid "E372: Too many %%%c in format string"
@@ -4999,6 +5025,10 @@ msgstr "E678: Недопустимый символ после %s%%[dxouU]"
msgid "E71: Invalid character after %s%%"
msgstr "E71: Недопустимый символ после %s%%"
+#, c-format
+msgid "E888: (NFA regexp) cannot repeat %s"
+msgstr "E888: (рег. выражение НКА) невозможно повторить %s"
+
#: ../regexp.c:3017
#, c-format
msgid "E554: Syntax error in %s{...}"
@@ -8243,3 +8273,10 @@ msgstr "E446: Нет имени файла в позиции курсора"
#~ msgstr ""
#~ "Ошибка при установке пути: sys.path не является списком\n"
#~ "Следует добавить vim.VIM_SPECIAL_PATH в sys.path"
+
+#~ msgid ""
+#~ "E887: Sorry, this command is disabled, the Python's site module could not be "
+#~ "loaded."
+#~ msgstr ""
+#~ "E887: К сожалению эта команда не работает, поскольку не загружен модуль "
+#~ "Python site."
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c
index af2ab73dc8..1ea12d6862 100644
--- a/src/nvim/popupmnu.c
+++ b/src/nvim/popupmnu.c
@@ -370,17 +370,13 @@ void pum_redraw(void)
size++;
}
}
- screen_puts_len(rt, (int)STRLEN(rt), row, col - size + 1,
- attr);
+ screen_puts_len(rt, (int)STRLEN(rt), row, col - size + 1, attr);
free(rt_start);
free(st);
-
col -= width;
} else {
- if (st != NULL) {
- screen_puts_len(st, (int)STRLEN(st), row, col, attr);
- free(st);
- }
+ screen_puts_len(st, (int)STRLEN(st), row, col, attr);
+ free(st);
col += width;
}
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 6e4c17f49e..6d25c4359b 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -3444,6 +3444,10 @@ win_line (
1);
// TODO: is passing p for start of the line OK?
n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol, NULL) - 1;
+ if (c == TAB && n_extra + col > wp->w_width) {
+ n_extra = (int)wp->w_buffer->b_p_ts
+ - vcol % (int)wp->w_buffer->b_p_ts - 1;
+ }
c_extra = ' ';
if (vim_iswhite(c)) {
if (c == TAB)
@@ -7791,7 +7795,7 @@ static void draw_tabline(void)
if (room > 0) {
/* Get buffer name in NameBuff[] */
get_trans_bufname(cwp->w_buffer);
- shorten_dir(NameBuff);
+ (void)shorten_dir(NameBuff);
len = vim_strsize(NameBuff);
p = NameBuff;
if (has_mbyte)
diff --git a/src/nvim/search.c b/src/nvim/search.c
index e2781f17d5..055d2db445 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -4025,8 +4025,6 @@ find_pattern_in_path (
def_regmatch.rm_ic = FALSE; /* don't ignore case in define pat. */
}
files = xcalloc(max_path_depth, sizeof(SearchedFile));
- if (files == NULL)
- goto fpip_end;
old_files = max_path_depth;
depth = depth_displayed = -1;
@@ -4627,18 +4625,15 @@ int read_viminfo_search_pattern(vir_T *virp, int force)
hlsearch_on = TRUE;
if (idx >= 0) {
if (force || spats[idx].pat == NULL) {
- val = viminfo_readstring(virp, (int)(lp - virp->vir_line + 1),
- TRUE);
- if (val != NULL) {
- set_last_search_pat(val, idx, magic, setlast);
- free(val);
- spats[idx].no_scs = no_scs;
- spats[idx].off.line = off_line;
- spats[idx].off.end = off_end;
- spats[idx].off.off = off;
- if (setlast) {
- SET_NO_HLSEARCH(!hlsearch_on);
- }
+ val = viminfo_readstring(virp, (int)(lp - virp->vir_line + 1), TRUE);
+ set_last_search_pat(val, idx, magic, setlast);
+ free(val);
+ spats[idx].no_scs = no_scs;
+ spats[idx].off.line = off_line;
+ spats[idx].off.end = off_end;
+ spats[idx].off.off = off;
+ if (setlast) {
+ SET_NO_HLSEARCH(!hlsearch_on);
}
}
}
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 3753d9c85b..1d13a6abad 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -4545,11 +4545,9 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
// Turn flag "c" into COMPOUNDRULE compatible string "c+",
// "Na" into "Na+", "1234" into "1234+".
p = getroom(spin, STRLEN(items[1]) + 2, false);
- if (p != NULL) {
- STRCPY(p, items[1]);
- STRCAT(p, "+");
- compflags = p;
- }
+ STRCPY(p, items[1]);
+ STRCAT(p, "+");
+ compflags = p;
} else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2)) {
// We don't use the count, but do check that it's a number and
// not COMPOUNDRULE mistyped.
@@ -4565,14 +4563,12 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
if (compflags != NULL)
l += (int)STRLEN(compflags) + 1;
p = getroom(spin, l, false);
- if (p != NULL) {
- if (compflags != NULL) {
- STRCPY(p, compflags);
- STRCAT(p, "/");
- }
- STRCAT(p, items[1]);
- compflags = p;
+ if (compflags != NULL) {
+ STRCPY(p, compflags);
+ STRCAT(p, "/");
}
+ STRCAT(p, items[1]);
+ compflags = p;
}
} else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
&& compmax == 0) {
@@ -5199,8 +5195,6 @@ static void process_compflags(spellinfo_T *spin, afffile_T *aff, char_u *compfla
if (spin->si_compflags != NULL)
len += (int)STRLEN(spin->si_compflags) + 1;
p = getroom(spin, len, false);
- if (p == NULL)
- return;
if (spin->si_compflags != NULL) {
STRCPY(p, spin->si_compflags);
STRCAT(p, "/");
diff --git a/src/nvim/term.c b/src/nvim/term.c
index 78fd3c6a67..14c087cb60 100644
--- a/src/nvim/term.c
+++ b/src/nvim/term.c
@@ -3245,11 +3245,11 @@ 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_int(&p);
+ mouse_col = getdigits_int(&p) - 1;
if (*p++ != ';')
return -1;
- mouse_row = getdigits_int(&p);
+ mouse_row = getdigits_int(&p) - 1;
if (key_name[0] == KS_SGR_MOUSE && *p == 'm')
mouse_code |= MOUSE_RELEASE;
else if (*p != 'M')
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index fce0971d89..afa4ce67f4 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -106,7 +106,8 @@ clean:
$(RM_ON_START) \
valgrind.* \
.*.swp \
- .*.swo
+ .*.swo \
+ del
test1.out: .gdbinit test1.in
-rm -rf $*.failed $(RM_ON_RUN) $(RM_ON_START) wrongtermsize
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 6ca226b45f..6056a9d2a7 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -176,7 +176,10 @@ static char *(features[]) = {
NULL
};
+// clang-format off
static int included_patches[] = {
+ //591 NA
+ //590,
//589 NA
//588,
//587,
@@ -244,15 +247,15 @@ static int included_patches[] = {
//525,
//524,
//523 NA
- //522,
+ //522 NA
521,
520,
//519,
518,
- //517,
+ 517,
516,
//515,
- //514,
+ 514,
513,
//512 NA
//511 NA
@@ -768,6 +771,7 @@ static int included_patches[] = {
1,
0
};
+// clang-format on
/// Place to put a short description when adding a feature with a patch.
/// Keep it short, e.g.,: "relative numbers", "persistent undo".
diff --git a/test/functional/clipboard/clipboard_provider_spec.lua b/test/functional/clipboard/clipboard_provider_spec.lua
index c412c26c1a..1a798ec48c 100644
--- a/test/functional/clipboard/clipboard_provider_spec.lua
+++ b/test/functional/clipboard/clipboard_provider_spec.lua
@@ -38,6 +38,26 @@ local function basic_register_test()
expect([[
some text, stuff and some more
random text]])
+
+ -- deleting line or word uses "1/"- and doesn't clobber "0
+ -- and deleting word to unnamed doesn't clobber "1
+ feed('ggyyjdddw"0p"1p"-P')
+ expect([[
+ text, stuff and some more
+ some text, stuff and some more
+ some random text]])
+
+ -- delete line doesn't clobber "-
+ feed('dd"-P')
+ expect([[
+ text, stuff and some more
+ some some text, stuff and some more]])
+
+ -- deleting a word to named ("a) updates "1 (and not "-)
+ feed('gg"adwj"1P^"-P')
+ expect([[
+ , stuff and some more
+ some textsome some text, stuff and some more]])
reset()
end
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index 653d8ad92c..9530e13453 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -145,6 +145,7 @@ describe('Mouse input', function()
end)
it('ctrl + left click will search for a tag', function()
+ nvim('set_option', 'tags', './non-existent-tags-file')
feed('<C-LeftMouse><0,0>')
screen:expect([[
E433: No tags file |