Compare commits

...

16 Commits

Author SHA1 Message Date
Bram Moolenaar
5fe6bdf858 patch 8.0.1374: CTRL-A does not work with an empty line
Problem:    CTRL-A does not work with an empty line. (Alex)
Solution:   Decrement the end only once. (Hirohito Higashi, closes #2387)
2017-12-05 17:22:12 +01:00
Bram Moolenaar
3767c6e9ee patch 8.0.1373: no error when settting 'renderoptions' before starting GUI
Problem:    No error when settting 'renderoptions' to an invalid value before
            starting the GUI.
Solution:   Always check the value. (Ken Takata, closes #2413)
2017-12-05 16:57:56 +01:00
Bram Moolenaar
ac112f01a6 patch 8.0.1372: profile log may be truncated halfway a character
Problem:    Profile log may be truncated halfway a character.
Solution:   Find the start of the character. (Ozaki Kiichi, closes #2385)
2017-12-05 16:46:28 +01:00
Bram Moolenaar
feeb4d0901 patch 8.0.1371: Shift-Insert doesn't always work in MS-Windows console
Problem:    Shift-Insert doesn't always work in MS-Windows console.
Solution:   Handle K_NUL differently if the second character is more than one
            byte. (Yasuhiro Matsumoto, closes #2381)
2017-12-05 15:14:46 +01:00
Bram Moolenaar
1eca6f13d6 patch 8.0.1370: channel test for callback is flaky
Problem:    Channel test for callback is flaky.
Solution:   Add the test to thelist of flaky tests.
2017-12-05 14:04:27 +01:00
Bram Moolenaar
92467d3351 patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Problem:    MS-Windows: drawing underline, curl and strike-throw is slow,
            mFallbackDC not properly updated.
Solution:   Several performance improvements. (Ken Takata, Taro Muraoka,
            Yasuhiro Matsumoto, closes #2401)
2017-12-05 13:22:16 +01:00
Bram Moolenaar
ce6179c799 patch 8.0.1368: cannot drag status or separator of new terminal window
Problem:    Cannot drag status line or vertical separator of new terminal
            window. (UncleBill)
Solution:   Adjust mouse row and column computation. (Yasuhiro Matsumoto,
            closes #2410)
2017-12-05 13:06:16 +01:00
Bram Moolenaar
461fe50fea patch 8.0.1367: terminal test hangs, executing abcde
Problem:    terminal test hangs, executing abcde. (Stucki)
Solution:   Rename abcde to abxde.
2017-12-05 12:30:03 +01:00
Bram Moolenaar
1ad022a9b8 patch 8.0.1367 2017-12-03 18:20:32 +01:00
Bram Moolenaar
24820691e6 patch 8.0.1365: when one channel test fails others fail as well
Problem:    When one channel test fails others fail as well.
Solution:   Stop the job after a failure.  Also add a couple of tests to the
            list of flaky tests.
2017-12-02 16:38:12 +01:00
Bram Moolenaar
22044dc317 patch 8.0.1364: there is no easy way to get the window position
Problem:    There is no easy way to get the window position.
Solution:   Add win_screenpos().
2017-12-02 15:43:37 +01:00
Bram Moolenaar
af903e5d49 patch 8.0.1363: recovering does not work when swap file ends in .stz
Problem:    Recovering does not work when swap file ends in .stz.
Solution:   Check for all possible swap file names. (Elfling, closes #2395,
            closes #2396)
2017-12-02 15:11:22 +01:00
Bram Moolenaar
a7c54cfcf8 patch 8.0.1362: terminal window colors wrong when using Terminal highlighting
Problem:    Terminal window colors wrong when using Terminal highlighting.
Solution:   Set ansi_index when setting the default color.  Also cache the
            color index for Terminal. (Ozaki Kiichi, closes #2393)
2017-12-01 21:07:20 +01:00
Bram Moolenaar
97ce419201 patch 8.0.1361: some users don't want to diff with hidden buffers
Problem:    Some users don't want to diff with hidden buffers.
Solution:   Add the "hiddenoff" item to 'diffopt'. (Alisue, closes #2394)
2017-12-01 20:35:58 +01:00
Bram Moolenaar
76bb7196f5 patch 8.0.1360: the Terminal highlighting doesn't work in a terminal
Problem:    The Terminal highlighting doesn't work in a terminal. (Ozaki
            Kiichi)
Solution:   Use the Terminal highlighting when the cterm index is zero.
2017-11-30 22:07:07 +01:00
Bram Moolenaar
2f0584910c Update runtime files 2017-11-30 20:27:52 +01:00
39 changed files with 1721 additions and 626 deletions

View File

@@ -375,6 +375,10 @@ tags.ref tags.html: tags
perlhtml: tags $(DOCS) perlhtml: tags $(DOCS)
./vim2html.pl tags $(DOCS) ./vim2html.pl tags $(DOCS)
# Check URLs in the help with "curl".
test_urls:
vim -S test_urls.vim
clean: clean:
-rm doctags *.html tags.ref -rm doctags *.html tags.ref

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.0. Last change: 2017 Nov 19 *eval.txt* For Vim version 8.0. Last change: 2017 Nov 24
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2452,6 +2452,7 @@ win_getid([{win} [, {tab}]]) Number get window ID for {win} in {tab}
win_gotoid({expr}) Number go to window with ID {expr} win_gotoid({expr}) Number go to window with ID {expr}
win_id2tabwin({expr}) List get tab and window nr from window ID win_id2tabwin({expr}) List get tab and window nr from window ID
win_id2win({expr}) Number get window nr from window ID win_id2win({expr}) Number get window nr from window ID
win_screenpos({nr}) List get screen position of window {nr}
winbufnr({nr}) Number buffer number of window {nr} winbufnr({nr}) Number buffer number of window {nr}
wincol() Number window column of the cursor wincol() Number window column of the cursor
winheight({nr}) Number height of window {nr} winheight({nr}) Number height of window {nr}
@@ -4662,11 +4663,11 @@ getqflist([{what}]) *getqflist()*
following string items are supported in {what}: following string items are supported in {what}:
context get the context stored with |setqflist()| context get the context stored with |setqflist()|
efm errorformat to use when parsing "lines". If efm errorformat to use when parsing "lines". If
not present, then the 'erroformat' option not present, then the 'errorformat' option
value is used. value is used.
id get information for the quickfix list with id get information for the quickfix list with
|quickfix-ID|; zero means the id for the |quickfix-ID|; zero means the id for the
current list or the list specifed by "nr" current list or the list specified by "nr"
idx index of the current entry in the list idx index of the current entry in the list
items quickfix list entries items quickfix list entries
lines use 'errorformat' to extract items from a list lines use 'errorformat' to extract items from a list
@@ -7695,8 +7696,9 @@ submatch({nr} [, {list}]) *submatch()* *E935*
When substitute() is used recursively only the submatches in When substitute() is used recursively only the submatches in
the current (deepest) call can be obtained. the current (deepest) call can be obtained.
Example: > Examples: >
:s/\d\+/\=submatch(0) + 1/ :s/\d\+/\=submatch(0) + 1/
:echo substitute(text, '\d\+', '\=submatch(0) + 1', '')
< This finds the first number in the line and adds one to it. < This finds the first number in the line and adds one to it.
A line break is included as a newline character. A line break is included as a newline character.
@@ -8632,6 +8634,14 @@ win_id2win({expr}) *win_id2win()*
Return the window number of window with ID {expr}. Return the window number of window with ID {expr}.
Return 0 if the window cannot be found in the current tabpage. Return 0 if the window cannot be found in the current tabpage.
win_screenpos({nr}) *win_screenpos()*
Return the screen position of window {nr} as a list with two
numbers: [row, col]. The first window always has position
[1, 1].
{nr} can be the window number or the |window-ID|.
Return [0, 0] if the window cannot be found in the current
tabpage.
*winbufnr()* *winbufnr()*
winbufnr({nr}) The result is a Number, which is the number of the buffer winbufnr({nr}) The result is a Number, which is the number of the buffer
associated with window {nr}. {nr} can be the window number or associated with window {nr}. {nr} can be the window number or

View File

@@ -1,4 +1,4 @@
*if_cscop.txt* For Vim version 8.0. Last change: 2017 Jun 14 *if_cscop.txt* For Vim version 8.0. Last change: 2017 Nov 23
VIM REFERENCE MANUAL by Andy Kahn VIM REFERENCE MANUAL by Andy Kahn
@@ -468,36 +468,18 @@ license or OS distribution), then you can download it for free from:
http://cscope.sourceforge.net/ http://cscope.sourceforge.net/
This is released by SCO under the BSD license. This is released by SCO under the BSD license.
If you want a newer version of cscope, you will probably have to buy it.
According to the (old) nvi documentation:
You can buy version 13.3 source with an unrestricted license
for $400 from AT&T Software Solutions by calling +1-800-462-8146.
Also you can download cscope 13.x and mlcscope 14.x (multi-lingual cscope
which supports C, C++, Java, lex, yacc, breakpoint listing, Ingres, and SDL)
from World-Wide Exptools Open Source packages page:
http://www.bell-labs.com/project/wwexptools/packages.html
In Solaris 2.x, if you have the C compiler license, you will also have In Solaris 2.x, if you have the C compiler license, you will also have
cscope. Both are usually located under /opt/SUNWspro/bin cscope. Both are usually located under /opt/SUNWspro/bin
SGI developers can also get it. Search for Cscope on this page:
http://freeware.sgi.com/index-by-alpha.html
https://toolbox.sgi.com/toolbox/utilities/cscope/
The second one is for those who have a password for the SGI toolbox.
There is source to an older version of a cscope clone (called "cs") available There is source to an older version of a cscope clone (called "cs") available
on the net. Due to various reasons, this is not supported with Vim. on the net. Due to various reasons, this is not supported with Vim.
The cscope interface/support for Vim was originally written by The cscope interface/support for Vim was originally written by
Andy Kahn <ackahn@netapp.com>. The original structure (as well as a tiny Andy Kahn <ackahn@netapp.com>. The original structure (as well as a tiny
bit of code) was adapted from the cscope interface in nvi. Please report bit of code) was adapted from the cscope interface in nvi.
any problems, suggestions, patches, et al., you have for the usage of
cscope within Vim to him.
*cscope-win32* *cscope-win32*
For a cscope version for Win32 see: For a cscope version for Win32 see (seems abandonded):
http://code.google.com/p/cscope-win32/ https://code.google.com/archive/p/cscope-win32/
Win32 support was added by Sergey Khorev <sergey.khorev@gmail.com>. Contact Win32 support was added by Sergey Khorev <sergey.khorev@gmail.com>. Contact
him if you have Win32-specific issues. him if you have Win32-specific issues.

View File

@@ -1,4 +1,4 @@
*if_perl.txt* For Vim version 8.0. Last change: 2015 Oct 16 *if_perl.txt* For Vim version 8.0. Last change: 2017 Nov 24
VIM REFERENCE MANUAL by Sven Verdoolaege VIM REFERENCE MANUAL by Sven Verdoolaege
@@ -112,7 +112,7 @@ possible.
Here is an overview of the functions that are available to Perl: > Here is an overview of the functions that are available to Perl: >
:perl VIM::Msg("Text") # displays a message :perl VIM::Msg("Text") # displays a message
:perl VIM::Msg("Error", "ErrorMsg") # displays an error message :perl VIM::Msg("Wrong!", "ErrorMsg") # displays an error message
:perl VIM::Msg("remark", "Comment") # displays a highlighted message :perl VIM::Msg("remark", "Comment") # displays a highlighted message
:perl VIM::SetOption("ai") # sets a vim option :perl VIM::SetOption("ai") # sets a vim option
:perl $nbuf = VIM::Buffers() # returns the number of buffers :perl $nbuf = VIM::Buffers() # returns the number of buffers

View File

@@ -1,4 +1,4 @@
*insert.txt* For Vim version 8.0. Last change: 2017 May 30 *insert.txt* For Vim version 8.0. Last change: 2017 Nov 23
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1296,7 +1296,8 @@ it here: http://ctags.sourceforge.net/ Version 5.6 or later is recommended.
For version 5.5.4 you should add a patch that adds the "typename:" field: For version 5.5.4 you should add a patch that adds the "typename:" field:
ftp://ftp.vim.org/pub/vim/unstable/patches/ctags-5.5.4.patch ftp://ftp.vim.org/pub/vim/unstable/patches/ctags-5.5.4.patch
A compiled .exe for MS-Windows can be found at: A compiled .exe for MS-Windows can be found at:
http://georgevreilly.com/vim/ctags.html http://ctags.sourceforge.net/
https://github.com/universal-ctags/ctags-win32
If you want to complete system functions you can do something like this. Use If you want to complete system functions you can do something like this. Use
ctags to generate a tags file for all the system header files: > ctags to generate a tags file for all the system header files: >

View File

@@ -1,4 +1,4 @@
*mbyte.txt* For Vim version 8.0. Last change: 2016 Jul 21 *mbyte.txt* For Vim version 8.0. Last change: 2017 Nov 30
VIM REFERENCE MANUAL by Bram Moolenaar et al. VIM REFERENCE MANUAL by Bram Moolenaar et al.
@@ -1257,8 +1257,8 @@ Combining forms:
============================================================================== ==============================================================================
10. Input with imactivatefunc() *mbyte-func* 10. Input with imactivatefunc() *mbyte-func*
Vim has |imactivatefunc()| and |imstatusfunc()|. This is useful to Vim has the 'imactivatefunc' and 'imstatusfunc' options. These are useful to
activate/deativate input method from Vim in any way, also with an external activate/deativate the input method from Vim in any way, also with an external
command. For example, fcitx provide fcitx-remote command: > command. For example, fcitx provide fcitx-remote command: >
set iminsert=2 set iminsert=2

View File

@@ -1,4 +1,4 @@
*options.txt* For Vim version 8.0. Last change: 2017 Nov 18 *options.txt* For Vim version 8.0. Last change: 2017 Nov 26
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2634,6 +2634,9 @@ A jump table for the options with a short description can be found at |Q_op|.
vertical Start diff mode with vertical splits (unless vertical Start diff mode with vertical splits (unless
explicitly specified otherwise). explicitly specified otherwise).
hiddenoff Do not use diff mode for a buffer when it
becomes hidden.
foldcolumn:{n} Set the 'foldcolumn' option to {n} when foldcolumn:{n} Set the 'foldcolumn' option to {n} when
starting diff mode. Without this 2 is used. starting diff mode. Without this 2 is used.
@@ -4464,8 +4467,8 @@ A jump table for the options with a short description can be found at |Q_op|.
match may not be found. This is to avoid that Vim hangs while you match may not be found. This is to avoid that Vim hangs while you
are typing the pattern. are typing the pattern.
The highlighting can be set with the 'i' flag in 'highlight'. The highlighting can be set with the 'i' flag in 'highlight'.
When 'hlsearch' is on, all matched strings are highlighted too while typing When 'hlsearch' is on, all matched strings are highlighted too while
a search command. See also: 'hlsearch'. typing a search command. See also: 'hlsearch'.
If you don't want turn 'hlsearch' on, but want to highlight all matches If you don't want turn 'hlsearch' on, but want to highlight all matches
while searching, you can turn on and off 'hlsearch' with autocmd. while searching, you can turn on and off 'hlsearch' with autocmd.
Example: > Example: >
@@ -6119,9 +6122,10 @@ A jump table for the options with a short description can be found at |Q_op|.
geom pixelGeometry int 0 - 2 (see below) geom pixelGeometry int 0 - 2 (see below)
renmode renderingMode int 0 - 6 (see below) renmode renderingMode int 0 - 6 (see below)
taamode textAntialiasMode int 0 - 3 (see below) taamode textAntialiasMode int 0 - 3 (see below)
scrlines Scroll Lines int >= 0 (see below)
See this URL for detail: See this URL for detail (except for scrlines):
http://msdn.microsoft.com/en-us/library/dd368190.aspx https://msdn.microsoft.com/en-us/library/dd368190.aspx
For geom: structure of a device pixel. For geom: structure of a device pixel.
0 - DWRITE_PIXEL_GEOMETRY_FLAT 0 - DWRITE_PIXEL_GEOMETRY_FLAT
@@ -6129,7 +6133,7 @@ A jump table for the options with a short description can be found at |Q_op|.
2 - DWRITE_PIXEL_GEOMETRY_BGR 2 - DWRITE_PIXEL_GEOMETRY_BGR
See this URL for detail: See this URL for detail:
http://msdn.microsoft.com/en-us/library/dd368114.aspx https://msdn.microsoft.com/en-us/library/dd368114.aspx
For renmode: method of rendering glyphs. For renmode: method of rendering glyphs.
0 - DWRITE_RENDERING_MODE_DEFAULT 0 - DWRITE_RENDERING_MODE_DEFAULT
@@ -6141,7 +6145,7 @@ A jump table for the options with a short description can be found at |Q_op|.
6 - DWRITE_RENDERING_MODE_OUTLINE 6 - DWRITE_RENDERING_MODE_OUTLINE
See this URL for detail: See this URL for detail:
http://msdn.microsoft.com/en-us/library/dd368118.aspx https://msdn.microsoft.com/en-us/library/dd368118.aspx
For taamode: antialiasing mode used for drawing text. For taamode: antialiasing mode used for drawing text.
0 - D2D1_TEXT_ANTIALIAS_MODE_DEFAULT 0 - D2D1_TEXT_ANTIALIAS_MODE_DEFAULT
@@ -6150,7 +6154,25 @@ A jump table for the options with a short description can be found at |Q_op|.
3 - D2D1_TEXT_ANTIALIAS_MODE_ALIASED 3 - D2D1_TEXT_ANTIALIAS_MODE_ALIASED
See this URL for detail: See this URL for detail:
http://msdn.microsoft.com/en-us/library/dd368170.aspx https://msdn.microsoft.com/en-us/library/dd368170.aspx
For scrlines: threshold for lines to be scrolled.
0 - Always use scrolling. (default)
1 - Use full page redrawing.
> 1 - If the lines to be scrolled is grater or equal to the
specified value, use redrawing. Otherwise use
scrolling.
If you feel scrolling a page (CTRL-F) is too slow with DirectX
renderer, try this "scrlines" option.
When set it "1", Vim uses full page redrawing instead of
scrolling. Redrawing a page is faster than scrolling a
page in some environments.
After that, when you feel scrolling lines (CTRL-Y) becomes
slow, please try "2" or greater value for this option.
It works threshold line number to switch scrolling to
redrawing. Scrolling a few lines might be faster than
redrawing a page in some environments.
Example: > Example: >
set encoding=utf-8 set encoding=utf-8
@@ -6159,13 +6181,12 @@ A jump table for the options with a short description can be found at |Q_op|.
< <
If select a raster font (Courier, Terminal or FixedSys which If select a raster font (Courier, Terminal or FixedSys which
have ".fon" extension in file name) to 'guifont', it will be have ".fon" extension in file name) to 'guifont', it will be
drawn by GDI as a fallback. This fallback will cause drawn by GDI as a fallback.
significant slow down on drawing.
NOTE: It is known that some fonts and options combination NOTE: It is known that some fonts and options combination
causes trouble on drawing glyphs. causes trouble on drawing glyphs.
- 'rendmode:5' and 'renmode:6' will not work with some - 'renmode:5' and 'renmode:6' will not work with some
special made fonts (True-Type fonts which includes only special made fonts (True-Type fonts which includes only
bitmap glyphs). bitmap glyphs).
- 'taamode:3' will not work with some vector fonts. - 'taamode:3' will not work with some vector fonts.
@@ -8255,7 +8276,7 @@ A jump table for the options with a short description can be found at |Q_op|.
number, more intelligent detection process runs. number, more intelligent detection process runs.
The "xterm2" value will be set if the xterm version is reported to be The "xterm2" value will be set if the xterm version is reported to be
from 95 to 276. The "sgr" value will be set if the xterm version is from 95 to 276. The "sgr" value will be set if the xterm version is
277 or highter and when Vim detects Mac Terminal.app or Iterm2. 277 or higher and when Vim detects Mac Terminal.app or iTerm2.
If you do not want 'ttymouse' to be set to "xterm2" or "sgr" If you do not want 'ttymouse' to be set to "xterm2" or "sgr"
automatically, set t_RV to an empty string: > automatically, set t_RV to an empty string: >
:set t_RV= :set t_RV=

View File

@@ -7346,6 +7346,7 @@ mbyte-encoding mbyte.txt /*mbyte-encoding*
mbyte-first mbyte.txt /*mbyte-first* mbyte-first mbyte.txt /*mbyte-first*
mbyte-fonts-MSwin mbyte.txt /*mbyte-fonts-MSwin* mbyte-fonts-MSwin mbyte.txt /*mbyte-fonts-MSwin*
mbyte-fonts-X11 mbyte.txt /*mbyte-fonts-X11* mbyte-fonts-X11 mbyte.txt /*mbyte-fonts-X11*
mbyte-func mbyte.txt /*mbyte-func*
mbyte-keymap mbyte.txt /*mbyte-keymap* mbyte-keymap mbyte.txt /*mbyte-keymap*
mbyte-locale mbyte.txt /*mbyte-locale* mbyte-locale mbyte.txt /*mbyte-locale*
mbyte-options mbyte.txt /*mbyte-options* mbyte-options mbyte.txt /*mbyte-options*

View File

@@ -1,4 +1,4 @@
*todo.txt* For Vim version 8.0. Last change: 2017 Nov 21 *todo.txt* For Vim version 8.0. Last change: 2017 Nov 29
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -35,6 +35,13 @@ entered there will not be repeated below, unless there is extra information.
*known-bugs* *known-bugs*
-------------------- Known bugs and current work ----------------------- -------------------- Known bugs and current work -----------------------
Motif testgui:
From test_options.vim:
Found errors in Test_set_values():
Caught exception in Test_set_values(): Vim(set):E596: Invalid font(s): guifont=fixedsys @ /home/mool/vim/vim80/src/testdir/opt_test.vim, line 1153
WinBar: balloon shows up for next line
No maintainer for Vietnamese translations. No maintainer for Vietnamese translations.
No maintainer for Simplified Chinese translations. No maintainer for Simplified Chinese translations.
@@ -150,8 +157,17 @@ Compiler warnings (geeknik, 2017 Oct 26):
- signed integer overflow in nfa_regatom() (#2251) - signed integer overflow in nfa_regatom() (#2251)
- undefined left shift in get_string_tv() (#2250) - undefined left shift in get_string_tv() (#2250)
Patch to use imactivatefunc() also without +xim feature. (Yasuhiro Matsumoto, patch for: fix SHIFT-Insert on Windows command prompt (Yasuhiro Matsumoto,
2017 Nov 19, #2349) #2381)
Patch for profile log truncating halfway a character. (ichizok, 2017 Nov 28,
#2385)
WinBar: Maximizing window causes window size to be wrong. (Lifepillar, 2017
Nov 29, #2356)
CTRL-A does not work with empty line. (Alex, #2387)
Patch by Hirohito Higashi, 2017 Nov 29.
'hlsearch' shows empty matches, which means highlighting everything. 'hlsearch' shows empty matches, which means highlighting everything.
Don't do that. For "foo\|" or "\v" Don't do that. For "foo\|" or "\v"
@@ -171,12 +187,6 @@ With foldmethod=syntax and nofoldenable comment highlighting isn't removed.
Using 'wildignore' also applies to literally entered file name. Also with Using 'wildignore' also applies to literally entered file name. Also with
:drop (remote commands). :drop (remote commands).
Race condition between stat() and open() in write_viminfo(). Use open() in the
loop and try another name instead of using a temp file. (Simon Ruderich)
The first one, when viminfo is new, should just fail if it creating with
O_EXCL fails.
Also use umask instead of mch_fopen() after vim_tempname().
"gvim --remote" from a directory with non-word characters changes the current "gvim --remote" from a directory with non-word characters changes the current
directory (Paulo Marcel Coelho Arabic, 2017 Oct 30, #2266) directory (Paulo Marcel Coelho Arabic, 2017 Oct 30, #2266)
Also see #1689. Also see #1689.
@@ -184,6 +194,9 @@ Also see #1689.
ml_get error when using a Python. (Yggdroot, 2017 Jun 1, #1737) ml_get error when using a Python. (Yggdroot, 2017 Jun 1, #1737)
Lemonboy can reproduce (2017 Jun 5) Lemonboy can reproduce (2017 Jun 5)
Patch to fix E806. (Dominique, 2017 Nov 22, #2368)
Kazunobu Kuriyama: caused by XtSetLanguageProc().
Invalid range error when using BufWinLeave for closing terminal. Invalid range error when using BufWinLeave for closing terminal.
(Gabriel Barta, 2017 Nov 15, #2339) (Gabriel Barta, 2017 Nov 15, #2339)
@@ -208,7 +221,7 @@ Patch to fix cmdline abbreviation after '<,'>. (Christian Brabandt, 2017 Nov
Patch to add TextDeletePost and TextYankPost events. (Philippe Vaucher, 2011 Patch to add TextDeletePost and TextYankPost events. (Philippe Vaucher, 2011
May 24) Update May 26. May 24) Update May 26.
Now in patch by Lemonboy, #2333 (who is Lemonboy?) Now in patch by Lemonboy, #2333
Default install on MS-Windows should source defaults.vim. Default install on MS-Windows should source defaults.vim.
Ask whether to use Windows or Vim key behavior? Ask whether to use Windows or Vim key behavior?

View File

@@ -1,4 +1,4 @@
*version8.txt* For Vim version 8.0. Last change: 2017 Apr 23 *version8.txt* For Vim version 8.0. Last change: 2017 Nov 24
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -15582,7 +15582,7 @@ Files: src/json.c, src/testdir/test_json.vim
Patch 8.0.0181 Patch 8.0.0181
Problem: When 'cursorbind' and 'cursorcolumn' are both on, the column Problem: When 'cursorbind' and 'cursorcolumn' are both on, the column
highlignt in non-current windows is wrong. highlight in non-current windows is wrong.
Solution: Add validate_cursor(). (Masanori Misono, closes #1372) Solution: Add validate_cursor(). (Masanori Misono, closes #1372)
Files: src/move.c Files: src/move.c

View File

@@ -1,7 +1,7 @@
" Vim support file to detect file types " Vim support file to detect file types
" "
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2017 Nov 21 " Last Change: 2017 Nov 23
" Listen very carefully, I will say this only once " Listen very carefully, I will say this only once
if exists("did_load_filetypes") if exists("did_load_filetypes")
@@ -1878,8 +1878,8 @@ au BufNewFile,BufRead *.yy,*.yxx,*.y++ setf yacc
" Yacc or racc " Yacc or racc
au BufNewFile,BufRead *.y call dist#ft#FTy() au BufNewFile,BufRead *.y call dist#ft#FTy()
" Yaml " Yaml or Raml
au BufNewFile,BufRead *.yaml,*.yml setf yaml au BufNewFile,BufRead *.yaml,*.yml,*.raml setf yaml
" yum conf (close enough to dosini) " yum conf (close enough to dosini)
au BufNewFile,BufRead */etc/yum.conf setf dosini au BufNewFile,BufRead */etc/yum.conf setf dosini

View File

@@ -2,7 +2,7 @@
" Language: Zsh shell script " Language: Zsh shell script
" Maintainer: Christian Brabandt <cb@256bit.org> " Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se> " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2015-05-29 " Latest Revision: 2017-11-22
" License: Vim (see :h license) " License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-zsh " Repository: https://github.com/chrisbra/vim-zsh
@@ -18,9 +18,7 @@ let b:undo_ftplugin = "setl com< cms< fo<"
setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
let b:match_words = let b:match_words = ',\<if\>:\<elif\>:\<else\>:\<fi\>'
\ &matchpairs
\ . ',\<if\>:\<elif\>:\<else\>:\<fi\>'
\ . ',\<case\>:^\s*([^)]*):\<esac\>' \ . ',\<case\>:^\s*([^)]*):\<esac\>'
\ . ',\<\%(select\|while\|until\|repeat\|for\%(each\)\=\)\>:\<done\>' \ . ',\<\%(select\|while\|until\|repeat\|for\%(each\)\=\)\>:\<done\>'
let b:match_skip = 's:comment\|string\|heredoc\|subst' let b:match_skip = 's:comment\|string\|heredoc\|subst'

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
" Language: Zsh shell script " Language: Zsh shell script
" Maintainer: Christian Brabandt <cb@256bit.org> " Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se> " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2017-07-11 " Latest Revision: 2017-11-22
" License: Vim (see :h license) " License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-zsh " Repository: https://github.com/chrisbra/vim-zsh
@@ -324,9 +324,9 @@ syn match zshOption /
\ \%(\%(\<no_\?\)\?vi\>\)\| \ \%(\%(\<no_\?\)\?vi\>\)\|
\ \%(\%(\<no_\?\)\?warncreateglobal\>\)\|\%(\%(no_\?\)\?warn_create_global\>\)\| \ \%(\%(\<no_\?\)\?warncreateglobal\>\)\|\%(\%(no_\?\)\?warn_create_global\>\)\|
\ \%(\%(\<no_\?\)\?xtrace\>\)\| \ \%(\%(\<no_\?\)\?xtrace\>\)\|
\ \%(\%(\<no_\?\)\?zle\>\)/ nextgroup=zshOption skipwhite contained \ \%(\%(\<no_\?\)\?zle\>\)/ nextgroup=zshOption,zshComment skipwhite contained
syn keyword zshTypes float integer local typeset declare private syn keyword zshTypes float integer local typeset declare private readonly
" XXX: this may be too much " XXX: this may be too much
" syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+' " syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+'

View File

@@ -50,7 +50,7 @@ get_beval_info(
} }
#endif #endif
wp = mouse_find_win(&row, &col); wp = mouse_find_win(&row, &col);
if (wp != NULL && row < wp->w_height && col < wp->w_width) if (wp != NULL && row >= 0 && row < wp->w_height && col < wp->w_width)
{ {
/* Found a window and the cursor is in the text. Now find the line /* Found a window and the cursor is in the text. Now find the line
* number. */ * number. */

View File

@@ -593,6 +593,11 @@ aucmd_abort:
if (buf->b_nwindows > 0) if (buf->b_nwindows > 0)
--buf->b_nwindows; --buf->b_nwindows;
#ifdef FEAT_DIFF
if (diffopt_hiddenoff() && !unload_buf && buf->b_nwindows == 0)
diff_buf_delete(buf); /* Clear 'diff' for hidden buffer. */
#endif
/* Return when a window is displaying the buffer or when it's not /* Return when a window is displaying the buffer or when it's not
* unloaded. */ * unloaded. */
if (buf->b_nwindows > 0 || !unload_buf) if (buf->b_nwindows > 0 || !unload_buf)

View File

@@ -23,6 +23,7 @@ static int diff_busy = FALSE; /* ex_diffgetput() is busy */
#define DIFF_IWHITE 4 /* ignore change in white space */ #define DIFF_IWHITE 4 /* ignore change in white space */
#define DIFF_HORIZONTAL 8 /* horizontal splits */ #define DIFF_HORIZONTAL 8 /* horizontal splits */
#define DIFF_VERTICAL 16 /* vertical splits */ #define DIFF_VERTICAL 16 /* vertical splits */
#define DIFF_HIDDEN_OFF 32 /* diffoff when hidden */
static int diff_flags = DIFF_FILLER; static int diff_flags = DIFF_FILLER;
#define LBUFLEN 50 /* length of line in diff file */ #define LBUFLEN 50 /* length of line in diff file */
@@ -1924,6 +1925,11 @@ diffopt_changed(void)
p += 11; p += 11;
diff_foldcolumn_new = getdigits(&p); diff_foldcolumn_new = getdigits(&p);
} }
else if (STRNCMP(p, "hiddenoff", 9) == 0)
{
p += 9;
diff_flags_new |= DIFF_HIDDEN_OFF;
}
if (*p != ',' && *p != NUL) if (*p != ',' && *p != NUL)
return FAIL; return FAIL;
if (*p == ',') if (*p == ',')
@@ -1961,6 +1967,15 @@ diffopt_horizontal(void)
return (diff_flags & DIFF_HORIZONTAL) != 0; return (diff_flags & DIFF_HORIZONTAL) != 0;
} }
/*
* Return TRUE if 'diffopt' contains "hiddenoff".
*/
int
diffopt_hiddenoff(void)
{
return (diff_flags & DIFF_HIDDEN_OFF) != 0;
}
/* /*
* Find the difference within a changed line. * Find the difference within a changed line.
* Returns TRUE if the line was added, no other buffer has it. * Returns TRUE if the line was added, no other buffer has it.

View File

@@ -441,6 +441,7 @@ static void f_win_getid(typval_T *argvars, typval_T *rettv);
static void f_win_gotoid(typval_T *argvars, typval_T *rettv); static void f_win_gotoid(typval_T *argvars, typval_T *rettv);
static void f_win_id2tabwin(typval_T *argvars, typval_T *rettv); static void f_win_id2tabwin(typval_T *argvars, typval_T *rettv);
static void f_win_id2win(typval_T *argvars, typval_T *rettv); static void f_win_id2win(typval_T *argvars, typval_T *rettv);
static void f_win_screenpos(typval_T *argvars, typval_T *rettv);
static void f_winbufnr(typval_T *argvars, typval_T *rettv); static void f_winbufnr(typval_T *argvars, typval_T *rettv);
static void f_wincol(typval_T *argvars, typval_T *rettv); static void f_wincol(typval_T *argvars, typval_T *rettv);
static void f_winheight(typval_T *argvars, typval_T *rettv); static void f_winheight(typval_T *argvars, typval_T *rettv);
@@ -899,6 +900,7 @@ static struct fst
{"win_gotoid", 1, 1, f_win_gotoid}, {"win_gotoid", 1, 1, f_win_gotoid},
{"win_id2tabwin", 1, 1, f_win_id2tabwin}, {"win_id2tabwin", 1, 1, f_win_id2tabwin},
{"win_id2win", 1, 1, f_win_id2win}, {"win_id2win", 1, 1, f_win_id2win},
{"win_screenpos", 1, 1, f_win_screenpos},
{"winbufnr", 1, 1, f_winbufnr}, {"winbufnr", 1, 1, f_winbufnr},
{"wincol", 0, 0, f_wincol}, {"wincol", 0, 0, f_wincol},
{"winheight", 1, 1, f_winheight}, {"winheight", 1, 1, f_winheight},
@@ -5378,6 +5380,22 @@ f_win_id2win(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = win_id2win(argvars); rettv->vval.v_number = win_id2win(argvars);
} }
/*
* "win_screenpos()" function
*/
static void
f_win_screenpos(typval_T *argvars, typval_T *rettv)
{
win_T *wp;
if (rettv_list_alloc(rettv) == FAIL)
return;
wp = find_win_by_nr(&argvars[0], NULL);
list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_winrow + 1);
list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_wincol + 1);
}
/* /*
* "getwinposx()" function * "getwinposx()" function
*/ */

View File

@@ -1834,6 +1834,26 @@ script_dump_profile(FILE *fd)
{ {
if (vim_fgets(IObuff, IOSIZE, sfd)) if (vim_fgets(IObuff, IOSIZE, sfd))
break; break;
/* When a line has been truncated, append NL, taking care
* of multi-byte characters . */
if (IObuff[IOSIZE - 2] != NUL && IObuff[IOSIZE - 2] != NL)
{
int n = IOSIZE - 2;
# ifdef FEAT_MBYTE
if (enc_utf8)
{
/* Move to the first byte of this char.
* utf_head_off() doesn't work, because it checks
* for a truncated character. */
while (n > 0 && (IObuff[n] & 0xc0) == 0x80)
--n;
}
else if (has_mbyte)
n -= mb_head_off(IObuff, IObuff + n);
# endif
IObuff[n] = NL;
IObuff[n + 1] = NUL;
}
if (i < si->sn_prl_ga.ga_len if (i < si->sn_prl_ga.ga_len
&& (pp = &PRL_ITEM(si, i))->snp_count > 0) && (pp = &PRL_ITEM(si, i))->snp_count > 0)
{ {

View File

@@ -263,14 +263,24 @@ private:
} }
}; };
enum DrawingMode {
DM_GDI = 0,
DM_DIRECTX = 1,
DM_INTEROP = 2,
};
struct DWriteContext { struct DWriteContext {
HDC mHDC; HDC mHDC;
RECT mBindRect;
DrawingMode mDMode;
HDC mInteropHDC;
bool mDrawing; bool mDrawing;
bool mFallbackDC; bool mFallbackDC;
ID2D1Factory *mD2D1Factory; ID2D1Factory *mD2D1Factory;
ID2D1DCRenderTarget *mRT; ID2D1DCRenderTarget *mRT;
ID2D1GdiInteropRenderTarget *mGDIRT;
ID2D1SolidColorBrush *mBrush; ID2D1SolidColorBrush *mBrush;
IDWriteFactory *mDWriteFactory; IDWriteFactory *mDWriteFactory;
@@ -292,6 +302,10 @@ struct DWriteContext {
virtual ~DWriteContext(); virtual ~DWriteContext();
HRESULT CreateDeviceResources();
void DiscardDeviceResources();
HRESULT CreateTextFormatFromLOGFONT(const LOGFONTW &logFont, HRESULT CreateTextFormatFromLOGFONT(const LOGFONTW &logFont,
IDWriteTextFormat **ppTextFormat); IDWriteTextFormat **ppTextFormat);
@@ -299,17 +313,21 @@ struct DWriteContext {
void SetFont(HFONT hFont); void SetFont(HFONT hFont);
void BindDC(HDC hdc, RECT *rect); void BindDC(HDC hdc, const RECT *rect);
void AssureDrawing(); HRESULT SetDrawingMode(DrawingMode mode);
ID2D1Brush* SolidBrush(COLORREF color); ID2D1Brush* SolidBrush(COLORREF color);
void DrawText(const WCHAR* text, int len, void DrawText(const WCHAR *text, int len,
int x, int y, int w, int h, int cellWidth, COLORREF color, int x, int y, int w, int h, int cellWidth, COLORREF color,
UINT fuOptions, CONST RECT *lprc, CONST INT * lpDx); UINT fuOptions, const RECT *lprc, const INT *lpDx);
void FillRect(RECT *rc, COLORREF color); void FillRect(const RECT *rc, COLORREF color);
void DrawLine(int x1, int y1, int x2, int y2, COLORREF color);
void SetPixel(int x, int y, COLORREF color);
void Flush(); void Flush();
@@ -561,10 +579,14 @@ private:
DWriteContext::DWriteContext() : DWriteContext::DWriteContext() :
mHDC(NULL), mHDC(NULL),
mBindRect(),
mDMode(DM_GDI),
mInteropHDC(NULL),
mDrawing(false), mDrawing(false),
mFallbackDC(false), mFallbackDC(false),
mD2D1Factory(NULL), mD2D1Factory(NULL),
mRT(NULL), mRT(NULL),
mGDIRT(NULL),
mBrush(NULL), mBrush(NULL),
mDWriteFactory(NULL), mDWriteFactory(NULL),
mDWriteFactory2(NULL), mDWriteFactory2(NULL),
@@ -584,25 +606,7 @@ DWriteContext::DWriteContext() :
_RPT2(_CRT_WARN, "D2D1CreateFactory: hr=%p p=%p\n", hr, mD2D1Factory); _RPT2(_CRT_WARN, "D2D1CreateFactory: hr=%p p=%p\n", hr, mD2D1Factory);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ hr = CreateDeviceResources();
D2D1_RENDER_TARGET_PROPERTIES props = {
D2D1_RENDER_TARGET_TYPE_DEFAULT,
{ DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE },
0, 0,
D2D1_RENDER_TARGET_USAGE_NONE,
D2D1_FEATURE_LEVEL_DEFAULT
};
hr = mD2D1Factory->CreateDCRenderTarget(&props, &mRT);
_RPT2(_CRT_WARN, "CreateDCRenderTarget: hr=%p p=%p\n", hr, mRT);
}
if (SUCCEEDED(hr))
{
hr = mRT->CreateSolidColorBrush(
D2D1::ColorF(D2D1::ColorF::Black),
&mBrush);
_RPT2(_CRT_WARN, "CreateSolidColorBrush: hr=%p p=%p\n", hr, mBrush);
}
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
@@ -645,10 +649,66 @@ DWriteContext::~DWriteContext()
SafeRelease(&mDWriteFactory); SafeRelease(&mDWriteFactory);
SafeRelease(&mDWriteFactory2); SafeRelease(&mDWriteFactory2);
SafeRelease(&mBrush); SafeRelease(&mBrush);
SafeRelease(&mGDIRT);
SafeRelease(&mRT); SafeRelease(&mRT);
SafeRelease(&mD2D1Factory); SafeRelease(&mD2D1Factory);
} }
HRESULT
DWriteContext::CreateDeviceResources()
{
HRESULT hr;
if (mRT != NULL)
return S_OK;
D2D1_RENDER_TARGET_PROPERTIES props = {
D2D1_RENDER_TARGET_TYPE_DEFAULT,
{ DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE },
0, 0,
D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE,
D2D1_FEATURE_LEVEL_DEFAULT
};
hr = mD2D1Factory->CreateDCRenderTarget(&props, &mRT);
_RPT2(_CRT_WARN, "CreateDCRenderTarget: hr=%p p=%p\n", hr, mRT);
if (SUCCEEDED(hr))
{
// This always succeeds.
mRT->QueryInterface(
__uuidof(ID2D1GdiInteropRenderTarget),
reinterpret_cast<void**>(&mGDIRT));
_RPT1(_CRT_WARN, "GdiInteropRenderTarget: p=%p\n", mGDIRT);
}
if (SUCCEEDED(hr))
{
hr = mRT->CreateSolidColorBrush(
D2D1::ColorF(D2D1::ColorF::Black),
&mBrush);
_RPT2(_CRT_WARN, "CreateSolidColorBrush: hr=%p p=%p\n", hr, mBrush);
}
if (SUCCEEDED(hr))
{
if (mHDC != NULL)
{
mRT->BindDC(mHDC, &mBindRect);
mRT->SetTransform(D2D1::IdentityMatrix());
}
}
return hr;
}
void
DWriteContext::DiscardDeviceResources()
{
SafeRelease(&mBrush);
SafeRelease(&mGDIRT);
SafeRelease(&mRT);
}
HRESULT HRESULT
DWriteContext::CreateTextFormatFromLOGFONT(const LOGFONTW &logFont, DWriteContext::CreateTextFormatFromLOGFONT(const LOGFONTW &logFont,
IDWriteTextFormat **ppTextFormat) IDWriteTextFormat **ppTextFormat)
@@ -817,27 +877,77 @@ DWriteContext::SetFont(HFONT hFont)
item.pTextFormat = mTextFormat; item.pTextFormat = mTextFormat;
item.fontWeight = mFontWeight; item.fontWeight = mFontWeight;
item.fontStyle = mFontStyle; item.fontStyle = mFontStyle;
mFallbackDC = false;
} }
else
mFallbackDC = true;
mFontCache.put(item); mFontCache.put(item);
} }
void void
DWriteContext::BindDC(HDC hdc, RECT *rect) DWriteContext::BindDC(HDC hdc, const RECT *rect)
{ {
Flush(); Flush();
mRT->BindDC(hdc, rect); mRT->BindDC(hdc, rect);
mRT->SetTransform(D2D1::IdentityMatrix()); mRT->SetTransform(D2D1::IdentityMatrix());
mHDC = hdc; mHDC = hdc;
mBindRect = *rect;
} }
void HRESULT
DWriteContext::AssureDrawing() DWriteContext::SetDrawingMode(DrawingMode mode)
{ {
if (mDrawing == false) HRESULT hr = S_OK;
switch (mode)
{ {
mRT->BeginDraw(); default:
mDrawing = true; case DM_GDI:
if (mInteropHDC != NULL)
{
mGDIRT->ReleaseDC(NULL);
mInteropHDC = NULL;
}
if (mDrawing)
{
hr = mRT->EndDraw();
if (hr == D2DERR_RECREATE_TARGET)
{
hr = S_OK;
DiscardDeviceResources();
CreateDeviceResources();
}
mDrawing = false;
}
break;
case DM_DIRECTX:
if (mInteropHDC != NULL)
{
mGDIRT->ReleaseDC(NULL);
mInteropHDC = NULL;
}
else if (mDrawing == false)
{
CreateDeviceResources();
mRT->BeginDraw();
mDrawing = true;
}
break;
case DM_INTEROP:
if (mDrawing == false)
{
CreateDeviceResources();
mRT->BeginDraw();
mDrawing = true;
}
if (mInteropHDC == NULL)
hr = mGDIRT->GetDC(D2D1_DC_INITIALIZE_MODE_COPY, &mInteropHDC);
break;
} }
mDMode = mode;
return hr;
} }
ID2D1Brush* ID2D1Brush*
@@ -849,22 +959,31 @@ DWriteContext::SolidBrush(COLORREF color)
} }
void void
DWriteContext::DrawText(const WCHAR* text, int len, DWriteContext::DrawText(const WCHAR *text, int len,
int x, int y, int w, int h, int cellWidth, COLORREF color, int x, int y, int w, int h, int cellWidth, COLORREF color,
UINT fuOptions, CONST RECT *lprc, CONST INT * lpDx) UINT fuOptions, const RECT *lprc, const INT *lpDx)
{ {
if (mFallbackDC) if (mFallbackDC)
{ {
Flush(); // Fall back to GDI rendering.
ExtTextOutW(mHDC, x, y, fuOptions, lprc, text, len, lpDx); HRESULT hr = SetDrawingMode(DM_INTEROP);
if (SUCCEEDED(hr))
{
HGDIOBJ hFont = ::GetCurrentObject(mHDC, OBJ_FONT);
HGDIOBJ hOldFont = ::SelectObject(mInteropHDC, hFont);
::SetTextColor(mInteropHDC, color);
::SetBkMode(mInteropHDC, ::GetBkMode(mHDC));
::ExtTextOutW(mInteropHDC, x, y, fuOptions, lprc, text, len, lpDx);
::SelectObject(mInteropHDC, hOldFont);
}
return; return;
} }
AssureDrawing();
HRESULT hr; HRESULT hr;
IDWriteTextLayout *textLayout = NULL; IDWriteTextLayout *textLayout = NULL;
SetDrawingMode(DM_DIRECTX);
hr = mDWriteFactory->CreateTextLayout(text, len, mTextFormat, hr = mDWriteFactory->CreateTextLayout(text, len, mTextFormat,
FLOAT(w), FLOAT(h), &textLayout); FLOAT(w), FLOAT(h), &textLayout);
@@ -883,23 +1002,74 @@ DWriteContext::DrawText(const WCHAR* text, int len,
} }
void void
DWriteContext::FillRect(RECT *rc, COLORREF color) DWriteContext::FillRect(const RECT *rc, COLORREF color)
{ {
AssureDrawing(); if (mDMode == DM_INTEROP)
mRT->FillRectangle( {
D2D1::RectF(FLOAT(rc->left), FLOAT(rc->top), // GDI functions are used before this call. Keep using GDI.
FLOAT(rc->right), FLOAT(rc->bottom)), // (Switching to Direct2D causes terrible slowdown.)
SolidBrush(color)); HBRUSH hbr = ::CreateSolidBrush(color);
::FillRect(mInteropHDC, rc, hbr);
::DeleteObject(HGDIOBJ(hbr));
}
else
{
SetDrawingMode(DM_DIRECTX);
mRT->FillRectangle(
D2D1::RectF(FLOAT(rc->left), FLOAT(rc->top),
FLOAT(rc->right), FLOAT(rc->bottom)),
SolidBrush(color));
}
}
void
DWriteContext::DrawLine(int x1, int y1, int x2, int y2, COLORREF color)
{
if (mDMode == DM_INTEROP)
{
// GDI functions are used before this call. Keep using GDI.
// (Switching to Direct2D causes terrible slowdown.)
HPEN hpen = ::CreatePen(PS_SOLID, 1, color);
HGDIOBJ old_pen = ::SelectObject(mInteropHDC, HGDIOBJ(hpen));
::MoveToEx(mInteropHDC, x1, y1, NULL);
::LineTo(mInteropHDC, x2, y2);
::SelectObject(mInteropHDC, old_pen);
::DeleteObject(HGDIOBJ(hpen));
}
else
{
SetDrawingMode(DM_DIRECTX);
mRT->DrawLine(
D2D1::Point2F(FLOAT(x1), FLOAT(y1) + 0.5f),
D2D1::Point2F(FLOAT(x2), FLOAT(y2) + 0.5f),
SolidBrush(color));
}
}
void
DWriteContext::SetPixel(int x, int y, COLORREF color)
{
if (mDMode == DM_INTEROP)
{
// GDI functions are used before this call. Keep using GDI.
// (Switching to Direct2D causes terrible slowdown.)
::SetPixel(mInteropHDC, x, y, color);
}
else
{
SetDrawingMode(DM_DIRECTX);
// Direct2D doesn't have SetPixel API. Use DrawLine instead.
mRT->DrawLine(
D2D1::Point2F(FLOAT(x), FLOAT(y) + 0.5f),
D2D1::Point2F(FLOAT(x+1), FLOAT(y) + 0.5f),
SolidBrush(color));
}
} }
void void
DWriteContext::Flush() DWriteContext::Flush()
{ {
if (mDrawing) SetDrawingMode(DM_GDI);
{
mRT->EndDraw();
mDrawing = false;
}
} }
void void
@@ -1000,7 +1170,7 @@ DWriteContext_Open(void)
} }
void void
DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, RECT *rect) DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, const RECT *rect)
{ {
if (ctx != NULL) if (ctx != NULL)
ctx->BindDC(hdc, rect); ctx->BindDC(hdc, rect);
@@ -1016,7 +1186,7 @@ DWriteContext_SetFont(DWriteContext *ctx, HFONT hFont)
void void
DWriteContext_DrawText( DWriteContext_DrawText(
DWriteContext *ctx, DWriteContext *ctx,
const WCHAR* text, const WCHAR *text,
int len, int len,
int x, int x,
int y, int y,
@@ -1025,8 +1195,8 @@ DWriteContext_DrawText(
int cellWidth, int cellWidth,
COLORREF color, COLORREF color,
UINT fuOptions, UINT fuOptions,
CONST RECT *lprc, const RECT *lprc,
CONST INT * lpDx) const INT *lpDx)
{ {
if (ctx != NULL) if (ctx != NULL)
ctx->DrawText(text, len, x, y, w, h, cellWidth, color, ctx->DrawText(text, len, x, y, w, h, cellWidth, color,
@@ -1034,12 +1204,27 @@ DWriteContext_DrawText(
} }
void void
DWriteContext_FillRect(DWriteContext *ctx, RECT *rc, COLORREF color) DWriteContext_FillRect(DWriteContext *ctx, const RECT *rc, COLORREF color)
{ {
if (ctx != NULL) if (ctx != NULL)
ctx->FillRect(rc, color); ctx->FillRect(rc, color);
} }
void
DWriteContext_DrawLine(DWriteContext *ctx, int x1, int y1, int x2, int y2,
COLORREF color)
{
if (ctx != NULL)
ctx->DrawLine(x1, y1, x2, y2, color);
}
void
DWriteContext_SetPixel(DWriteContext *ctx, int x, int y, COLORREF color)
{
if (ctx != NULL)
ctx->SetPixel(x, y, color);
}
void void
DWriteContext_Flush(DWriteContext *ctx) DWriteContext_Flush(DWriteContext *ctx)
{ {

View File

@@ -55,11 +55,11 @@ void DWrite_Init(void);
void DWrite_Final(void); void DWrite_Final(void);
DWriteContext *DWriteContext_Open(void); DWriteContext *DWriteContext_Open(void);
void DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, RECT *rect); void DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, const RECT *rect);
void DWriteContext_SetFont(DWriteContext *ctx, HFONT hFont); void DWriteContext_SetFont(DWriteContext *ctx, HFONT hFont);
void DWriteContext_DrawText( void DWriteContext_DrawText(
DWriteContext *ctx, DWriteContext *ctx,
const WCHAR* text, const WCHAR *text,
int len, int len,
int x, int x,
int y, int y,
@@ -68,9 +68,12 @@ void DWriteContext_DrawText(
int cellWidth, int cellWidth,
COLORREF color, COLORREF color,
UINT fuOptions, UINT fuOptions,
CONST RECT *lprc, const RECT *lprc,
CONST INT * lpDx); const INT *lpDx);
void DWriteContext_FillRect(DWriteContext *ctx, RECT *rc, COLORREF color); void DWriteContext_FillRect(DWriteContext *ctx, const RECT *rc, COLORREF color);
void DWriteContext_DrawLine(DWriteContext *ctx, int x1, int y1, int x2, int y2,
COLORREF color);
void DWriteContext_SetPixel(DWriteContext *ctx, int x, int y, COLORREF color);
void DWriteContext_Flush(DWriteContext *ctx); void DWriteContext_Flush(DWriteContext *ctx);
void DWriteContext_Close(DWriteContext *ctx); void DWriteContext_Close(DWriteContext *ctx);

View File

@@ -33,6 +33,7 @@
static DWriteContext *s_dwc = NULL; static DWriteContext *s_dwc = NULL;
static int s_directx_enabled = 0; static int s_directx_enabled = 0;
static int s_directx_load_attempted = 0; static int s_directx_load_attempted = 0;
static int s_directx_scrlines = 0;
# define IS_ENABLE_DIRECTX() (s_directx_enabled && s_dwc != NULL) # define IS_ENABLE_DIRECTX() (s_directx_enabled && s_dwc != NULL)
static int directx_enabled(void); static int directx_enabled(void);
static void directx_binddc(void); static void directx_binddc(void);
@@ -57,6 +58,7 @@ gui_mch_set_rendering_options(char_u *s)
int dx_geom = 0; int dx_geom = 0;
int dx_renmode = 0; int dx_renmode = 0;
int dx_taamode = 0; int dx_taamode = 0;
int dx_scrlines = 0;
/* parse string as rendering options. */ /* parse string as rendering options. */
for (p = s; p != NULL && *p != NUL; ) for (p = s; p != NULL && *p != NUL; )
@@ -117,10 +119,17 @@ gui_mch_set_rendering_options(char_u *s)
if (dx_taamode < 0 || dx_taamode > 3) if (dx_taamode < 0 || dx_taamode > 3)
return FAIL; return FAIL;
} }
else if (STRCMP(name, "scrlines") == 0)
{
dx_scrlines = atoi((char *)value);
}
else else
return FAIL; return FAIL;
} }
if (!gui.in_use)
return OK; /* only checking the syntax of the value */
/* Enable DirectX/DirectWrite */ /* Enable DirectX/DirectWrite */
if (dx_enable) if (dx_enable)
{ {
@@ -147,6 +156,7 @@ gui_mch_set_rendering_options(char_u *s)
} }
} }
s_directx_enabled = dx_enable; s_directx_enabled = dx_enable;
s_directx_scrlines = dx_scrlines;
return OK; return OK;
#else #else
@@ -283,6 +293,7 @@ typedef int UINT_PTR;
#endif #endif
static void _OnPaint( HWND hwnd); static void _OnPaint( HWND hwnd);
static void fill_rect(const RECT *rcp, HBRUSH hbr, COLORREF color);
static void clear_rect(RECT *rcp); static void clear_rect(RECT *rcp);
static WORD s_dlgfntheight; /* height of the dialog font */ static WORD s_dlgfntheight; /* height of the dialog font */
@@ -605,10 +616,7 @@ _OnBlinkTimer(
blink_timer = (UINT) SetTimer(NULL, 0, (UINT)blink_ontime, blink_timer = (UINT) SetTimer(NULL, 0, (UINT)blink_ontime,
(TIMERPROC)_OnBlinkTimer); (TIMERPROC)_OnBlinkTimer);
} }
#if defined(FEAT_DIRECTX) gui_mch_flush();
if (IS_ENABLE_DIRECTX())
DWriteContext_Flush(s_dwc);
#endif
} }
static void static void
@@ -634,7 +642,10 @@ gui_mch_stop_blink(void)
{ {
gui_mswin_rm_blink_timer(); gui_mswin_rm_blink_timer();
if (blink_state == BLINK_OFF) if (blink_state == BLINK_OFF)
{
gui_update_cursor(TRUE, FALSE); gui_update_cursor(TRUE, FALSE);
gui_mch_flush();
}
blink_state = BLINK_NONE; blink_state = BLINK_NONE;
} }
@@ -654,6 +665,7 @@ gui_mch_start_blink(void)
(TIMERPROC)_OnBlinkTimer); (TIMERPROC)_OnBlinkTimer);
blink_state = BLINK_ON; blink_state = BLINK_ON;
gui_update_cursor(TRUE, FALSE); gui_update_cursor(TRUE, FALSE);
gui_mch_flush();
} }
} }
@@ -1730,7 +1742,6 @@ gui_mch_draw_part_cursor(
int h, int h,
guicolor_T color) guicolor_T color)
{ {
HBRUSH hbr;
RECT rc; RECT rc;
/* /*
@@ -1746,14 +1757,7 @@ gui_mch_draw_part_cursor(
rc.right = rc.left + w; rc.right = rc.left + w;
rc.bottom = rc.top + h; rc.bottom = rc.top + h;
#if defined(FEAT_DIRECTX) fill_rect(&rc, NULL, color);
if (IS_ENABLE_DIRECTX())
DWriteContext_Flush(s_dwc);
#endif
hbr = CreateSolidBrush(color);
FillRect(s_hdc, &rc, hbr);
DeleteBrush(hbr);
} }
@@ -3122,13 +3126,8 @@ gui_mch_delete_lines(
int num_lines) int num_lines)
{ {
RECT rc; RECT rc;
intel_gpu_workaround();
#if defined(FEAT_DIRECTX) #if defined(FEAT_DIRECTX)
// Commit drawing queue before ScrollWindowEx. int use_redraw = 0;
if (IS_ENABLE_DIRECTX())
DWriteContext_Flush(s_dwc);
#endif #endif
rc.left = FILL_X(gui.scroll_region_left); rc.left = FILL_X(gui.scroll_region_left);
@@ -3136,8 +3135,24 @@ gui_mch_delete_lines(
rc.top = FILL_Y(row); rc.top = FILL_Y(row);
rc.bottom = FILL_Y(gui.scroll_region_bot + 1); rc.bottom = FILL_Y(gui.scroll_region_bot + 1);
ScrollWindowEx(s_textArea, 0, -num_lines * gui.char_height, #if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
{
if (s_directx_scrlines > 0 && s_directx_scrlines <= num_lines)
{
RedrawWindow(s_textArea, &rc, NULL, RDW_INVALIDATE);
use_redraw = 1;
}
else
DWriteContext_Flush(s_dwc);
}
if (!use_redraw)
#endif
{
intel_gpu_workaround();
ScrollWindowEx(s_textArea, 0, -num_lines * gui.char_height,
&rc, &rc, NULL, NULL, get_scroll_flags()); &rc, &rc, NULL, NULL, get_scroll_flags());
}
UpdateWindow(s_textArea); UpdateWindow(s_textArea);
/* This seems to be required to avoid the cursor disappearing when /* This seems to be required to avoid the cursor disappearing when
@@ -3161,23 +3176,35 @@ gui_mch_insert_lines(
int num_lines) int num_lines)
{ {
RECT rc; RECT rc;
intel_gpu_workaround();
#if defined(FEAT_DIRECTX) #if defined(FEAT_DIRECTX)
// Commit drawing queue before ScrollWindowEx. int use_redraw = 0;
if (IS_ENABLE_DIRECTX())
DWriteContext_Flush(s_dwc);
#endif #endif
rc.left = FILL_X(gui.scroll_region_left); rc.left = FILL_X(gui.scroll_region_left);
rc.right = FILL_X(gui.scroll_region_right + 1); rc.right = FILL_X(gui.scroll_region_right + 1);
rc.top = FILL_Y(row); rc.top = FILL_Y(row);
rc.bottom = FILL_Y(gui.scroll_region_bot + 1); rc.bottom = FILL_Y(gui.scroll_region_bot + 1);
/* The SW_INVALIDATE is required when part of the window is covered or
* off-screen. How do we avoid it when it's not needed? */ #if defined(FEAT_DIRECTX)
ScrollWindowEx(s_textArea, 0, num_lines * gui.char_height, if (IS_ENABLE_DIRECTX())
{
if (s_directx_scrlines > 0 && s_directx_scrlines <= num_lines)
{
RedrawWindow(s_textArea, &rc, NULL, RDW_INVALIDATE);
use_redraw = 1;
}
else
DWriteContext_Flush(s_dwc);
}
if (!use_redraw)
#endif
{
intel_gpu_workaround();
/* The SW_INVALIDATE is required when part of the window is covered or
* off-screen. How do we avoid it when it's not needed? */
ScrollWindowEx(s_textArea, 0, num_lines * gui.char_height,
&rc, &rc, NULL, NULL, get_scroll_flags()); &rc, &rc, NULL, NULL, get_scroll_flags());
}
UpdateWindow(s_textArea); UpdateWindow(s_textArea);
@@ -5853,6 +5880,7 @@ _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData UNUSED)
} }
} }
gui_update_cursor(TRUE, FALSE); gui_update_cursor(TRUE, FALSE);
gui_mch_flush();
lResult = 0; lResult = 0;
break; break;
} }
@@ -6181,6 +6209,67 @@ RevOut( HDC s_hdc,
} }
#endif #endif
static void
draw_line(
int x1,
int y1,
int x2,
int y2,
COLORREF color)
{
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
DWriteContext_DrawLine(s_dwc, x1, y1, x2, y2, color);
else
#endif
{
HPEN hpen = CreatePen(PS_SOLID, 1, color);
HPEN old_pen = SelectObject(s_hdc, hpen);
MoveToEx(s_hdc, x1, y1, NULL);
/* Note: LineTo() excludes the last pixel in the line. */
LineTo(s_hdc, x2, y2);
DeleteObject(SelectObject(s_hdc, old_pen));
}
}
static void
set_pixel(
int x,
int y,
COLORREF color)
{
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
DWriteContext_SetPixel(s_dwc, x, y, color);
else
#endif
SetPixel(s_hdc, x, y, color);
}
static void
fill_rect(
const RECT *rcp,
HBRUSH hbr,
COLORREF color)
{
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
DWriteContext_FillRect(s_dwc, rcp, color);
else
#endif
{
HBRUSH hbr2;
if (hbr == NULL)
hbr2 = CreateSolidBrush(color);
else
hbr2 = hbr;
FillRect(s_hdc, rcp, hbr2);
if (hbr == NULL)
DeleteBrush(hbr2);
}
}
void void
gui_mch_draw_string( gui_mch_draw_string(
int row, int row,
@@ -6200,7 +6289,6 @@ gui_mch_draw_string(
static int unibuflen = 0; static int unibuflen = 0;
int n = 0; int n = 0;
#endif #endif
HPEN hpen, old_pen;
int y; int y;
/* /*
@@ -6263,11 +6351,7 @@ gui_mch_draw_string(
brush_lru = !brush_lru; brush_lru = !brush_lru;
} }
#if defined(FEAT_DIRECTX) fill_rect(&rc, hbr, gui.currBgColor);
if (IS_ENABLE_DIRECTX())
DWriteContext_FillRect(s_dwc, &rc, gui.currBgColor);
#endif
FillRect(s_hdc, &rc, hbr);
SetBkMode(s_hdc, TRANSPARENT); SetBkMode(s_hdc, TRANSPARENT);
@@ -6462,38 +6546,22 @@ gui_mch_draw_string(
foptions, pcliprect, (char *)text, len, padding); foptions, pcliprect, (char *)text, len, padding);
} }
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX() &&
(flags & (DRAW_UNDERL | DRAW_STRIKE | DRAW_UNDERC | DRAW_CURSOR)))
DWriteContext_Flush(s_dwc);
#endif
/* Underline */ /* Underline */
if (flags & DRAW_UNDERL) if (flags & DRAW_UNDERL)
{ {
hpen = CreatePen(PS_SOLID, 1, gui.currFgColor);
old_pen = SelectObject(s_hdc, hpen);
/* When p_linespace is 0, overwrite the bottom row of pixels. /* When p_linespace is 0, overwrite the bottom row of pixels.
* Otherwise put the line just below the character. */ * Otherwise put the line just below the character. */
y = FILL_Y(row + 1) - 1; y = FILL_Y(row + 1) - 1;
if (p_linespace > 1) if (p_linespace > 1)
y -= p_linespace - 1; y -= p_linespace - 1;
MoveToEx(s_hdc, FILL_X(col), y, NULL); draw_line(FILL_X(col), y, FILL_X(col + len), y, gui.currFgColor);
/* Note: LineTo() excludes the last pixel in the line. */
LineTo(s_hdc, FILL_X(col + len), y);
DeleteObject(SelectObject(s_hdc, old_pen));
} }
/* Strikethrough */ /* Strikethrough */
if (flags & DRAW_STRIKE) if (flags & DRAW_STRIKE)
{ {
hpen = CreatePen(PS_SOLID, 1, gui.currSpColor);
old_pen = SelectObject(s_hdc, hpen);
y = FILL_Y(row + 1) - gui.char_height/2; y = FILL_Y(row + 1) - gui.char_height/2;
MoveToEx(s_hdc, FILL_X(col), y, NULL); draw_line(FILL_X(col), y, FILL_X(col + len), y, gui.currSpColor);
/* Note: LineTo() excludes the last pixel in the line. */
LineTo(s_hdc, FILL_X(col + len), y);
DeleteObject(SelectObject(s_hdc, old_pen));
} }
/* Undercurl */ /* Undercurl */
@@ -6507,7 +6575,7 @@ gui_mch_draw_string(
for (x = FILL_X(col); x < FILL_X(col + len); ++x) for (x = FILL_X(col); x < FILL_X(col + len); ++x)
{ {
offset = val[x % 8]; offset = val[x % 8];
SetPixel(s_hdc, x, y - offset, gui.currSpColor); set_pixel(x, y - offset, gui.currSpColor);
} }
} }
} }
@@ -6541,19 +6609,7 @@ gui_mch_flush(void)
static void static void
clear_rect(RECT *rcp) clear_rect(RECT *rcp)
{ {
HBRUSH hbr; fill_rect(rcp, NULL, gui.back_pixel);
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
{
DWriteContext_FillRect(s_dwc, rcp, gui.back_pixel);
return;
}
#endif
hbr = CreateSolidBrush(gui.back_pixel);
FillRect(s_hdc, rcp, hbr);
DeleteBrush(hbr);
} }

View File

@@ -213,9 +213,7 @@ void vterm_state_get_palette_color(const VTermState *state, int index, VTermColo
void vterm_state_set_default_colors(VTermState *state, const VTermColor *default_fg, const VTermColor *default_bg) void vterm_state_set_default_colors(VTermState *state, const VTermColor *default_fg, const VTermColor *default_bg)
{ {
state->default_fg = *default_fg; state->default_fg = *default_fg;
state->default_fg.ansi_index = VTERM_ANSI_INDEX_DEFAULT;
state->default_bg = *default_bg; state->default_bg = *default_bg;
state->default_bg.ansi_index = VTERM_ANSI_INDEX_DEFAULT;
} }
void vterm_state_set_palette_color(VTermState *state, int index, const VTermColor *col) void vterm_state_set_palette_color(VTermState *state, int index, const VTermColor *col)

View File

@@ -1139,7 +1139,7 @@ ml_recover(void)
attr = HL_ATTR(HLF_E); attr = HL_ATTR(HLF_E);
/* /*
* If the file name ends in ".s[uvw][a-z]" we assume this is the swap file. * If the file name ends in ".s[a-w][a-z]" we assume this is the swap file.
* Otherwise a search is done to find the swap file(s). * Otherwise a search is done to find the swap file(s).
*/ */
fname = curbuf->b_fname; fname = curbuf->b_fname;
@@ -1153,7 +1153,8 @@ ml_recover(void)
STRNICMP(fname + len - 4, ".s", 2) STRNICMP(fname + len - 4, ".s", 2)
#endif #endif
== 0 == 0
&& vim_strchr((char_u *)"UVWuvw", fname[len - 2]) != NULL && vim_strchr((char_u *)"abcdefghijklmnopqrstuvw",
TOLOWER_ASC(fname[len - 2])) != NULL
&& ASCII_ISALPHA(fname[len - 1])) && ASCII_ISALPHA(fname[len - 1]))
{ {
directly = TRUE; directly = TRUE;

View File

@@ -5433,7 +5433,7 @@ op_addsub(
} }
else /* oap->motion_type == MCHAR */ else /* oap->motion_type == MCHAR */
{ {
if (!oap->inclusive) if (pos.lnum == oap->start.lnum && !oap->inclusive)
dec(&(oap->end)); dec(&(oap->end));
length = (colnr_T)STRLEN(ml_get(pos.lnum)); length = (colnr_T)STRLEN(ml_get(pos.lnum));
pos.col = 0; pos.col = 0;

View File

@@ -7406,7 +7406,7 @@ did_set_string_option(
#if defined(FEAT_RENDER_OPTIONS) #if defined(FEAT_RENDER_OPTIONS)
/* 'renderoptions' */ /* 'renderoptions' */
else if (varp == &p_rop && gui.in_use) else if (varp == &p_rop)
{ {
if (!gui_mch_set_rendering_options(p_rop)) if (!gui_mch_set_rendering_options(p_rop))
errmsg = e_invarg; errmsg = e_invarg;

View File

@@ -1816,9 +1816,18 @@ mch_inchar(
typeahead[typeaheadlen] = c; typeahead[typeaheadlen] = c;
if (ch2 != NUL) if (ch2 != NUL)
{ {
typeahead[typeaheadlen + n] = 3; if (c == K_NUL && (ch2 & 0xff00) != 0)
typeahead[typeaheadlen + n + 1] = (char_u)ch2; {
n += 2; /* fAnsiKey with modifier keys */
typeahead[typeaheadlen + n] = (char_u)ch2;
n++;
}
else
{
typeahead[typeaheadlen + n] = 3;
typeahead[typeaheadlen + n + 1] = (char_u)ch2;
n += 2;
}
} }
/* Use the ALT key to set the 8th bit of the character /* Use the ALT key to set the 8th bit of the character

View File

@@ -16,6 +16,7 @@ int diff_check_fill(win_T *wp, linenr_T lnum);
void diff_set_topline(win_T *fromwin, win_T *towin); void diff_set_topline(win_T *fromwin, win_T *towin);
int diffopt_changed(void); int diffopt_changed(void);
int diffopt_horizontal(void); int diffopt_horizontal(void);
int diffopt_hiddenoff(void);
int diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp); int diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp);
int diff_infold(win_T *wp, linenr_T lnum); int diff_infold(win_T *wp, linenr_T lnum);
void nv_diffgetput(int put, long count); void nv_diffgetput(int put, long count);

View File

@@ -20,6 +20,7 @@ void term_change_in_curbuf(void);
int term_get_attr(buf_T *buf, linenr_T lnum, int col); int term_get_attr(buf_T *buf, linenr_T lnum, int col);
char_u *term_get_status_text(term_T *term); char_u *term_get_status_text(term_T *term);
int set_ref_in_term(int copyID); int set_ref_in_term(int copyID);
void set_terminal_default_colors(int cterm_fg, int cterm_bg);
void f_term_getaltscreen(typval_T *argvars, typval_T *rettv); void f_term_getaltscreen(typval_T *argvars, typval_T *rettv);
void f_term_getattr(typval_T *argvars, typval_T *rettv); void f_term_getattr(typval_T *argvars, typval_T *rettv);
void f_term_getcursor(typval_T *argvars, typval_T *rettv); void f_term_getcursor(typval_T *argvars, typval_T *rettv);

View File

@@ -7391,6 +7391,9 @@ do_highlight(
int error = FALSE; int error = FALSE;
int color; int color;
int is_normal_group = FALSE; /* "Normal" group */ int is_normal_group = FALSE; /* "Normal" group */
#ifdef FEAT_TERMINAL
int is_terminal_group = FALSE; /* "Terminal" group */
#endif
#ifdef FEAT_GUI_X11 #ifdef FEAT_GUI_X11
int is_menu_group = FALSE; /* "Menu" group */ int is_menu_group = FALSE; /* "Menu" group */
int is_scrollbar_group = FALSE; /* "Scrollbar" group */ int is_scrollbar_group = FALSE; /* "Scrollbar" group */
@@ -7616,6 +7619,10 @@ do_highlight(
if (STRCMP(HL_TABLE()[idx].sg_name_u, "NORMAL") == 0) if (STRCMP(HL_TABLE()[idx].sg_name_u, "NORMAL") == 0)
is_normal_group = TRUE; is_normal_group = TRUE;
#ifdef FEAT_TERMINAL
else if (STRCMP(HL_TABLE()[idx].sg_name_u, "TERMINAL") == 0)
is_terminal_group = TRUE;
#endif
#ifdef FEAT_GUI_X11 #ifdef FEAT_GUI_X11
else if (STRCMP(HL_TABLE()[idx].sg_name_u, "MENU") == 0) else if (STRCMP(HL_TABLE()[idx].sg_name_u, "MENU") == 0)
is_menu_group = TRUE; is_menu_group = TRUE;
@@ -8239,6 +8246,11 @@ do_highlight(
} }
#endif #endif
} }
#ifdef FEAT_TERMINAL
else if (is_terminal_group)
set_terminal_default_colors(
HL_TABLE()[idx].sg_cterm_fg, HL_TABLE()[idx].sg_cterm_bg);
#endif
#ifdef FEAT_GUI_X11 #ifdef FEAT_GUI_X11
# ifdef FEAT_MENU # ifdef FEAT_MENU
else if (is_menu_group) else if (is_menu_group)

View File

@@ -188,6 +188,9 @@ static void term_free_vterm(term_T *term);
* backspace key. */ * backspace key. */
static int term_backspace_char = BS; static int term_backspace_char = BS;
/* "Terminal" highlight group colors. */
static int term_default_cterm_fg = -1;
static int term_default_cterm_bg = -1;
/************************************** /**************************************
* 1. Generic code for all systems. * 1. Generic code for all systems.
@@ -1305,12 +1308,13 @@ send_keys_to_term(term_T *term, int c, int typed)
case K_MOUSELEFT: case K_MOUSELEFT:
case K_MOUSERIGHT: case K_MOUSERIGHT:
if (mouse_row < W_WINROW(curwin) if (mouse_row < W_WINROW(curwin)
|| mouse_row > (W_WINROW(curwin) + curwin->w_height) || mouse_row >= (W_WINROW(curwin) + curwin->w_height)
|| mouse_col < curwin->w_wincol || mouse_col < curwin->w_wincol
|| mouse_col > W_ENDCOL(curwin) || mouse_col >= W_ENDCOL(curwin)
|| dragging_outside) || dragging_outside)
{ {
/* click or scroll outside the current window */ /* click or scroll outside the current window or on status line
* or vertical separator */
if (typed) if (typed)
{ {
stuffcharReadbuff(c); stuffcharReadbuff(c);
@@ -1833,6 +1837,15 @@ cell2attr(VTermScreenCellAttrs cellattrs, VTermColor cellfg, VTermColor cellbg)
int fg = color2index(&cellfg, TRUE, &bold); int fg = color2index(&cellfg, TRUE, &bold);
int bg = color2index(&cellbg, FALSE, &bold); int bg = color2index(&cellbg, FALSE, &bold);
/* Use the "Terminal" highlighting for the default colors. */
if ((fg == 0 || bg == 0) && t_colors >= 16)
{
if (fg == 0 && term_default_cterm_fg >= 0)
fg = term_default_cterm_fg + 1;
if (bg == 0 && term_default_cterm_bg >= 0)
bg = term_default_cterm_bg + 1;
}
/* with 8 colors set the bold attribute to get a bright foreground */ /* with 8 colors set the bold attribute to get a bright foreground */
if (bold == TRUE) if (bold == TRUE)
attr |= HL_BOLD; attr |= HL_BOLD;
@@ -2453,6 +2466,7 @@ cterm_color2rgb(int nr, VTermColor *rgb)
rgb->blue = cube_value[idx % 6]; rgb->blue = cube_value[idx % 6];
rgb->green = cube_value[idx / 6 % 6]; rgb->green = cube_value[idx / 6 % 6];
rgb->red = cube_value[idx / 36 % 6]; rgb->red = cube_value[idx / 36 % 6];
rgb->ansi_index = VTERM_ANSI_INDEX_NONE;
} }
else if (nr < 256) else if (nr < 256)
{ {
@@ -2461,6 +2475,7 @@ cterm_color2rgb(int nr, VTermColor *rgb)
rgb->blue = grey_ramp[idx]; rgb->blue = grey_ramp[idx];
rgb->green = grey_ramp[idx]; rgb->green = grey_ramp[idx];
rgb->red = grey_ramp[idx]; rgb->red = grey_ramp[idx];
rgb->ansi_index = VTERM_ANSI_INDEX_NONE;
} }
} }
@@ -2503,6 +2518,7 @@ create_vterm(term_T *term, int rows, int cols)
} }
fg->red = fg->green = fg->blue = fgval; fg->red = fg->green = fg->blue = fgval;
bg->red = bg->green = bg->blue = bgval; bg->red = bg->green = bg->blue = bgval;
fg->ansi_index = bg->ansi_index = VTERM_ANSI_INDEX_DEFAULT;
/* The "Terminal" highlight group overrules the defaults. */ /* The "Terminal" highlight group overrules the defaults. */
id = syn_name2id((char_u *)"Terminal"); id = syn_name2id((char_u *)"Terminal");
@@ -2565,13 +2581,10 @@ create_vterm(term_T *term, int rows, int cols)
#endif #endif
if (id != 0 && t_colors >= 16) if (id != 0 && t_colors >= 16)
{ {
int cterm_fg, cterm_bg; if (term_default_cterm_fg >= 0)
cterm_color2rgb(term_default_cterm_fg, fg);
syn_id2cterm_bg(id, &cterm_fg, &cterm_bg); if (term_default_cterm_bg >= 0)
if (cterm_fg >= 0) cterm_color2rgb(term_default_cterm_bg, bg);
cterm_color2rgb(cterm_fg, fg);
if (cterm_bg >= 0)
cterm_color2rgb(cterm_bg, bg);
} }
else else
{ {
@@ -2687,6 +2700,16 @@ set_ref_in_term(int copyID)
return abort; return abort;
} }
/*
* Cache "Terminal" highlight group colors.
*/
void
set_terminal_default_colors(int cterm_fg, int cterm_bg)
{
term_default_cterm_fg = cterm_fg - 1;
term_default_cterm_bg = cterm_bg - 1;
}
/* /*
* Get the buffer from the first argument in "argvars". * Get the buffer from the first argument in "argvars".
* Returns NULL when the buffer is not for a terminal window. * Returns NULL when the buffer is not for a terminal window.

View File

@@ -251,6 +251,8 @@ let s:flaky = [
\ 'Test_exit_callback_interval()', \ 'Test_exit_callback_interval()',
\ 'Test_nb_basic()', \ 'Test_nb_basic()',
\ 'Test_oneshot()', \ 'Test_oneshot()',
\ 'Test_out_cb()',
\ 'Test_paused()',
\ 'Test_pipe_through_sort_all()', \ 'Test_pipe_through_sort_all()',
\ 'Test_pipe_through_sort_some()', \ 'Test_pipe_through_sort_some()',
\ 'Test_quoteplus()', \ 'Test_quoteplus()',
@@ -259,6 +261,7 @@ let s:flaky = [
\ 'Test_terminal_composing_unicode()', \ 'Test_terminal_composing_unicode()',
\ 'Test_terminal_noblock()', \ 'Test_terminal_noblock()',
\ 'Test_terminal_redir_file()', \ 'Test_terminal_redir_file()',
\ 'Test_terminal_tmap()',
\ 'Test_with_partial_callback()', \ 'Test_with_partial_callback()',
\ ] \ ]

View File

@@ -1694,19 +1694,23 @@ func Test_cwd()
let g:envstr = '' let g:envstr = ''
if has('win32') if has('win32')
let expect = $TEMP let expect = $TEMP
call job_start(['cmd', '/c', 'echo %CD%'], {'callback': {ch,msg->execute(":let g:envstr .= msg")}, 'cwd': expect}) let job = job_start(['cmd', '/c', 'echo %CD%'], {'callback': {ch,msg->execute(":let g:envstr .= msg")}, 'cwd': expect})
else else
let expect = $HOME let expect = $HOME
call job_start(['pwd'], {'callback': {ch,msg->execute(":let g:envstr .= msg")}, 'cwd': expect}) let job = job_start(['pwd'], {'callback': {ch,msg->execute(":let g:envstr .= msg")}, 'cwd': expect})
endif endif
call WaitFor('"" != g:envstr') try
let expect = substitute(expect, '[/\\]$', '', '') call WaitFor('"" != g:envstr')
let g:envstr = substitute(g:envstr, '[/\\]$', '', '') let expect = substitute(expect, '[/\\]$', '', '')
if $CI != '' && stridx(g:envstr, '/private/') == 0 let g:envstr = substitute(g:envstr, '[/\\]$', '', '')
let g:envstr = g:envstr[8:] if $CI != '' && stridx(g:envstr, '/private/') == 0
endif let g:envstr = g:envstr[8:]
call assert_equal(expect, g:envstr) endif
unlet g:envstr call assert_equal(expect, g:envstr)
finally
call job_stop(job)
unlet g:envstr
endtry
endfunc endfunc
function Ch_test_close_lambda(port) function Ch_test_close_lambda(port)
@@ -1731,7 +1735,7 @@ endfunc
func s:test_list_args(cmd, out, remove_lf) func s:test_list_args(cmd, out, remove_lf)
try try
let g:out = '' let g:out = ''
call job_start([s:python, '-c', a:cmd], {'callback': {ch, msg -> execute('let g:out .= msg')}, 'out_mode': 'raw'}) let job = job_start([s:python, '-c', a:cmd], {'callback': {ch, msg -> execute('let g:out .= msg')}, 'out_mode': 'raw'})
call WaitFor('"" != g:out') call WaitFor('"" != g:out')
if has('win32') if has('win32')
let g:out = substitute(g:out, '\r', '', 'g') let g:out = substitute(g:out, '\r', '', 'g')
@@ -1741,6 +1745,7 @@ func s:test_list_args(cmd, out, remove_lf)
endif endif
call assert_equal(a:out, g:out) call assert_equal(a:out, g:out)
finally finally
call job_stop(job)
unlet g:out unlet g:out
endtry endtry
endfunc endfunc

View File

@@ -375,6 +375,29 @@ func Test_diffopt_vertical()
%bwipe %bwipe
endfunc endfunc
func Test_diffopt_hiddenoff()
set diffopt=filler,foldcolumn:0,hiddenoff
e! one
call setline(1, ['Two', 'Three'])
redraw
let normattr = screenattr(1, 1)
diffthis
botright vert new two
call setline(1, ['One', 'Four'])
diffthis
redraw
call assert_notequal(normattr, screenattr(1, 1))
set hidden
close
redraw
" should not diffing with hidden buffer two while 'hiddenoff' is enabled
call assert_equal(normattr, screenattr(1, 1))
bwipe!
bwipe!
set hidden& diffopt&
endfunc
func Test_diffoff_hidden() func Test_diffoff_hidden()
set diffopt=filler,foldcolumn:0 set diffopt=filler,foldcolumn:0
e! one e! one

View File

@@ -364,11 +364,25 @@ endfunc
" Expected: " Expected:
" 1) Ctrl-a on visually selected zero " 1) Ctrl-a on visually selected zero
" 111 " 111
"
" Also: 019 with "01" selected increments to "029".
func Test_visual_increment_15() func Test_visual_increment_15()
call setline(1, ["101"]) call setline(1, ["101"])
exec "norm! lv\<C-A>" exec "norm! lv\<C-A>"
call assert_equal(["111"], getline(1, '$')) call assert_equal(["111"], getline(1, '$'))
call assert_equal([0, 1, 2, 0], getpos('.')) call assert_equal([0, 1, 2, 0], getpos('.'))
call setline(1, ["019"])
exec "norm! 0vl\<C-A>"
call assert_equal("029", getline(1))
call setline(1, ["01239"])
exec "norm! 0vlll\<C-A>"
call assert_equal("01249", getline(1))
call setline(1, ["01299"])
exec "norm! 0vlll\<C-A>"
call assert_equal("1309", getline(1))
endfunc endfunc
" 16) increment right aligned numbers " 16) increment right aligned numbers
@@ -756,5 +770,12 @@ func Test_normal_increment_03()
call assert_equal([0, 3, 25, 0], getpos('.')) call assert_equal([0, 3, 25, 0], getpos('.'))
endfunc endfunc
func Test_increment_empty_line()
new
call setline(1, ['0', '0', '0', '0', '0', '0', ''])
exe "normal Gvgg\<C-A>"
call assert_equal(['1', '1', '1', '1', '1', '1', ''], getline(1, 7))
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@@ -181,3 +181,44 @@ func Test_profile_errors()
call assert_fails("profile pause", 'E750:') call assert_fails("profile pause", 'E750:')
call assert_fails("profile continue", 'E750:') call assert_fails("profile continue", 'E750:')
endfunc endfunc
func Test_profile_truncate_mbyte()
if !has('multi_byte') || &enc !=# 'utf-8'
return
endif
let lines = [
\ 'scriptencoding utf-8',
\ 'func! Foo()',
\ ' return [',
\ ' \ "' . join(map(range(0x4E00, 0x4E00 + 340), 'nr2char(v:val)'), '') . '",',
\ ' \ "' . join(map(range(0x4F00, 0x4F00 + 340), 'nr2char(v:val)'), '') . '",',
\ ' \ ]',
\ 'endfunc',
\ 'call Foo()',
\ ]
call writefile(lines, 'Xprofile_file.vim')
call system(v:progpath
\ . ' -es --clean --cmd "set enc=utf-8"'
\ . ' -c "profile start Xprofile_file.log"'
\ . ' -c "profile file Xprofile_file.vim"'
\ . ' -c "so Xprofile_file.vim"'
\ . ' -c "qall!"')
call assert_equal(0, v:shell_error)
split Xprofile_file.log
if &fenc != ''
call assert_equal('utf-8', &fenc)
endif
/func! Foo()
let lnum = line('.')
call assert_match('^\s*return \[$', getline(lnum + 1))
call assert_match("\u4F52$", getline(lnum + 2))
call assert_match("\u5052$", getline(lnum + 3))
call assert_match('^\s*\\ \]$', getline(lnum + 4))
bwipe!
call delete('Xprofile_file.vim')
call delete('Xprofile_file.log')
endfunc

View File

@@ -673,15 +673,16 @@ func TerminalTmap(remap)
else else
tnoremap 123 456 tnoremap 123 456
endif endif
tmap 456 abcde " don't use abcde, it's an existing command
tmap 456 abxde
call assert_equal('456', maparg('123', 't')) call assert_equal('456', maparg('123', 't'))
call assert_equal('abcde', maparg('456', 't')) call assert_equal('abxde', maparg('456', 't'))
call feedkeys("123", 'tx') call feedkeys("123", 'tx')
let g:buf = buf let g:buf = buf
call WaitFor("term_getline(g:buf,term_getcursor(g:buf)[0]) =~ 'abcde\\|456'") call WaitFor("term_getline(g:buf,term_getcursor(g:buf)[0]) =~ 'abxde\\|456'")
let lnum = term_getcursor(buf)[0] let lnum = term_getcursor(buf)[0]
if a:remap if a:remap
call assert_match('abcde', term_getline(buf, lnum)) call assert_match('abxde', term_getline(buf, lnum))
else else
call assert_match('456', term_getline(buf, lnum)) call assert_match('456', term_getline(buf, lnum))
endif endif

View File

@@ -362,6 +362,19 @@ func Test_equalalways_on_close()
set equalalways& set equalalways&
endfunc endfunc
func Test_win_screenpos()
call assert_equal(1, winnr('$'))
split
vsplit
10wincmd _
30wincmd |
call assert_equal([1, 1], win_screenpos(1))
call assert_equal([1, 32], win_screenpos(2))
call assert_equal([12, 1], win_screenpos(3))
call assert_equal([0, 0], win_screenpos(4))
only
endfunc
func Test_window_jump_tag() func Test_window_jump_tag()
help help
/iccf /iccf

View File

@@ -771,6 +771,36 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1374,
/**/
1373,
/**/
1372,
/**/
1371,
/**/
1370,
/**/
1369,
/**/
1368,
/**/
1367,
/**/
1366,
/**/
1365,
/**/
1364,
/**/
1363,
/**/
1362,
/**/
1361,
/**/
1360,
/**/ /**/
1359, 1359,
/**/ /**/