Compare commits

..

20 Commits

Author SHA1 Message Date
Bram Moolenaar
17471e84a7 patch 8.0.1349: options test fails when using Motif or GTK GUI
Problem:    Options test fails when using Motif or GTK GUI.
Solution:   Use "fixed" instead of "fixedsys" for Unix. Don't try "xxx" for
            guifonteset.  Don't set 'termencoding' to anything but "utf-8" for
            GTK.  Give an error if 'termencoding' can't be converted.
2017-11-26 23:47:18 +01:00
Bram Moolenaar
c8c75796a6 patch 8.0.1348: make testclean deletes script file on MS-Windows
Problem:    Make testclean deletes script file on MS-Windows.
Solution:   Rename file to avoid it starting with an "x".
2017-11-26 17:18:06 +01:00
Bram Moolenaar
e0aa23f7e3 patch 8.0.1347: MS-Windows: build broken by misplaced curly
Problem:    MS-Windows: build broken by misplaced curly.
Solution:   Move curly after #endif
2017-11-26 17:08:03 +01:00
Bram Moolenaar
a3571ebef5 patch 8.0.1346: crash when passing 50 char string to balloon_split()
Problem:    Crash when passing 50 char string to balloon_split().
Solution:   Fix off-by-one error.
2017-11-26 16:53:16 +01:00
Bram Moolenaar
c41838aa01 patch 8.0.1345: race condition between stat() and open() for viminfo
Problem:    Race condition between stat() and open() for the viminfo temp
            file. (Simon Ruderich)
Solution:   use open() with O_EXCL to atomically check if the file exists.
            Don't try using a temp file, renaming it will fail anyway.
2017-11-26 16:50:41 +01:00
Bram Moolenaar
2877d334ad patch 8.0.1344: using 'imactivatefunc' in the GUI does not work
Problem:    Using 'imactivatefunc' in the GUI does not work.
Solution:   Do not use 'imactivatefunc' and 'imstatusfunc' in the GUI.
2017-11-26 14:56:16 +01:00
Bram Moolenaar
d7ccc4d81d patch 8.0.1343: MS-Windows: does not show colored emojis
Problem:    MS-Windows: does not show colored emojis.
Solution:   Implement colored emojis. Improve drawing speed. Make 'taamode'
            work. (Taro Muraoka, Yasuhiro Matsumoto, Ken Takata, close #2375)
2017-11-26 14:29:32 +01:00
Bram Moolenaar
fb1db0e355 patch 8.0.1342: cannot build with Motif and multi-byte
Problem:    Cannot build with Motif and multi-byte. (Mohamed Boughaba)
Solution:   Use the right input method status flag. (closes #2374)
2017-11-25 21:07:46 +01:00
Bram Moolenaar
be5d998d0e patch 8.0.1341: 'imactivatefunc' test fails on MS-Windows
Problem:    'imactivatefunc' test fails on MS-Windows.
Solution:   Skip the text.
2017-11-25 17:58:28 +01:00
Bram Moolenaar
281c93e714 patch 8.0.1340: MS-Windows: cannot build GUI without IME
Problem:    MS-Windows: cannot build GUI without IME.
Solution:   Define im_get_status() and im_set_active() when IME is not used.
2017-11-25 17:48:33 +01:00
Bram Moolenaar
83799a7b74 patch 8.0.1339: no test for what 8.0.1335 fixes
Problem:    No test for what 8.0.1335 fixes.
Solution:   Add a test. (Yasuhiro Matsumoto, closes #2373)
2017-11-25 17:24:09 +01:00
Bram Moolenaar
819edbe078 patch 8.0.1338: USE_IM_CONTROL is confusing and incomplete
Problem:    USE_IM_CONTROL is confusing and incomplete.
Solution:   Just use FEAT_MBYTE.  Call 'imactivatefunc' also without GUI.
2017-11-25 17:14:33 +01:00
Bram Moolenaar
50d43153a7 patch 8.0.1337: typo in #ifdef
Problem:    Typo in #ifdef.
Solution:   Fix the #if line.
2017-11-25 15:24:56 +01:00
Bram Moolenaar
6315a9ae92 patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Problem:    Cannot use imactivatefunc() unless compiled with +xim.
Solution:   Allow using imactivatefunc() when not compiled with +xim.
            (Yasuhiro Matsumoto, closes #2349)
2017-11-25 15:20:02 +01:00
Bram Moolenaar
291a9d15ed patch 8.0.1335: writefile() using fsync() may give an error.
Problem:    Writefile() using fsync() may give an error for a device.
            (Yasuhiro Matsumoto)
Solution:   Ignore fsync() failing. (closes #2373)
2017-11-25 14:37:11 +01:00
Bram Moolenaar
3167c3e701 patch 8.0.1334: splitting a window with a WinBar damages window layout
Problem:    Splitting a window with a WinBar damages window layout.
            (Lifepillar)
Solution:   Take the winbar into account when computing the new window
            position.  Add WINBAR_HEIGHT().
2017-11-25 14:19:43 +01:00
Bram Moolenaar
2c997d7603 patch 8.0.1333: some tests are run twice
Problem:    Some tests are run twice.
Solution:   Invoked most utf8 tests only from test_alot_utf8. (Yegappan
            Lakshmanan, closes #2369)
2017-11-23 22:52:09 +01:00
Bram Moolenaar
93a32e2ec4 patch 8.0.1332: highlighting in quickfix window could be better
Problem:    Highlighting in quickfix window could be better. (Axel Bender)
Solution:   Use the qfSeparator highlight item. (Yegappan Lakshmanan)
2017-11-23 22:05:45 +01:00
Bram Moolenaar
3679c17917 patch 8.0.1331: possible crash when window can be zero lines high
Problem:    Possible crash when window can be zero lines high. (Joseph
            Dornisch)
Solution:   Only set w_fraction if the window is at least two lines high.
2017-11-22 22:22:11 +01:00
Bram Moolenaar
a2a80162de Update runtime files. 2017-11-21 23:09:50 +01:00
49 changed files with 1262 additions and 693 deletions

View File

@@ -119,7 +119,6 @@ SRC_ALL = \
src/testdir/test[0-9]*a.ok \ src/testdir/test[0-9]*a.ok \
src/testdir/test_[a-z]*.ok \ src/testdir/test_[a-z]*.ok \
src/testdir/test49.vim \ src/testdir/test49.vim \
src/testdir/test60.vim \
src/testdir/test83-tags? \ src/testdir/test83-tags? \
src/testdir/test77a.com \ src/testdir/test77a.com \
src/testdir/test_*.vim \ src/testdir/test_*.vim \
@@ -138,7 +137,7 @@ SRC_ALL = \
src/testdir/samples/*.txt \ src/testdir/samples/*.txt \
src/testdir/samples/test000 \ src/testdir/samples/test000 \
src/testdir/if_ver*.vim \ src/testdir/if_ver*.vim \
src/testdir/xterm_ramp.vim \ src/testdir/color_ramp.vim \
src/proto.h \ src/proto.h \
src/proto/arabic.pro \ src/proto/arabic.pro \
src/proto/beval.pro \ src/proto/beval.pro \

View File

@@ -16,6 +16,7 @@ matrix:
before_build: before_build:
- '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 /release' - '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 /release'
- 'set INCLUDE=%INCLUDE%C:\Program Files (x86)\Windows Kits\8.1\Include\um'
build_script: build_script:
- src/appveyor.bat - src/appveyor.bat

View File

@@ -1,4 +1,4 @@
*debugger.txt* For Vim version 8.0. Last change: 2005 Mar 29 *debugger.txt* For Vim version 8.0. Last change: 2017 Nov 21
VIM REFERENCE MANUAL by Gordon Prieur VIM REFERENCE MANUAL by Gordon Prieur
@@ -95,10 +95,12 @@ list and colors can be set via X resources (XmNballoonEvalFontList,
XmNballoonEvalBackground, and XmNballoonEvalForeground). XmNballoonEvalBackground, and XmNballoonEvalForeground).
The 'balloondelay' option sets the delay before an attempt is made to show a The 'balloondelay' option sets the delay before an attempt is made to show a
balloon. balloon.
The 'ballooneval' option needs to be set to switch it on. The 'ballooneval' and/or the 'balloonevalterm' option needs to be set to
switch it on.
Balloon evaluation is only available when compiled with the |+balloon_eval| Balloon evaluation is only available in the GUI when compiled with the
feature. |+balloon_eval| feature. For the terminal the |+balloon_eval_term| feature
matters.
The Balloon evaluation functions are also used to show a tooltip for the The Balloon evaluation functions are also used to show a tooltip for the
toolbar. The 'ballooneval' option does not need to be set for this. But the toolbar. The 'ballooneval' option does not need to be set for this. But the

View File

@@ -1,4 +1,4 @@
*editing.txt* For Vim version 8.0. Last change: 2017 Aug 21 *editing.txt* For Vim version 8.0. Last change: 2017 Nov 16
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -900,7 +900,7 @@ Note: When the 'write' option is off, you are not able to write any file.
*:w* *:write* *:w* *:write*
*E502* *E503* *E504* *E505* *E502* *E503* *E504* *E505*
*E512* *E514* *E667* *E796* *E512* *E514* *E667* *E796* *E949*
:w[rite] [++opt] Write the whole buffer to the current file. This is :w[rite] [++opt] Write the whole buffer to the current file. This is
the normal way to save changes to a file. It fails the normal way to save changes to a file. It fails
when the 'readonly' option is set or when there is when the 'readonly' option is set or when there is
@@ -956,6 +956,9 @@ used, for example, when the write fails and you want to try again later with
":w #". This can be switched off by removing the 'A' flag from the ":w #". This can be switched off by removing the 'A' flag from the
'cpoptions' option. 'cpoptions' option.
Note that the 'fsync' option matters here. If it's set it may make writes
slower (but safer).
*:sav* *:saveas* *:sav* *:saveas*
:sav[eas][!] [++opt] {file} :sav[eas][!] [++opt] {file}
Save the current buffer under the name {file} and set Save the current buffer under the name {file} and set

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.0. Last change: 2017 Nov 16 *eval.txt* For Vim version 8.0. Last change: 2017 Nov 19
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2748,6 +2748,8 @@ bufexists({expr}) *bufexists()*
The result is a Number, which is |TRUE| if a buffer called The result is a Number, which is |TRUE| if a buffer called
{expr} exists. {expr} exists.
If the {expr} argument is a number, buffer numbers are used. If the {expr} argument is a number, buffer numbers are used.
Number zero is the alternate buffer for the current window.
If the {expr} argument is a string it must match a buffer name If the {expr} argument is a string it must match a buffer name
exactly. The name can be: exactly. The name can be:
- Relative to the current directory. - Relative to the current directory.

View File

@@ -26,8 +26,9 @@ For changing the language of messages and menus see |mlang.txt|.
7. Input on X11 |mbyte-XIM| 7. Input on X11 |mbyte-XIM|
8. Input on MS-Windows |mbyte-IME| 8. Input on MS-Windows |mbyte-IME|
9. Input with a keymap |mbyte-keymap| 9. Input with a keymap |mbyte-keymap|
10. Using UTF-8 |mbyte-utf8| 10. Input with imactivatefunc() |mbyte-func|
11. Overview of options |mbyte-options| 11. Using UTF-8 |mbyte-utf8|
12. Overview of options |mbyte-options|
NOTE: This file contains UTF-8 characters. These may show up as strange NOTE: This file contains UTF-8 characters. These may show up as strange
characters or boxes when using another encoding. characters or boxes when using another encoding.
@@ -1254,7 +1255,35 @@ Combining forms:
ﭏ 0xfb4f Xal alef-lamed ﭏ 0xfb4f Xal alef-lamed
============================================================================== ==============================================================================
10. Using UTF-8 *mbyte-utf8* *UTF-8* *utf-8* *utf8* 10. Input with imactivatefunc() *mbyte-func*
Vim has |imactivatefunc()| and |imstatusfunc()|. This is useful to
activate/deativate input method from Vim in any way, also with an external
command. For example, fcitx provide fcitx-remote command: >
set iminsert=2
set imsearch=2
set imcmdline
set imactivatefunc=ImActivate
function! ImActivate(active)
if a:active
call system('fcitx-remote -o')
else
call system('fcitx-remote -c')
endif
endfunction
set imstatusfunc=ImStatus
function! ImStatus()
return system('fcitx-remote')[0] is# '2'
endfunction
Using this script, you can activate/deactivate XIM via Vim even when it is not
compiled with |+xim|.
==============================================================================
11. Using UTF-8 *mbyte-utf8* *UTF-8* *utf-8* *utf8*
*Unicode* *unicode* *Unicode* *unicode*
The Unicode character set was designed to include all characters from other The Unicode character set was designed to include all characters from other
character sets. Therefore it is possible to write text in any language using character sets. Therefore it is possible to write text in any language using
@@ -1402,7 +1431,7 @@ not everybody is able to type a composing character.
============================================================================== ==============================================================================
11. Overview of options *mbyte-options* 12. Overview of options *mbyte-options*
These options are relevant for editing multi-byte files. Check the help in These options are relevant for editing multi-byte files. Check the help in
options.txt for detailed information. options.txt for detailed information.

View File

@@ -4256,10 +4256,10 @@ A jump table for the options with a short description can be found at |Q_op|.
'imactivatefunc' 'imaf' string (default "") 'imactivatefunc' 'imaf' string (default "")
global global
{not in Vi} {not in Vi}
{only available when compiled with |+xim| and {only available when compiled with |+mbyte|}
|+GUI_GTK|}
This option specifies a function that will be called to This option specifies a function that will be called to
activate/inactivate Input Method. activate or deactivate the Input Method.
It is not used in the GUI.
Example: > Example: >
function ImActivateFunc(active) function ImActivateFunc(active)
@@ -4308,8 +4308,7 @@ A jump table for the options with a short description can be found at |Q_op|.
'imcmdline' 'imc' boolean (default off) 'imcmdline' 'imc' boolean (default off)
global global
{not in Vi} {not in Vi}
{only available when compiled with the |+xim|, {only available when compiled with |+mbyte|}
|+multi_byte_ime| or |global-ime| features}
When set the Input Method is always on when starting to edit a command When set the Input Method is always on when starting to edit a command
line, unless entering a search pattern (see 'imsearch' for that). line, unless entering a search pattern (see 'imsearch' for that).
Setting this option is useful when your input method allows entering Setting this option is useful when your input method allows entering
@@ -4320,8 +4319,7 @@ A jump table for the options with a short description can be found at |Q_op|.
'imdisable' 'imd' boolean (default off, on for some systems (SGI)) 'imdisable' 'imd' boolean (default off, on for some systems (SGI))
global global
{not in Vi} {not in Vi}
{only available when compiled with the |+xim|, {only available when compiled with |+mbyte|}
|+multi_byte_ime| or |global-ime| features}
When set the Input Method is never used. This is useful to disable When set the Input Method is never used. This is useful to disable
the IM when it doesn't work properly. the IM when it doesn't work properly.
Currently this option is on by default for SGI/IRIX machines. This Currently this option is on by default for SGI/IRIX machines. This
@@ -4336,8 +4334,6 @@ A jump table for the options with a short description can be found at |Q_op|.
0 :lmap is off and IM is off 0 :lmap is off and IM is off
1 :lmap is ON and IM is off 1 :lmap is ON and IM is off
2 :lmap is off and IM is ON 2 :lmap is off and IM is ON
2 is available only when compiled with the |+multi_byte_ime|, |+xim|
or |global-ime|.
To always reset the option to zero when leaving Insert mode with <Esc> To always reset the option to zero when leaving Insert mode with <Esc>
this can be used: > this can be used: >
:inoremap <ESC> <ESC>:set iminsert=0<CR> :inoremap <ESC> <ESC>:set iminsert=0<CR>
@@ -4350,6 +4346,10 @@ A jump table for the options with a short description can be found at |Q_op|.
The value 0 may not work correctly with Athena and Motif with some XIM The value 0 may not work correctly with Athena and Motif with some XIM
methods. Use 'imdisable' to disable XIM then. methods. Use 'imdisable' to disable XIM then.
You can set 'imactivatefunc' and 'imstatusfunc' to handle IME/XIM
via external command if vim is not compiled with the |+xim|,
|+multi_byte_ime| or |global-ime|.
*'imsearch'* *'ims'* *'imsearch'* *'ims'*
'imsearch' 'ims' number (default -1) 'imsearch' 'ims' number (default -1)
local to buffer local to buffer
@@ -4372,10 +4372,10 @@ A jump table for the options with a short description can be found at |Q_op|.
'imstatusfunc' 'imsf' string (default "") 'imstatusfunc' 'imsf' string (default "")
global global
{not in Vi} {not in Vi}
{only available when compiled with |+xim| and {only available when compiled with |+mbyte|}
|+GUI_GTK|}
This option specifies a function that is called to obtain the status This option specifies a function that is called to obtain the status
of Input Method. It must return a positive number when IME is active. of Input Method. It must return a positive number when IME is active.
It is not used in the GUI.
Example: > Example: >
function ImStatusFunc() function ImStatusFunc()
@@ -6154,11 +6154,34 @@ A jump table for the options with a short description can be found at |Q_op|.
Example: > Example: >
set encoding=utf-8 set encoding=utf-8
set gfn=Ricty_Diminished:h12:cSHIFTJIS set gfn=Ricty_Diminished:h12
set rop=type:directx set rop=type:directx
< <
If select a raster font (Courier, Terminal or FixedSys) to If select a raster font (Courier, Terminal or FixedSys which
'guifont', it fallbacks to be drawn by GDI automatically. have ".fon" extension in file name) to 'guifont', it will be
drawn by GDI as a fallback. This fallback will cause
significant slow down on drawing.
NOTE: It is known that some fonts and options combination
causes trouble on drawing glyphs.
- 'rendmode:5' and 'renmode:6' will not work with some
special made fonts (True-Type fonts which includes only
bitmap glyphs).
- 'taamode:3' will not work with some vector fonts.
NOTE: With this option, you can display colored emoji
(emoticon) in Windows 8.1 or later. To display colored emoji,
there are some conditions which you should notice.
- If your font includes non-colored emoji already, it will
be used.
- If your font doesn't have emoji, the system chooses an
alternative symbol font. On Windows 10, "Segoe UI Emoji"
will be used.
- When this alternative font didn't have fixed width glyph,
emoji might be rendered beyond the bounding box of drawing
cell.
Other render types are currently not supported. Other render types are currently not supported.

View File

@@ -1,4 +1,4 @@
*quickref.txt* For Vim version 8.0. Last change: 2017 Oct 19 *quickref.txt* For Vim version 8.0. Last change: 2017 Nov 21
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -618,7 +618,8 @@ Short explanation of each option: *option-list*
'backupext' 'bex' extension used for the backup file 'backupext' 'bex' extension used for the backup file
'backupskip' 'bsk' no backup for files that match these patterns 'backupskip' 'bsk' no backup for files that match these patterns
'balloondelay' 'bdlay' delay in mS before a balloon may pop up 'balloondelay' 'bdlay' delay in mS before a balloon may pop up
'ballooneval' 'beval' switch on balloon evaluation 'ballooneval' 'beval' switch on balloon evaluation in the GUI
'balloonevalterm' 'bevalterm' switch on balloon evaluation in the terminal
'balloonexpr' 'bexpr' expression to show in balloon 'balloonexpr' 'bexpr' expression to show in balloon
'belloff' 'bo' do not ring the bell for these reasons 'belloff' 'bo' do not ring the bell for these reasons
'binary' 'bin' read/write/edit file in binary mode 'binary' 'bin' read/write/edit file in binary mode

View File

@@ -1,4 +1,4 @@
*remote.txt* For Vim version 8.0. Last change: 2017 Aug 01 *remote.txt* For Vim version 8.0. Last change: 2017 Nov 12
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -181,7 +181,8 @@ name on the 'VimRegistry' property on the root window.
A non GUI Vim with access to the X11 display (|xterm-clipboard| enabled), can A non GUI Vim with access to the X11 display (|xterm-clipboard| enabled), can
also act as a command server if a server name is explicitly given with the also act as a command server if a server name is explicitly given with the
--servername argument. --servername argument, or when Vim was build with the |+autoservername|
feature.
An empty --servername argument will cause the command server to be disabled. An empty --servername argument will cause the command server to be disabled.

View File

@@ -1,4 +1,4 @@
*starting.txt* For Vim version 8.0. Last change: 2017 Nov 11 *starting.txt* For Vim version 8.0. Last change: 2017 Nov 18
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -58,9 +58,9 @@ filename One or more file names. The first one will be the current
that is read from stdin. The commands that would normally be that is read from stdin. The commands that would normally be
read from stdin will now be read from stderr. Example: > read from stdin will now be read from stderr. Example: >
find . -name "*.c" -print | vim - find . -name "*.c" -print | vim -
< The buffer will be marked modified, because it contains text < The buffer will not be marked as modified, so that it's easy
that needs to be saved. Except when in readonly mode, then to exit. Be careful to mark it as modified if you don't want
the buffer is not marked modified. Example: > to accidentally lose it. Example: >
ls | view - ls | view -
< <
Starting in Ex mode: > Starting in Ex mode: >
@@ -421,7 +421,9 @@ a slash. Thus "-R" means recovery and "-/R" readonly.
*--not-a-term* *--not-a-term*
--not-a-term Tells Vim that the user knows that the input and/or output is --not-a-term Tells Vim that the user knows that the input and/or output is
not connected to a terminal. This will avoid the warning and not connected to a terminal. This will avoid the warning and
the two second delay that would happen. {not in Vi} the two second delay that would happen.
Also avoids the "Reading from stdin..." message.
{not in Vi}
*--ttyfail* *--ttyfail*
--ttyfail When the stdin or stdout is not a terminal (tty) then exit --ttyfail When the stdin or stdout is not a terminal (tty) then exit

View File

@@ -74,12 +74,14 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
'backupskip' options.txt /*'backupskip'* 'backupskip' options.txt /*'backupskip'*
'balloondelay' options.txt /*'balloondelay'* 'balloondelay' options.txt /*'balloondelay'*
'ballooneval' options.txt /*'ballooneval'* 'ballooneval' options.txt /*'ballooneval'*
'balloonevalterm' options.txt /*'balloonevalterm'*
'balloonexpr' options.txt /*'balloonexpr'* 'balloonexpr' options.txt /*'balloonexpr'*
'bdir' options.txt /*'bdir'* 'bdir' options.txt /*'bdir'*
'bdlay' options.txt /*'bdlay'* 'bdlay' options.txt /*'bdlay'*
'beautify' vi_diff.txt /*'beautify'* 'beautify' vi_diff.txt /*'beautify'*
'belloff' options.txt /*'belloff'* 'belloff' options.txt /*'belloff'*
'beval' options.txt /*'beval'* 'beval' options.txt /*'beval'*
'bevalterm' options.txt /*'bevalterm'*
'bex' options.txt /*'bex'* 'bex' options.txt /*'bex'*
'bexpr' options.txt /*'bexpr'* 'bexpr' options.txt /*'bexpr'*
'bf' vi_diff.txt /*'bf'* 'bf' vi_diff.txt /*'bf'*
@@ -505,7 +507,9 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
'noawa' options.txt /*'noawa'* 'noawa' options.txt /*'noawa'*
'nobackup' options.txt /*'nobackup'* 'nobackup' options.txt /*'nobackup'*
'noballooneval' options.txt /*'noballooneval'* 'noballooneval' options.txt /*'noballooneval'*
'noballoonevalterm' options.txt /*'noballoonevalterm'*
'nobeval' options.txt /*'nobeval'* 'nobeval' options.txt /*'nobeval'*
'nobevalterm' options.txt /*'nobevalterm'*
'nobin' options.txt /*'nobin'* 'nobin' options.txt /*'nobin'*
'nobinary' options.txt /*'nobinary'* 'nobinary' options.txt /*'nobinary'*
'nobiosk' options.txt /*'nobiosk'* 'nobiosk' options.txt /*'nobiosk'*
@@ -1223,7 +1227,9 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
+acl various.txt /*+acl* +acl various.txt /*+acl*
+arabic various.txt /*+arabic* +arabic various.txt /*+arabic*
+autocmd various.txt /*+autocmd* +autocmd various.txt /*+autocmd*
+autoservername various.txt /*+autoservername*
+balloon_eval various.txt /*+balloon_eval* +balloon_eval various.txt /*+balloon_eval*
+balloon_eval_term various.txt /*+balloon_eval_term*
+browse various.txt /*+browse* +browse various.txt /*+browse*
+builtin_terms various.txt /*+builtin_terms* +builtin_terms various.txt /*+builtin_terms*
+byte_offset various.txt /*+byte_offset* +byte_offset various.txt /*+byte_offset*
@@ -4569,6 +4575,7 @@ E945 pattern.txt /*E945*
E946 terminal.txt /*E946* E946 terminal.txt /*E946*
E947 terminal.txt /*E947* E947 terminal.txt /*E947*
E948 terminal.txt /*E948* E948 terminal.txt /*E948*
E949 editing.txt /*E949*
E95 message.txt /*E95* E95 message.txt /*E95*
E96 diff.txt /*E96* E96 diff.txt /*E96*
E97 diff.txt /*E97* E97 diff.txt /*E97*
@@ -5145,6 +5152,7 @@ backup-extension version4.txt /*backup-extension*
backup-table editing.txt /*backup-table* backup-table editing.txt /*backup-table*
balloon-eval debugger.txt /*balloon-eval* balloon-eval debugger.txt /*balloon-eval*
balloon_show() eval.txt /*balloon_show()* balloon_show() eval.txt /*balloon_show()*
balloon_split() eval.txt /*balloon_split()*
bar motion.txt /*bar* bar motion.txt /*bar*
bars help.txt /*bars* bars help.txt /*bars*
base_font_name_list mbyte.txt /*base_font_name_list* base_font_name_list mbyte.txt /*base_font_name_list*

View File

@@ -1,4 +1,4 @@
*todo.txt* For Vim version 8.0. Last change: 2017 Nov 11 *todo.txt* For Vim version 8.0. Last change: 2017 Nov 21
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -35,10 +35,6 @@ 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 -----------------------
Permission of viminfo tempfile can be wrong. (Simon Ruderich)
Always use 600 ? Also avoids groups problem.
patch from Simon Ruderich, Nov 8
No maintainer for Vietnamese translations. No maintainer for Vietnamese translations.
No maintainer for Simplified Chinese translations. No maintainer for Simplified Chinese translations.
@@ -49,10 +45,6 @@ Terminal emulator window:
- Implement the right-click popup menu for the terminal. Can use the - Implement the right-click popup menu for the terminal. Can use the
completion popup menu code and mouse dragging. completion popup menu code and mouse dragging.
Use it for "set breakpoint", "remove breakpoint", etc. Use it for "set breakpoint", "remove breakpoint", etc.
- make showballoon() work in a terminal. Requires getting mouse-move
events.
- send 'balloonText' events for the cursor position (using CursorHold ?)
in terminal mode.
- get ideas from http://clewn.sf.net - get ideas from http://clewn.sf.net
- Look into the idevim plugin/script. - Look into the idevim plugin/script.
- Improve testing: - Improve testing:
@@ -88,6 +80,8 @@ Terminal emulator window:
Although user could use "xterm -e 'cmd arg'". Although user could use "xterm -e 'cmd arg'".
Regexp problems: Regexp problems:
- When search pattern has the base character both with and without combining
character, search fails. E.g. "รรีบ" in "การรีบรักใคร". (agguser, #2312)
- [:space:] only matches ASCII spaces. Add [:white:] for all space-like - [:space:] only matches ASCII spaces. Add [:white:] for all space-like
characters, esp. including 0xa0. Use character class zero. characters, esp. including 0xa0. Use character class zero.
- Since 7.4.704 the old regex engine fails to match [[:print:]] in 0xf6. - Since 7.4.704 the old regex engine fails to match [[:print:]] in 0xf6.
@@ -136,7 +130,7 @@ Regexp problems:
Include a few color schemes, based on popularity: Include a few color schemes, based on popularity:
http://www.vim.org/scripts/script_search_results.php?keywords=&script_type=color+scheme&order_by=rating&direction=descending&search=search http://www.vim.org/scripts/script_search_results.php?keywords=&script_type=color+scheme&order_by=rating&direction=descending&search=search
http://vimawesome.com/?q=tag:color-scheme http://vimawesome.com/?q=tag:color-scheme
Use names that indicate their apperance (Christian Brabandt, 2017 Aug 3) Use names that indicate their appearance (Christian Brabandt, 2017 Aug 3)
- monokai - Xia Crusoe (2017 Aug 4) - monokai - Xia Crusoe (2017 Aug 4)
- seoul256 - Christian Brabandt (2017 Aug 3) - seoul256 - Christian Brabandt (2017 Aug 3)
- gruvbox - Christian Brabandt (2017 Aug 3) - gruvbox - Christian Brabandt (2017 Aug 3)
@@ -147,6 +141,7 @@ Suggested by Hiroki Kokubun:
- [hybrid](https://github.com/w0ng/vim-hybrid) - [hybrid](https://github.com/w0ng/vim-hybrid)
Include solarized color scheme?, it does not support termguicolors. Include solarized color scheme?, it does not support termguicolors.
-> Make check for colorscheme that it's sane. -> Make check for colorscheme that it's sane.
- Sanitized version of pablo (Lifepillar, 2017 Nov 21)
Compiler warnings (geeknik, 2017 Oct 26): Compiler warnings (geeknik, 2017 Oct 26):
- signed integer overflow in do_sub() (#2249) - signed integer overflow in do_sub() (#2249)
@@ -155,6 +150,13 @@ 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,
2017 Nov 19, #2349)
'hlsearch' shows empty matches, which means highlighting everything.
Don't do that. For "foo\|" or "\v"
Patch from Christian, 2017 Nov 14. Should still display "$" matches.
When starting with --clean packages under "start" are not loaded. Make this When starting with --clean packages under "start" are not loaded. Make this
work: :packadd START {name} similar to :runtime START name work: :packadd START {name} similar to :runtime START name
@@ -169,6 +171,12 @@ 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.
@@ -176,19 +184,38 @@ 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)
Invalid range error when using BufWinLeave for closing terminal.
(Gabriel Barta, 2017 Nov 15, #2339)
ml_get errors with buggy script. (Dominique, 2017 Apr 30) ml_get errors with buggy script. (Dominique, 2017 Apr 30)
Error in emsg with buggy script. (Dominique, 2017 Apr 30) Error in emsg with buggy script. (Dominique, 2017 Apr 30)
Patch to avoid clearing the intro message on Win32 console.
(Ken Takata, 2017 Nov 14)
Patch to copy buffer-local options before buffer leaves the window. (Bjorn
Linse, 2017 Nov 14, #2336)
When a timer is running and typing CTRL-R on the command line, it is not When a timer is running and typing CTRL-R on the command line, it is not
redrawn properly. (xtal8, 2017 Oct 23, #2241) redrawn properly. (xtal8, 2017 Oct 23, #2241)
Universal solution to detect if t_RS is working, using cursor position. Universal solution to detect if t_RS is working, using cursor position.
Koichi Iwamoto, #2126 Koichi Iwamoto, #2126
Patch to fix cmdline abbreviation after '<,'>. (Christian Brabandt, 2017 Nov
13, on issue #2320)
Patch to add TextDeletePost and TextYankPost events. (Philippe Vaucher, 2011
May 24) Update May 26.
Now in patch by Lemonboy, #2333 (who is Lemonboy?)
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?
Patch for improving detecting Ruby on Mac in configure. (Ilya Mikhaltsou, 2017
Nov 21)
When using command line window, CmdlineLeave is triggered without When using command line window, CmdlineLeave is triggered without
CmdlineEnter. (xtal8, 2017 Oct 30, #2263) CmdlineEnter. (xtal8, 2017 Oct 30, #2263)
Add some way to get the nested state. Although CmdwinEnter is obviously Add some way to get the nested state. Although CmdwinEnter is obviously
@@ -196,9 +223,14 @@ always nested.
matchit hasn't been maintained for a long time. #955. matchit hasn't been maintained for a long time. #955.
Problem with 'delcombine'. (agguser, 2017 Nov 10, #2313)
MS-Windows: buffer completetion doesn't work when using backslash (or slash) MS-Windows: buffer completetion doesn't work when using backslash (or slash)
for a path separator. (xtal8, #2201) for a path separator. (xtal8, #2201)
Patch to adjust to DPI setting for GTK. (Roel van de Kraats, 2017 Nov 20,
#2357)
Test runtime files. Test runtime files.
Start with filetype detection: testdir/test_filetype.vim Start with filetype detection: testdir/test_filetype.vim
@@ -217,15 +249,22 @@ Still happens (2017 Jul 9)
When bracketed paste is used, pasting at the ":append" prompt does not get the When bracketed paste is used, pasting at the ":append" prompt does not get the
line breaks. (Ken Takata, 2017 Aug 22) line breaks. (Ken Takata, 2017 Aug 22)
The ":move" command does not honor closed folds. (Ryan Lue, #2351)
Patch for 24 bit color support in MS-Windows console, using vcon. (Nobuhiro Patch for 24 bit color support in MS-Windows console, using vcon. (Nobuhiro
Takasaki, 2017 Oct 1, #2060). Ready to include now? Takasaki, Ken Takata, 2017 Oct 1, #2060).
Memory leaks in test_channel? (or is it because of fork()) Memory leaks in test_channel? (or is it because of fork())
Memory leak in test_arabic. Memory leak in test_arabic.
Using uninitialized value in test_crypt. Using uninitialized value in test_crypt.
Patch to clear background when "guibg=NONE" is used and 'termguicolors' is
set.
Patch to make gM move to middle of line. (Yasuhiro Matsumoto, Sep 8, #2070) Patch to make gM move to middle of line. (Yasuhiro Matsumoto, Sep 8, #2070)
Cannot copy modeless selection when cursor is inside it. (lkintact, #2300)
Include Haiku port. (Adrien Destugues, Siarzhuk Zharski, 2013 Oct 24) Include Haiku port. (Adrien Destugues, Siarzhuk Zharski, 2013 Oct 24)
It can replace the BeOS code, which is likely not used anymore. It can replace the BeOS code, which is likely not used anymore.
Now on github: #1856. Updated Oct 2017 Now on github: #1856. Updated Oct 2017
@@ -290,8 +329,15 @@ Patch to add argument to :cquit. (Thinca, 2014 Oct 12)
Python: After "import vim" error messages only show the first line of the Python: After "import vim" error messages only show the first line of the
stack trace. (Yggdroot, 2017 Jul 28, #1887) stack trace. (Yggdroot, 2017 Jul 28, #1887)
Profile of a dict function is lost when the dict is deleted. Would it be
possible to collect this? (Daniel Hahler, #2350)
Patch to add "module" to quickfix entries. (Marcin Szamotulski, Coot, 2017 Jun Patch to add "module" to quickfix entries. (Marcin Szamotulski, Coot, 2017 Jun
8, #1757) 8, #1757) Now part of #2322. Or #2327? #1757 was re-opened, include that
first.
Add `:filter` support for various commands (Marcin Szamotulski, 2017 Nov 12
#2322) Now in #2327?
When checking if a bufref is valid, also check the buffer number, to catch the When checking if a bufref is valid, also check the buffer number, to catch the
case of :bwipe followed by :new. case of :bwipe followed by :new.
@@ -1484,9 +1530,6 @@ Build problem with small features on Mac OS X 10.6. (Rainer, 2011 Jan 24)
"0g@$" puts '] on last byte of multi-byte. (ZyX, 2011 Jan 22) "0g@$" puts '] on last byte of multi-byte. (ZyX, 2011 Jan 22)
Patch to add TextDeletePost and TextYankPost events. (Philippe Vaucher, 2011
May 24) Update May 26.
Patch for :tabrecently. (Hirokazu Yoshida, 2012 Jan 30) Patch for :tabrecently. (Hirokazu Yoshida, 2012 Jan 30)
Problem with "syn sync grouphere". (Gustavo Niemeyer, 2011 Jan 27) Problem with "syn sync grouphere". (Gustavo Niemeyer, 2011 Jan 27)
@@ -4653,7 +4696,7 @@ Command line history:
- Add "KeyWasTyped" flag: It's reset before each command and set when a - Add "KeyWasTyped" flag: It's reset before each command and set when a
character from the keyboard is consumed. Value is used to decide to put a character from the keyboard is consumed. Value is used to decide to put a
command line in history or not. Put line in history if it didn't command line in history or not. Put line in history if it didn't
completely resulted from one mapping. completely result from one mapping.
- When using ":browse", also put the resulting edit command in the history, - When using ":browse", also put the resulting edit command in the history,
so that it can be repeated. (Demirel) so that it can be repeated. (Demirel)

View File

@@ -1,4 +1,4 @@
*usr_41.txt* For Vim version 8.0. Last change: 2017 Oct 15 *usr_41.txt* For Vim version 8.0. Last change: 2017 Nov 19
VIM USER MANUAL - by Bram Moolenaar VIM USER MANUAL - by Bram Moolenaar
@@ -886,6 +886,7 @@ GUI: *gui-functions*
getwinposx() X position of the GUI Vim window getwinposx() X position of the GUI Vim window
getwinposy() Y position of the GUI Vim window getwinposy() Y position of the GUI Vim window
balloon_show() set the balloon content balloon_show() set the balloon content
balloon_split() split a message for a balloon
Vim server: *server-functions* Vim server: *server-functions*
serverlist() return the list of server names serverlist() return the list of server names

View File

@@ -1,4 +1,4 @@
*various.txt* For Vim version 8.0. Last change: 2017 Sep 16 *various.txt* For Vim version 8.0. Last change: 2017 Nov 18
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -310,9 +310,12 @@ g8 Print the hex values of the bytes used in the
B *+arabic* |Arabic| language support B *+arabic* |Arabic| language support
N *+autocmd* |:autocmd|, automatic commands N *+autocmd* |:autocmd|, automatic commands
H *+autoservername* Automatically enable |clientserver| H *+autoservername* Automatically enable |clientserver|
m *+balloon_eval* |balloon-eval| support. Included when compiling with m *+balloon_eval* |balloon-eval| support in the GUI. Included when
supported GUI (Motif, GTK, GUI) and either compiling with supported GUI (Motif, GTK, GUI) and
Netbeans/Sun Workshop integration or |+eval| feature. either Netbeans/Sun Workshop integration or |+eval|
feature.
H *+balloon_eval_term* |balloon-eval| support in the terminal,
'balloonevalterm'
N *+browse* |:browse| command N *+browse* |:browse| command
N *+builtin_terms* some terminals builtin |builtin-terms| N *+builtin_terms* some terminals builtin |builtin-terms|
B *++builtin_terms* maximal terminals builtin |builtin-terms| B *++builtin_terms* maximal terminals builtin |builtin-terms|

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 11 " Last Change: 2017 Nov 21
" 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")
@@ -231,10 +231,10 @@ au BufNewFile,BufRead *.bl setf blank
au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml
" Bazel (http://bazel.io) " Bazel (http://bazel.io)
autocmd BufRead,BufNewFile *.bzl,WORKSPACE setf bzl autocmd BufRead,BufNewFile *.bzl,WORKSPACE,BUILD.bazel setf bzl
if has("fname_case") if has("fname_case")
" There is another check for BUILD further below. " There is another check for BUILD further below.
autocmd BufRead,BufNewFile BUILD setf bzl autocmd BufRead,BufNewFile BUILD setf bzl
endif endif
" C or lpc " C or lpc

View File

@@ -1,7 +1,7 @@
" These commands create the option window. " These commands create the option window.
" "
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2017 Oct 19 " Last Change: 2017 Nov 21
" If there already is an option window, jump to that one. " If there already is an option window, jump to that one.
let buf = bufnr('option-window') let buf = bufnr('option-window')
@@ -647,11 +647,17 @@ if has("gui")
endif endif
call append("$", "linespace\tnumber of pixel lines to use between characters") call append("$", "linespace\tnumber of pixel lines to use between characters")
call append("$", " \tset lsp=" . &lsp) call append("$", " \tset lsp=" . &lsp)
if has("balloon_eval") if has("balloon_eval") || has("balloon_eval_term")
call append("$", "balloondelay\tdelay in milliseconds before a balloon may pop up") call append("$", "balloondelay\tdelay in milliseconds before a balloon may pop up")
call append("$", " \tset bdlay=" . &bdlay) call append("$", " \tset bdlay=" . &bdlay)
call append("$", "ballooneval\twhether the balloon evaluation is to be used") if has("balloon_eval")
call <SID>BinOptionG("beval", &beval) call append("$", "ballooneval\tuse balloon evaluation in the GUI")
call <SID>BinOptionG("beval", &beval)
endif
if has("balloon_eval_term")
call append("$", "balloonevalterm\tuse balloon evaluation in the terminal")
call <SID>BinOptionG("bevalterm", &beval)
endif
if has("eval") if has("eval")
call append("$", "balloonexpr\texpression to show in balloon eval") call append("$", "balloonexpr\texpression to show in balloon eval")
call append("$", " \tset bexpr=" . &bexpr) call append("$", " \tset bexpr=" . &bexpr)

View File

@@ -2,11 +2,10 @@
" Language: doxygen on top of c, cpp, idl, java, php " Language: doxygen on top of c, cpp, idl, java, php
" Maintainer: Michael Geddes <vimmer@frog.wheelycreek.net> " Maintainer: Michael Geddes <vimmer@frog.wheelycreek.net>
" Author: Michael Geddes " Author: Michael Geddes
" Last Changes: Jan 2009 (\tparam by Domnique Pelle, Aug 2013) " Last Change: November 2017 (\throws by Candy Gumdrop)
" Nov 2017 (@throws by Domnique Pelle) " Version: 1.27
" Version: 1.23
" "
" Copyright 2004-2008 Michael Geddes " Copyright 2004-2017 Michael Geddes
" Please feel free to use, modify & distribute all or part of this script, " Please feel free to use, modify & distribute all or part of this script,
" providing this copyright message remains. " providing this copyright message remains.
" I would appreciate being acknowledged in any derived scripts, and would " I would appreciate being acknowledged in any derived scripts, and would
@@ -59,52 +58,76 @@ try
" "
" C/C++ Style line comments " C/C++ Style line comments
syn region doxygenComment start=+/\*\(\*/\)\@![*!]+ end=+\*/+ contains=doxygenSyncStart,doxygenStart,doxygenTODO keepend fold containedin=phpRegion syn match doxygenCommentWhite +\s*\ze/\*\(\*/\)\@![*!]+ containedin=phpRegion
syn region doxygenCommentL start=+//[/!]<\@!+me=e-1 end=+$+ contains=doxygenStartL,@Spell keepend skipwhite skipnl nextgroup=doxygenComment2 fold containedin=phpRegion syn match doxygenCommentWhite +\s*\ze//[/!]+ containedin=phpRegion
syn match doxygenCommentWhite +\s*\ze/\*\(\*/\)\@![*!]+
syn match doxygenCommentWhite +\s*\ze//[/!]+ containedin=phpRegion
syn region doxygenComment start=+/\*\(\*/\)\@![*!]+ end=+\*/+ contains=doxygenSyncStart,doxygenStart,doxygenTODO,doxygenLeadingWhite keepend fold containedin=phpRegion
syn region doxygenCommentL start=+//[/!]<\@!+me=e-1 end=+$+ contains=doxygenLeadingLWhite,doxygenStartL,@Spell keepend skipwhite skipnl nextgroup=doxygenCommentWhite2 fold containedin=phpRegion
syn region doxygenCommentL start=+//[/!]<+me=e-2 end=+$+ contains=doxygenStartL,@Spell keepend skipwhite skipnl fold containedin=phpRegion syn region doxygenCommentL start=+//[/!]<+me=e-2 end=+$+ contains=doxygenStartL,@Spell keepend skipwhite skipnl fold containedin=phpRegion
syn region doxygenCommentL start=+//@\ze[{}]+ end=+$+ contains=doxygenGroupDefine,doxygenGroupDefineSpecial,@Spell fold containedin=phpRegion syn region doxygenCommentL start=+//@\ze[{}]+ end=+$+ contains=doxygenGroupDefine,doxygenGroupDefineSpecial,@Spell fold containedin=phpRegion
syn region doxygenComment start=+/\*@\ze[{}]+ end=+\*/+ contains=doxygenGroupDefine,doxygenGroupDefineSpecial,@Spell fold containedin=phpRegion
" Single line brief followed by multiline comment. " Single line brief followed by multiline comment.
syn match doxygenCommentWhite2 +\_s*\ze/\*\(\*/\)\@![*!]+ contained nextgroup=doxygenComment2
syn region doxygenComment2 start=+/\*\(\*/\)\@![*!]+ end=+\*/+ contained contains=doxygenSyncStart2,doxygenStart2,doxygenTODO keepend fold syn region doxygenComment2 start=+/\*\(\*/\)\@![*!]+ end=+\*/+ contained contains=doxygenSyncStart2,doxygenStart2,doxygenTODO keepend fold
" This helps with sync-ing as for some reason, syncing behaves differently to a normal region, and the start pattern does not get matched. " This helps with sync-ing as for some reason, syncing behaves differently to a normal region, and the start pattern does not get matched.
syn match doxygenSyncStart2 +[^*/]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenStartSpecial,doxygenSkipComment,doxygenStartSkip2 skipwhite skipnl syn match doxygenSyncStart2 +[^*/]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenStartSpecial,doxygenSkipComment,doxygenStartSkip2 skipwhite skipnl
" Skip empty lines at the start for when comments start on the 2nd/3rd line. " Skip empty lines at the start for when comments start on the 2nd/3rd line.
syn match doxygenStartSkip2 +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenBody,doxygenStartSpecial,doxygenStartSkip skipwhite skipnl syn match doxygenStartSkip2 +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenBody,doxygenStartSpecial,doxygenStartSkipWhite skipwhite skipnl
syn match doxygenStartSkip2 +^\s*\*$+ contained nextgroup=doxygenBody,doxygenStartSpecial,,doxygenStartSkip skipwhite skipnl syn match doxygenStartSkip2 +^\s*\*$+ contained nextgroup=doxygenBody,doxygenStartSpecial,doxygenStartSkipWhite skipwhite skipnl
syn match doxygenStart2 +/\*[*!]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenStartSpecial,doxygenStartSkip2 skipwhite skipnl syn match doxygenStart2 +/\*[*!]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenStartSpecial,doxygenStartSkip2 skipwhite skipnl
" Match the Starting pattern (effectively creating the start of a BNF) " Match the Starting pattern (effectively creating the start of a BNF)
if !exists('g:doxygen_javadoc_autobrief') || g:doxygen_javadoc_autobrief if !exists('g:doxygen_javadoc_autobrief') || g:doxygen_javadoc_autobrief
syn match doxygenStart +/\*[*!]+ contained nextgroup=doxygenBrief,doxygenPrev,doxygenFindBriefSpecial,doxygenStartSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl syn match doxygenStart +/\*[*!]+ contained nextgroup=doxygenBrief,doxygenPrev,doxygenFindBriefSpecial,doxygenStartSpecial,doxygenStartSkipWhite,doxygenPage skipwhite skipnl
syn match doxygenStartL +//[/!]+ contained nextgroup=doxygenPrevL,doxygenBriefL,doxygenSpecial skipwhite syn match doxygenLeadingLWhite +\s\++ contained nextgroup=doxygenPrevL,doxygenBriefL,doxygenSpecial
syn match doxygenStartL +//[/!]+ contained nextgroup=doxygenLeaingLWhite,doxygenPrevL,doxygenBriefL,doxygenSpecial
" Match the first sentence as a brief comment " Match the first sentence as a brief comment
if ! exists('g:doxygen_end_punctuation') if ! exists('g:doxygen_end_punctuation')
let g:doxygen_end_punctuation='[.]' let g:doxygen_end_punctuation='[.]'
endif endif
exe 'syn region doxygenBrief contained start=+[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]+ start=+\(^\s*\)\@<!\*/\@!+ start=+\<\k+ skip=+'.doxygen_end_punctuation.'\S\@=+ end=+'.doxygen_end_punctuation.'+ end=+\(\s*\(\n\s*\*\=\s*\)[@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\@=+ contains=doxygenSmallSpecial,doxygenContinueComment,doxygenBriefEndComment,doxygenFindBriefSpecial,doxygenSmallSpecial,@doxygenHtmlGroup,doxygenTODO,doxygenHyperLink,doxygenHashLink,@Spell skipnl nextgroup=doxygenBody' exe 'syn region doxygenBrief contained start=+[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]+ start=+\(^\s*\)\@<!\*/\@!+ start=+\<\k+ skip=+'.doxygen_end_punctuation.'\S\@=+ end=+'.doxygen_end_punctuation.'+ end=+\(\s*\(\n\s*\*\=\s*\)[@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\@=+ contains=doxygenSmallSpecial,doxygenContinueCommentWhite,doxygenLeadingWhite,doxygenBriefEndComment,doxygenFindBriefSpecial,doxygenSmallSpecial,@doxygenHtmlGroup,doxygenTODO,doxygenHyperLink,doxygenHashLink,@Spell skipnl nextgroup=doxygenBody'
syn match doxygenBriefEndComment +\*/+ contained syn match doxygenBriefEndComment +\*/+ contained
exe 'syn region doxygenBriefL start=+@\k\@!\|[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@]+ start=+\<+ skip=+'.doxygen_end_punctuation.'\S+ end=+'.doxygen_end_punctuation.'\|$+ contained contains=doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell keepend' exe 'syn region doxygenBriefL start=+@\k\@!\|[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@]+ start=+\<+ skip=+'.doxygen_end_punctuation.'\S+ end=+'.doxygen_end_punctuation.'\|$+ contained contains=doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell keepend'
syn match doxygenPrevL +<+ contained nextgroup=doxygenBriefL,doxygenSpecial skipwhite syn match doxygenPrevL +<+ contained nextgroup=doxygenBriefL,doxygenSpecial skipwhite
else else
syn match doxygenStart +/\*[*!]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenFindBriefSpecial,doxygenStartSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl syn match doxygenStart +/\*[*!]+ contained nextgroup=doxygenBody,doxygenPrev,doxygenFindBriefSpecial,doxygenStartSpecial,doxygenStartSkipWhite,doxygenPage skipwhite skipnl
syn match doxygenStartL +//[/!]+ contained nextgroup=doxygenPrevL,doxygenLine,doxygenSpecial skipwhite syn match doxygenStartL +//[/!]+ contained nextgroup=doxygenLeadingLWhite,doxygenPrevL,doxygenLine,doxygenSpecial
syn match doxygenLeadingLWhite +\s\++ contained nextgroup=doxygenPrevL,doxygenLine,doxygenSpecial
syn region doxygenLine start=+@\k\@!\|[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@<]+ start=+\<+ end='$' contained contains=doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell keepend syn region doxygenLine start=+@\k\@!\|[\\@]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@<]+ start=+\<+ end='$' contained contains=doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell keepend
syn match doxygenPrevL +<+ contained nextgroup=doxygenLine,doxygenSpecial skipwhite syn match doxygenPrevL +<+ contained nextgroup=doxygenLine,doxygenSpecial skipwhite
endif endif
" This helps with sync-ing as for some reason, syncing behaves differently to a normal region, and the start pattern does not get matched. " This helps with sync-ing as for some reason, syncing behaves differently to a normal region, and the start pattern does not get matched.
syn match doxygenSyncStart +\ze[^*/]+ contained nextgroup=doxygenBrief,doxygenPrev,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl syn match doxygenSyncStart +\ze[^*/]+ contained nextgroup=doxygenBrief,doxygenPrev,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkipWhite,doxygenPage skipwhite skipnl
" Match an [@\]brief so that it moves to body-mode.
"
"
" syn match doxygenBriefLine contained
syn match doxygenBriefSpecial contained +[@\\]+ nextgroup=doxygenBriefWord skipwhite
" syn region doxygenFindBriefSpecial start=+[@\\]brief\>+ end=+\(\n\s*\*\=\s*\([@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\|\s*$\)\@=+ keepend contains=doxygenBriefSpecial nextgroup=doxygenBody keepend skipwhite skipnl contained
syn region doxygenFindBriefSpecial start=+[@\\]brief\>+ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ keepend contains=doxygenBriefSpecial nextgroup=doxygenBody keepend skipwhite skipnl contained
" end=+\(\n\s*\*\=\s*\([@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\|\s*$\)\@=+
"syn region doxygenBriefLine contained start=+\<\k+ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ contains=doxygenContinueCommentWhite,doxygenSmallSpecial,@doxygenHtmlGroup,doxygenTODO,doxygenHyperLink,doxygenHashLink,@Spell skipwhite keepend matchgroup=xxx
syn region doxygenBriefLine contained start=+\<\k+ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ skipwhite keepend matchgroup=xxx
" syn region doxygenBriefLine matchgroup=xxxy contained start=+\<\k.\++ skip=+^\s*\k+ end=+end+ skipwhite keepend
"doxygenFindBriefSpecial,
"" syn region doxygenSpecialMultilineDesc start=+.\++ contained contains=doxygenSpecialContinueCommentWhite,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell skipwhite keepend
syn region doxygenBriefLine contained start=+\<\k+ end=+\(\n\s*\*\=\s*\([@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\|\s*$\)\@=+ contains=doxygenContinueComment,doxygenFindBriefSpecial,doxygenSmallSpecial,@doxygenHtmlGroup,doxygenTODO,doxygenHyperLink,doxygenHashLink,@Spell skipwhite keepend
" Match a '<' for applying a comment to the previous element. " Match a '<' for applying a comment to the previous element.
syn match doxygenPrev +<+ contained nextgroup=doxygenBrief,doxygenBody,doxygenSpecial,doxygenStartSkip skipwhite syn match doxygenPrev +<+ contained nextgroup=doxygenBrief,doxygenBody,doxygenSpecial,doxygenStartSkipWhite skipwhite
if exists("c_comment_strings") if exists("c_comment_strings")
" These are anti-Doxygen comments. If there are more than two asterisks or 3 '/'s " These are anti-Doxygen comments. If there are more than two asterisks or 3 '/'s
@@ -123,10 +146,11 @@ endif
"syn region doxygenBodyBit contained start=+$+ "syn region doxygenBodyBit contained start=+$+
" The main body of a doxygen comment. " The main body of a doxygen comment.
syn region doxygenBody contained start=+\(/\*[*!]\)\@<!<\|[^<]\|$+ matchgroup=doxygenEndComment end=+\*/+re=e-2,me=e-2 contains=doxygenContinueComment,doxygenTODO,doxygenSpecial,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell syn region doxygenBody contained start=+\(/\*[*!]\)\@<!<\|[^<]\|$+ matchgroup=doxygenEndComment end=+\*/+re=e-2,me=e-2 contains=doxygenContinueCommentWhite,doxygenTODO,doxygenSpecial,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell
" These allow the skipping of comment continuation '*' characters. " These allow the skipping of comment continuation '*' characters.
syn match doxygenContinueComment contained +^\s*\*/\@!\s*+ syn match doxygenContinueCommentWhite contained +^\s*\ze\*+ nextgroup=doxygenContinueComment
syn match doxygenContinueComment contained +\*/\@!+
" Catch a Brief comment without punctuation - flag it as an error but " Catch a Brief comment without punctuation - flag it as an error but
" make sure the end comment is picked up also. " make sure the end comment is picked up also.
@@ -135,27 +159,19 @@ endif
" Skip empty lines at the start for when comments start on the 2nd/3rd line. " Skip empty lines at the start for when comments start on the 2nd/3rd line.
if !exists('g:doxygen_javadoc_autobrief') || g:doxygen_javadoc_autobrief if !exists('g:doxygen_javadoc_autobrief') || g:doxygen_javadoc_autobrief
syn match doxygenStartSkip +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl syn match doxygenStartSkipWhite +^\s*\ze\*/\@!+ contained nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkipWhite,doxygenPage skipwhite skipnl
syn match doxygenStartSkip +^\s*\*$+ contained nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage skipwhite skipnl "syn match doxygenStartSkipWhite +^\s*\ze\*$+ contained nextgroup=doxygenBrief,doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkipWhite,doxygenPage skipwhite skipnl
else else
syn match doxygenStartSkip +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage,doxygenBody skipwhite skipnl syn match doxygenStartSkipWhite +^\s*\*[^/]+me=e-1 contained nextgroup=doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkipWhite,doxygenPage,doxygenBody skipwhite skipnl
syn match doxygenStartSkip +^\s*\*$+ contained nextgroup=doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkip,doxygenPage,doxygenBody skipwhite skipnl syn match doxygenStartSkipWhite +^\s*\*$+ contained nextgroup=doxygenStartSpecial,doxygenFindBriefSpecial,doxygenStartSkipWhite,doxygenPage,doxygenBody skipwhite skipnl
endif endif
" Match an [@\]brief so that it moves to body-mode.
"
"
" syn match doxygenBriefLine contained
syn match doxygenBriefSpecial contained +[@\\]+ nextgroup=doxygenBriefWord skipwhite
syn region doxygenFindBriefSpecial start=+[@\\]brief\>+ end=+\(\n\s*\*\=\s*\([@\\]\([npcbea]\>\|em\>\|ref\>\|link\>\|f\$\|[$\\&<>#]\)\@!\)\|\s*$\)\@=+ keepend contains=doxygenBriefSpecial nextgroup=doxygenBody keepend skipwhite skipnl contained
" Create the single word matching special identifiers. " Create the single word matching special identifiers.
fun! s:DxyCreateSmallSpecial( kword, name ) fun! s:DxyCreateSmallSpecial( kword, name )
let mx='[-:0-9A-Za-z_%=&+*/!~>|]\@<!\([-0-9A-Za-z_%=+*/!~>|#]\+[-0-9A-Za-z_%=+*/!~>|]\@!\|\\[\\<>&.]@\|[.,][0-9a-zA-Z_]\@=\|::\|([^)]*)\|&[0-9a-zA-Z]\{2,7};\)\+' let mx='[-:0-9A-Za-z_%=&+*/!~>|]\@<!\([-0-9A-Za-z_%=+*/!~>|#]\+[-0-9A-Za-z_%=+*/!~>|]\@!\|\\[\\<>&.]@\|[.,][0-9a-zA-Z_]\@=\|::\|([^)]*)\|&[0-9a-zA-Z]\{2,7};\)\+'
exe 'syn region doxygenSpecial'.a:name.'Word contained start=+'.a:kword.'+ end=+\(\_s\+'.mx.'\)\@<=[-a-zA-Z_0-9+*/^%|~!=&\\]\@!+ skipwhite contains=doxygenContinueComment,doxygen'.a:name.'Word' exe 'syn region doxygenSpecial'.a:name.'Word contained start=+'.a:kword.'+ end=+\(\_s\+'.mx.'\)\@<=[-a-zA-Z_0-9+*/^%|~!=&\\]\@!+ skipwhite contains=doxygenContinueCommentWhite,doxygen'.a:name.'Word'
exe 'syn match doxygen'.a:name.'Word contained "\_s\@<='.mx.'" contains=doxygenHtmlSpecial,@Spell keepend' exe 'syn match doxygen'.a:name.'Word contained "\_s\@<='.mx.'" contains=doxygenHtmlSpecial,@Spell keepend'
endfun endfun
call s:DxyCreateSmallSpecial('p', 'Code') call s:DxyCreateSmallSpecial('p', 'Code')
@@ -180,40 +196,42 @@ endif
" Match parameters and retvals (highlighting the first word as special). " Match parameters and retvals (highlighting the first word as special).
syn match doxygenParamDirection contained "\v\[(\s*in>((]\s*\[|\s*,\s*)out>)=|out>((]\s*\[|\s*,\s*)in>)=)\]" nextgroup=doxygenParamName skipwhite syn match doxygenParamDirection contained "\v\[(\s*in>((]\s*\[|\s*,\s*)out>)=|out>((]\s*\[|\s*,\s*)in>)=)\]" nextgroup=doxygenParamName skipwhite
syn keyword doxygenParam contained param tparam nextgroup=doxygenParamName,doxygenParamDirection skipwhite syn keyword doxygenParam contained param nextgroup=doxygenParamName,doxygenParamDirection skipwhite
syn keyword doxygenTParam contained tparam nextgroup=doxygenParamName skipwhite
syn match doxygenParamName contained +[A-Za-z0-9_:]\++ nextgroup=doxygenSpecialMultilineDesc skipwhite syn match doxygenParamName contained +[A-Za-z0-9_:]\++ nextgroup=doxygenSpecialMultilineDesc skipwhite
syn keyword doxygenRetval contained retval throw throws exception nextgroup=doxygenParamName skipwhite syn keyword doxygenRetval contained retval throw throws exception nextgroup=doxygenParamName skipwhite
" Match one line identifiers. " Match one line identifiers.
syn keyword doxygenOther contained addindex anchor syn keyword doxygenOther contained addindex anchor
\ dontinclude endhtmlonly endlatexonly showinitializer hideinitializer \ dontinclude endhtmlonly endlatexonly showinitializer hideinitializer
\ example htmlonly image include ingroup internal latexonly line \ example htmlonly image include includelineno ingroup internal latexonly line
\ overload related relates relatedalso relatesalso sa skip skipline \ overload relates relatesalso sa skip skipline
\ until verbinclude version addtogroup htmlinclude copydoc dotfile \ until verbinclude version addtogroup htmlinclude copydoc dotfile
\ xmlonly endxmlonly \ xmlonly endxmlonly
\ nextgroup=doxygenSpecialOnelineDesc \ nextgroup=doxygenSpecialOnelineDesc copybrief copydetails copyright dir extends
\ implements
syn region doxygenCodeRegion contained matchgroup=doxygenOther start=+\<code\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<endcode\>+ contains=doxygenCodeRegionSpecial,doxygenContinueComment,doxygenErrorComment,@NoSpell syn region doxygenCodeRegion contained matchgroup=doxygenOther start=+\<code\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<endcode\>+ contains=doxygenCodeRegionSpecial,doxygenContinueCommentWhite,doxygenErrorComment,@NoSpell
syn match doxygenCodeRegionSpecial contained +[\\@]\(endcode\>\)\@=+ syn match doxygenCodeRegionSpecial contained +[\\@]\(endcode\>\)\@=+
syn region doxygenVerbatimRegion contained matchgroup=doxygenOther start=+\<verbatim\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<endverbatim\>+ contains=doxygenVerbatimRegionSpecial,doxygenContinueComment,doxygenErrorComment,@NoSpell syn region doxygenVerbatimRegion contained matchgroup=doxygenOther start=+\<verbatim\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<endverbatim\>+ contains=doxygenVerbatimRegionSpecial,doxygenContinueCommentWhite,doxygenErrorComment,@NoSpell
syn match doxygenVerbatimRegionSpecial contained +[\\@]\(endverbatim\>\)\@=+ syn match doxygenVerbatimRegionSpecial contained +[\\@]\(endverbatim\>\)\@=+
if exists('b:current_syntax') if exists('b:current_syntax')
let b:doxygen_syntax_save=b:current_syntax let b:doxygen_syntax_save=b:current_syntax
unlet b:current_syntax unlet b:current_syntax
endif endif
syn include @Dotx syntax/dot.vim syn include @Dotx syntax/dot.vim
if exists('b:doxygen_syntax_save') if exists('b:doxygen_syntax_save')
let b:current_syntax=b:doxygen_syntax_save let b:current_syntax=b:doxygen_syntax_save
unlet b:doxygen_syntax_save unlet b:doxygen_syntax_save
else else
unlet b:current_syntax unlet b:current_syntax
endif endif
syn region doxygenDotRegion contained matchgroup=doxygenOther start=+\<dot\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<enddot\>+ contains=doxygenDotRegionSpecial,doxygenErrorComment,doxygenContinueComment,@NoSpell,@Dotx syn region doxygenDotRegion contained matchgroup=doxygenOther start=+\<dot\>+ matchgroup=doxygenOther end=+[\\@]\@<=\<enddot\>+ contains=doxygenDotRegionSpecial,doxygenErrorComment,doxygenContinueCommentWhite,@NoSpell,@Dotx
syn match doxygenDotRegionSpecial contained +[\\@]\(enddot\>\)\@=+ syn match doxygenDotRegionSpecial contained +[\\@]\(enddot\>\)\@=+
" Match single line identifiers. " Match single line identifiers.
@@ -224,13 +242,13 @@ endif
syn keyword doxygenOther contained par nextgroup=doxygenHeaderLine syn keyword doxygenOther contained par nextgroup=doxygenHeaderLine
syn region doxygenHeaderLine start=+.+ end=+^+ contained skipwhite nextgroup=doxygenSpecialMultilineDesc syn region doxygenHeaderLine start=+.+ end=+^+ contained skipwhite nextgroup=doxygenSpecialMultilineDesc
syn keyword doxygenOther contained arg author authors date deprecated li result return returns see invariant note post pre remark remarks since test nextgroup=doxygenSpecialMultilineDesc syn keyword doxygenOther contained arg author authors date deprecated li return returns see invariant note post pre remarks since test nextgroup=doxygenSpecialMultilineDesc
syn keyword doxygenOtherTODO contained todo attention nextgroup=doxygenSpecialMultilineDesc syn keyword doxygenOtherTODO contained todo attention nextgroup=doxygenSpecialMultilineDesc
syn keyword doxygenOtherWARN contained warning nextgroup=doxygenSpecialMultilineDesc syn keyword doxygenOtherWARN contained warning nextgroup=doxygenSpecialMultilineDesc
syn keyword doxygenOtherBUG contained bug nextgroup=doxygenSpecialMultilineDesc syn keyword doxygenOtherBUG contained bug nextgroup=doxygenSpecialMultilineDesc
" Handle \link, \endlink, highlighting the link-to and the link text bits separately. " Handle \link, \endlink, highlighting the link-to and the link text bits separately.
syn region doxygenOtherLink matchgroup=doxygenOther start=+\<link\>+ end=+[\@]\@<=endlink\>+ contained contains=doxygenLinkWord,doxygenContinueComment,doxygenLinkError,doxygenEndlinkSpecial syn region doxygenOtherLink matchgroup=doxygenOther start=+\<link\>+ end=+[\@]\@<=endlink\>+ contained contains=doxygenLinkWord,doxygenContinueCommentWhite,doxygenLinkError,doxygenEndlinkSpecial
syn match doxygenEndlinkSpecial contained +[\\@]\zeendlink\>+ syn match doxygenEndlinkSpecial contained +[\\@]\zeendlink\>+
syn match doxygenLinkWord "[_a-zA-Z:#()][_a-z0-9A-Z:#()]*\>" contained skipnl nextgroup=doxygenLinkRest,doxygenContinueLinkComment syn match doxygenLinkWord "[_a-zA-Z:#()][_a-z0-9A-Z:#()]*\>" contained skipnl nextgroup=doxygenLinkRest,doxygenContinueLinkComment
@@ -250,7 +268,7 @@ endif
" Handle section " Handle section
syn keyword doxygenOther defgroup section subsection subsubsection weakgroup contained skipwhite nextgroup=doxygenSpecialIdent syn keyword doxygenOther defgroup section subsection subsubsection weakgroup contained skipwhite nextgroup=doxygenSpecialIdent
syn region doxygenSpecialSectionDesc start=+.\++ end=+$+ contained skipwhite contains=doxygenSmallSpecial,@doxygenHtmlGroup keepend skipwhite skipnl nextgroup=doxygenContinueComment syn region doxygenSpecialSectionDesc start=+.\++ end=+$+ contained skipwhite contains=doxygenSmallSpecial,@doxygenHtmlGroup keepend skipwhite skipnl nextgroup=doxygenContinueCommentWhite
syn match doxygenSpecialIdent "\<[a-zA-Z_0-9]\+\>" contained nextgroup=doxygenSpecialSectionDesc syn match doxygenSpecialIdent "\<[a-zA-Z_0-9]\+\>" contained nextgroup=doxygenSpecialSectionDesc
" Does the one-line description for the one-line type identifiers. " Does the one-line description for the one-line type identifiers.
@@ -260,8 +278,12 @@ endif
" Handle the multiline description for the multiline type identifiers. " Handle the multiline description for the multiline type identifiers.
" Continue until an 'empty' line (can contain a '*' continuation) or until the " Continue until an 'empty' line (can contain a '*' continuation) or until the
" next whole-line @ command \ command. " next whole-line @ command \ command.
syn region doxygenSpecialMultilineDesc start=+.\++ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ contained contains=doxygenSpecialContinueComment,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell skipwhite keepend syn region doxygenSpecialMultilineDesc start=+.\++ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ contained contains=doxygenSpecialContinueCommentWhite,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell skipwhite keepend
syn match doxygenSpecialContinueComment contained +^\s*\*/\@!\s*+ nextgroup=doxygenSpecial skipwhite
" syn match doxygenSpecialContinueComment contained +^\s*\*/\@!\s*+ nextgroup=doxygenSpecial skipwhite
syn match doxygenSpecialContinueCommentWhite contained +^\s*\ze\*+ nextgroup=doxygenSpecialContinueComment
syn match doxygenSpecialContinueComment contained +\*/\@!+
" Handle special cases 'bold' and 'group' " Handle special cases 'bold' and 'group'
syn keyword doxygenBold contained bold nextgroup=doxygenSpecialHeading syn keyword doxygenBold contained bold nextgroup=doxygenSpecialHeading
@@ -288,7 +310,7 @@ endif
" Supported HTML subset. Not perfect, but okay. " Supported HTML subset. Not perfect, but okay.
syn case ignore syn case ignore
syn region doxygenHtmlTag contained matchgroup=doxygenHtmlCh start=+\v\</=\ze([biuap]|em|strong|img|br|center|code|dfn|d[ldt]|hr|h[0-3]|li|[ou]l|pre|small|sub|sup|table|tt|var|caption|src|alt|longdesc|name|height|width|usemap|ismap|href|type)>+ skip=+\\<\|\<\k\+=\("[^"]*"\|'[^']*\)+ end=+>+ contains=doxygenHtmlCmd,doxygenContinueComment,doxygenHtmlVar syn region doxygenHtmlTag contained matchgroup=doxygenHtmlCh start=+\v\</=\ze([biuap]|em|strong|img|br|center|code|dfn|d[ldt]|hr|h[0-3]|li|[ou]l|pre|small|sub|sup|table|tt|var|caption|src|alt|longdesc|name|height|width|usemap|ismap|href|type)>+ skip=+\\<\|\<\k\+=\("[^"]*"\|'[^']*\)+ end=+>+ contains=doxygenHtmlCmd,doxygenContinueCommentWhite,doxygenHtmlVar
syn keyword doxygenHtmlCmd contained b i em strong u img a br p center code dfn dl dd dt hr h1 h2 h3 li ol ul pre small sub sup table tt var caption nextgroup=doxygenHtmlVar skipwhite syn keyword doxygenHtmlCmd contained b i em strong u img a br p center code dfn dl dd dt hr h1 h2 h3 li ol ul pre small sub sup table tt var caption nextgroup=doxygenHtmlVar skipwhite
syn keyword doxygenHtmlVar contained src alt longdesc name height width usemap ismap href type nextgroup=doxygenHtmlEqu skipwhite syn keyword doxygenHtmlVar contained src alt longdesc name height width usemap ismap href type nextgroup=doxygenHtmlEqu skipwhite
syn match doxygenHtmlEqu contained +=+ nextgroup=doxygenHtmlExpr skipwhite syn match doxygenHtmlEqu contained +=+ nextgroup=doxygenHtmlExpr skipwhite
@@ -298,7 +320,7 @@ endif
syn cluster doxygenHtmlGroup contains=doxygenHtmlCode,doxygenHtmlBold,doxygenHtmlUnderline,doxygenHtmlItalic,doxygenHtmlSpecial,doxygenHtmlTag,doxygenHtmlLink syn cluster doxygenHtmlGroup contains=doxygenHtmlCode,doxygenHtmlBold,doxygenHtmlUnderline,doxygenHtmlItalic,doxygenHtmlSpecial,doxygenHtmlTag,doxygenHtmlLink
syn cluster doxygenHtmlTop contains=@Spell,doxygenHtmlSpecial,doxygenHtmlTag,doxygenContinueComment syn cluster doxygenHtmlTop contains=@Spell,doxygenHtmlSpecial,doxygenHtmlTag,doxygenContinueCommentWhite
" Html Support " Html Support
syn region doxygenHtmlLink contained start=+<[aA]\>\s*\(\n\s*\*\s*\)\=\(\(name\|href\)=\("[^"]*"\|'[^']*'\)\)\=\s*>+ end=+</[aA]>+me=e-4 contains=@doxygenHtmlTop syn region doxygenHtmlLink contained start=+<[aA]\>\s*\(\n\s*\*\s*\)\=\(\(name\|href\)=\("[^"]*"\|'[^']*'\)\)\=\s*>+ end=+</[aA]>+me=e-4 contains=@doxygenHtmlTop
hi link doxygenHtmlLink Underlined hi link doxygenHtmlLink Underlined
@@ -343,7 +365,7 @@ endif
syn cluster rcGroup add=doxygen.* syn cluster rcGroup add=doxygen.*
let s:my_syncolor=0 let s:my_syncolor=0
if !exists(':SynColor') if !exists(':SynColor')
command -nargs=+ SynColor hi def <args> command -nargs=+ SynColor hi def <args>
let s:my_syncolor=1 let s:my_syncolor=1
endif endif
@@ -469,6 +491,8 @@ endif
call s:Doxygen_Hilights() call s:Doxygen_Hilights()
syn match doxygenLeadingWhite +\(^\s*\*\)\@<=\s*+ contained
" This is still a proposal, but won't do any harm. " This is still a proposal, but won't do any harm.
aug doxygengroup aug doxygengroup
au! au!
@@ -483,6 +507,7 @@ endif
SynLink doxygenOtherTODO Todo SynLink doxygenOtherTODO Todo
SynLink doxygenOtherWARN Todo SynLink doxygenOtherWARN Todo
SynLink doxygenOtherBUG Todo SynLink doxygenOtherBUG Todo
SynLink doxygenLeadingLWhite doxygenBody
SynLink doxygenErrorSpecial Error SynLink doxygenErrorSpecial Error
SynLink doxygenErrorEnd Error SynLink doxygenErrorEnd Error
@@ -517,7 +542,10 @@ endif
SynLink doxygenBriefL doxygenBrief SynLink doxygenBriefL doxygenBrief
SynLink doxygenBriefLine doxygenBrief SynLink doxygenBriefLine doxygenBrief
SynLink doxygenHeaderLine doxygenSpecialHeading SynLink doxygenHeaderLine doxygenSpecialHeading
SynLink doxygenStartSkip doxygenContinueComment SynLink doxygenCommentWhite Normal
SynLink doxygenCommentWhite2 doxygenCommentWhite
SynLink doxygenContinueCommentWhite doxygenCommentWhite
SynLink doxygenStartSkipWhite doxygenContinueCommentWhite
SynLink doxygenLinkWord doxygenParamName SynLink doxygenLinkWord doxygenParamName
SynLink doxygenLinkRest doxygenSpecialMultilineDesc SynLink doxygenLinkRest doxygenSpecialMultilineDesc
SynLink doxygenHyperLink doxygenLinkWord SynLink doxygenHyperLink doxygenLinkWord
@@ -591,5 +619,5 @@ finally
let &cpo = s:cpo_save let &cpo = s:cpo_save
unlet s:cpo_save unlet s:cpo_save
endtry endtry
let suppress_doxygen=1
" vim:et sw=2 sts=2 " vim:et sw=2 sts=2

View File

@@ -2190,6 +2190,7 @@ test_arglist \
test_highlight \ test_highlight \
test_history \ test_history \
test_hlsearch \ test_hlsearch \
test_iminsert \
test_increment \ test_increment \
test_increment_dbcs \ test_increment_dbcs \
test_ins_complete \ test_ins_complete \

View File

@@ -516,7 +516,7 @@ edit(
*/ */
if (curbuf->b_p_iminsert == B_IMODE_LMAP) if (curbuf->b_p_iminsert == B_IMODE_LMAP)
State |= LANGMAP; State |= LANGMAP;
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
im_set_active(curbuf->b_p_iminsert == B_IMODE_IM); im_set_active(curbuf->b_p_iminsert == B_IMODE_IM);
#endif #endif
@@ -8372,7 +8372,7 @@ ins_reg(void)
++no_u_sync; ++no_u_sync;
if (regname == '=') if (regname == '=')
{ {
# ifdef USE_IM_CONTROL # ifdef FEAT_MBYTE
int im_on = im_get_status(); int im_on = im_get_status();
# endif # endif
/* Sync undo when evaluating the expression calls setline() or /* Sync undo when evaluating the expression calls setline() or
@@ -8380,7 +8380,7 @@ ins_reg(void)
u_sync_once = 2; u_sync_once = 2;
regname = get_expr_register(); regname = get_expr_register();
# ifdef USE_IM_CONTROL # ifdef FEAT_MBYTE
/* Restore the Input Method. */ /* Restore the Input Method. */
if (im_on) if (im_on)
im_set_active(TRUE); im_set_active(TRUE);
@@ -8509,12 +8509,12 @@ ins_ctrl_hat(void)
{ {
curbuf->b_p_iminsert = B_IMODE_LMAP; curbuf->b_p_iminsert = B_IMODE_LMAP;
State |= LANGMAP; State |= LANGMAP;
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
im_set_active(FALSE); im_set_active(FALSE);
#endif #endif
} }
} }
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
else else
{ {
/* There are no ":lmap" mappings, toggle IM */ /* There are no ":lmap" mappings, toggle IM */
@@ -8661,7 +8661,7 @@ ins_esc(
} }
} }
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
/* Disable IM to allow typing English directly for Normal mode commands. /* Disable IM to allow typing English directly for Normal mode commands.
* When ":lmap" is enabled don't change 'iminsert' (IM can be enabled as * When ":lmap" is enabled don't change 'iminsert' (IM can be enabled as
* well). */ * well). */

View File

@@ -13449,8 +13449,10 @@ f_writefile(typval_T *argvars, typval_T *rettv)
if (write_list(fd, list, binary) == FAIL) if (write_list(fd, list, binary) == FAIL)
ret = -1; ret = -1;
#ifdef HAVE_FSYNC #ifdef HAVE_FSYNC
else if (do_fsync && fsync(fileno(fd)) != 0) else if (do_fsync)
EMSG(_(e_fsync)); /* Ignore the error, the user wouldn't know what to do about it.
* May happen for a device. */
ignored = fsync(fileno(fd));
#endif #endif
fclose(fd); fclose(fd);
} }

View File

@@ -1825,7 +1825,6 @@ write_viminfo(char_u *file, int forceit)
FILE *fp_out = NULL; /* output viminfo file */ FILE *fp_out = NULL; /* output viminfo file */
char_u *tempname = NULL; /* name of temp viminfo file */ char_u *tempname = NULL; /* name of temp viminfo file */
stat_T st_new; /* mch_stat() of potential new file */ stat_T st_new; /* mch_stat() of potential new file */
char_u *wp;
#if defined(UNIX) || defined(VMS) #if defined(UNIX) || defined(VMS)
mode_t umask_save; mode_t umask_save;
#endif #endif
@@ -1847,27 +1846,29 @@ write_viminfo(char_u *file, int forceit)
fp_in = mch_fopen((char *)fname, READBIN); fp_in = mch_fopen((char *)fname, READBIN);
if (fp_in == NULL) if (fp_in == NULL)
{ {
int fd;
/* if it does exist, but we can't read it, don't try writing */ /* if it does exist, but we can't read it, don't try writing */
if (mch_stat((char *)fname, &st_new) == 0) if (mch_stat((char *)fname, &st_new) == 0)
goto end; goto end;
#if defined(UNIX) || defined(VMS)
/* /* Create the new .viminfo non-accessible for others, because it may
* For Unix we create the .viminfo non-accessible for others, * contain text from non-accessible documents. It is up to the user to
* because it may contain text from non-accessible documents. * widen access (e.g. to a group). This may also fail if there is a
*/ * race condition, then just give up. */
umask_save = umask(077); fd = mch_open((char *)fname,
#endif O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, 0600);
fp_out = mch_fopen((char *)fname, WRITEBIN); if (fd < 0)
#if defined(UNIX) || defined(VMS) goto end;
(void)umask(umask_save); fp_out = fdopen(fd, WRITEBIN);
#endif
} }
else else
{ {
/* /*
* There is an existing viminfo file. Create a temporary file to * There is an existing viminfo file. Create a temporary file to
* write the new viminfo into, in the same directory as the * write the new viminfo into, in the same directory as the
* existing viminfo file, which will be renamed later. * existing viminfo file, which will be renamed once all writing is
* successful.
*/ */
#ifdef UNIX #ifdef UNIX
/* /*
@@ -1901,12 +1902,18 @@ write_viminfo(char_u *file, int forceit)
#endif #endif
/* /*
* Make tempname. * Make tempname, find one that does not exist yet.
* Beware of a race condition: If someone logs out and all Vim
* instances exit at the same time a temp file might be created between
* stat() and open(). Use mch_open() with O_EXCL to avoid that.
* May try twice: Once normal and once with shortname set, just in * May try twice: Once normal and once with shortname set, just in
* case somebody puts his viminfo file in an 8.3 filesystem. * case somebody puts his viminfo file in an 8.3 filesystem.
*/ */
for (;;) for (;;)
{ {
int next_char = 'z';
char_u *wp;
tempname = buf_modname( tempname = buf_modname(
#ifdef UNIX #ifdef UNIX
shortname, shortname,
@@ -1924,126 +1931,128 @@ write_viminfo(char_u *file, int forceit)
break; break;
/* /*
* Check if tempfile already exists. Never overwrite an * Try a series of names. Change one character, just before
* existing file! * the extension. This should also work for an 8.3
* file name, when after adding the extension it still is
* the same file as the original.
*/ */
if (mch_stat((char *)tempname, &st_new) == 0) wp = tempname + STRLEN(tempname) - 5;
if (wp < gettail(tempname)) /* empty file name? */
wp = gettail(tempname);
for (;;)
{ {
/*
* Check if tempfile already exists. Never overwrite an
* existing file!
*/
if (mch_stat((char *)tempname, &st_new) == 0)
{
#ifdef UNIX #ifdef UNIX
/*
* Check if tempfile is same as original file. May happen
* when modname() gave the same file back. E.g. silly
* link, or file name-length reached. Try again with
* shortname set.
*/
if (!shortname && st_new.st_dev == st_old.st_dev
&& st_new.st_ino == st_old.st_ino)
{
vim_free(tempname);
tempname = NULL;
shortname = TRUE;
continue;
}
#endif
/*
* Try another name. Change one character, just before
* the extension. This should also work for an 8.3
* file name, when after adding the extension it still is
* the same file as the original.
*/
wp = tempname + STRLEN(tempname) - 5;
if (wp < gettail(tempname)) /* empty file name? */
wp = gettail(tempname);
for (*wp = 'z'; mch_stat((char *)tempname, &st_new) == 0;
--*wp)
{
/* /*
* They all exist? Must be something wrong! Don't * Check if tempfile is same as original file. May happen
* write the viminfo file then. * when modname() gave the same file back. E.g. silly
* link, or file name-length reached. Try again with
* shortname set.
*/ */
if (*wp == 'a') if (!shortname && st_new.st_dev == st_old.st_dev
&& st_new.st_ino == st_old.st_ino)
{ {
EMSG2(_("E929: Too many viminfo temp files, like %s!"),
tempname);
vim_free(tempname); vim_free(tempname);
tempname = NULL; tempname = NULL;
shortname = TRUE;
break; break;
} }
#endif
} }
else
{
/* Try creating the file exclusively. This may fail if
* another Vim tries to do it at the same time. */
#ifdef VMS
/* fdopen() fails for some reason */
umask_save = umask(077);
fp_out = mch_fopen((char *)tempname, WRITEBIN);
(void)umask(umask_save);
#else
int fd;
/* Use mch_open() to be able to use O_NOFOLLOW and set file
* protection:
* Unix: same as original file, but strip s-bit. Reset
* umask to avoid it getting in the way.
* Others: r&w for user only. */
# ifdef UNIX
umask_save = umask(0);
fd = mch_open((char *)tempname,
O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW,
(int)((st_old.st_mode & 0777) | 0600));
(void)umask(umask_save);
# else
fd = mch_open((char *)tempname,
O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, 0600);
# endif
if (fd < 0)
{
fp_out = NULL;
# ifdef EEXIST
/* Avoid trying lots of names while the problem is lack
* of premission, only retry if the file already
* exists. */
if (errno != EEXIST)
break;
# endif
}
else
fp_out = fdopen(fd, WRITEBIN);
#endif /* VMS */
if (fp_out != NULL)
break;
}
/* Assume file exists, try again with another name. */
if (next_char == 'a' - 1)
{
/* They all exist? Must be something wrong! Don't write
* the viminfo file then. */
EMSG2(_("E929: Too many viminfo temp files, like %s!"),
tempname);
break;
}
*wp = next_char;
--next_char;
} }
break;
if (tempname != NULL)
break;
/* continue if shortname was set */
} }
if (tempname != NULL)
{
#ifdef VMS
/* fdopen() fails for some reason */
umask_save = umask(077);
fp_out = mch_fopen((char *)tempname, WRITEBIN);
(void)umask(umask_save);
#else
int fd;
/* Use mch_open() to be able to use O_NOFOLLOW and set file
* protection:
* Unix: same as original file, but strip s-bit. Reset umask to
* avoid it getting in the way.
* Others: r&w for user only. */
# ifdef UNIX
umask_save = umask(0);
fd = mch_open((char *)tempname,
O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW,
(int)((st_old.st_mode & 0777) | 0600));
(void)umask(umask_save);
# else
fd = mch_open((char *)tempname,
O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, 0600);
# endif
if (fd < 0)
fp_out = NULL;
else
fp_out = fdopen(fd, WRITEBIN);
#endif /* VMS */
/*
* If we can't create in the same directory, try creating a
* "normal" temp file. This is just an attempt, renaming the temp
* file might fail as well.
*/
if (fp_out == NULL)
{
vim_free(tempname);
if ((tempname = vim_tempname('o', TRUE)) != NULL)
fp_out = mch_fopen((char *)tempname, WRITEBIN);
}
#if defined(UNIX) && defined(HAVE_FCHOWN) #if defined(UNIX) && defined(HAVE_FCHOWN)
if (tempname != NULL && fp_out != NULL)
{
stat_T tmp_st;
/* /*
* Make sure the original owner can read/write the tempfile and * Make sure the original owner can read/write the tempfile and
* otherwise preserve permissions, making sure the group matches. * otherwise preserve permissions, making sure the group matches.
*/ */
if (fp_out != NULL) if (mch_stat((char *)tempname, &tmp_st) >= 0)
{ {
stat_T tmp_st; if (st_old.st_uid != tmp_st.st_uid)
/* Changing the owner might fail, in which case the
if (mch_stat((char *)tempname, &tmp_st) >= 0) * file will now owned by the current user, oh well. */
{ ignored = fchown(fileno(fp_out), st_old.st_uid, -1);
if (st_old.st_uid != tmp_st.st_uid) if (st_old.st_gid != tmp_st.st_gid
/* Changing the owner might fail, in which case the && fchown(fileno(fp_out), -1, st_old.st_gid) == -1)
* file will now owned by the current user, oh well. */ /* can't set the group to what it should be, remove
ignored = fchown(fileno(fp_out), st_old.st_uid, -1); * group permissions */
if (st_old.st_gid != tmp_st.st_gid
&& fchown(fileno(fp_out), -1, st_old.st_gid) == -1)
/* can't set the group to what it should be, remove
* group permissions */
(void)mch_setperm(tempname, 0600);
}
else
/* can't stat the file, set conservative permissions */
(void)mch_setperm(tempname, 0600); (void)mch_setperm(tempname, 0600);
} }
#endif else
/* can't stat the file, set conservative permissions */
(void)mch_setperm(tempname, 0600);
} }
#endif
} }
/* /*

View File

@@ -359,11 +359,11 @@ getcmdline(
b_im_ptr = &curbuf->b_p_imsearch; b_im_ptr = &curbuf->b_p_imsearch;
if (*b_im_ptr == B_IMODE_LMAP) if (*b_im_ptr == B_IMODE_LMAP)
State |= LANGMAP; State |= LANGMAP;
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
im_set_active(*b_im_ptr == B_IMODE_IM); im_set_active(*b_im_ptr == B_IMODE_IM);
#endif #endif
} }
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
else if (p_imcmdline) else if (p_imcmdline)
im_set_active(TRUE); im_set_active(TRUE);
#endif #endif
@@ -1119,7 +1119,7 @@ getcmdline(
{ {
/* ":lmap" mappings exists, toggle use of mappings. */ /* ":lmap" mappings exists, toggle use of mappings. */
State ^= LANGMAP; State ^= LANGMAP;
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
im_set_active(FALSE); /* Disable input method */ im_set_active(FALSE); /* Disable input method */
#endif #endif
if (b_im_ptr != NULL) if (b_im_ptr != NULL)
@@ -1130,7 +1130,7 @@ getcmdline(
*b_im_ptr = B_IMODE_NONE; *b_im_ptr = B_IMODE_NONE;
} }
} }
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
else else
{ {
/* There are no ":lmap" mappings, toggle IM. When /* There are no ":lmap" mappings, toggle IM. When
@@ -2143,7 +2143,7 @@ returncmd:
#endif #endif
State = save_State; State = save_State;
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
if (b_im_ptr != NULL && *b_im_ptr != B_IMODE_LMAP) if (b_im_ptr != NULL && *b_im_ptr != B_IMODE_LMAP)
im_save_status(b_im_ptr); im_save_status(b_im_ptr);
im_set_active(FALSE); im_set_active(FALSE);

View File

@@ -2890,7 +2890,7 @@ vgetorpeek(int advance)
+ typebuf.tb_len] != NUL) + typebuf.tb_len] != NUL)
typebuf.tb_noremap[typebuf.tb_off typebuf.tb_noremap[typebuf.tb_off
+ typebuf.tb_len++] = RM_YES; + typebuf.tb_len++] = RM_YES;
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
/* Get IM status right after getting keys, not after the /* Get IM status right after getting keys, not after the
* timeout for a mapping (focus may be lost by then). */ * timeout for a mapping (focus may be lost by then). */
vgetc_im_active = im_get_status(); vgetc_im_active = im_get_status();

View File

@@ -1022,7 +1022,7 @@ EXTERN int stop_insert_mode; /* for ":stopinsert" and 'insertmode' */
EXTERN int KeyTyped; /* TRUE if user typed current char */ EXTERN int KeyTyped; /* TRUE if user typed current char */
EXTERN int KeyStuffed; /* TRUE if current char from stuffbuf */ EXTERN int KeyStuffed; /* TRUE if current char from stuffbuf */
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
EXTERN int vgetc_im_active; /* Input Method was active for last EXTERN int vgetc_im_active; /* Input Method was active for last
character obtained from vgetc() */ character obtained from vgetc() */
#endif #endif

View File

@@ -1078,7 +1078,7 @@ gui_update_cursor(
gui_undraw_cursor(); gui_undraw_cursor();
if (gui.row < 0) if (gui.row < 0)
return; return;
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
if (gui.row != gui.cursor_row || gui.col != gui.cursor_col) if (gui.row != gui.cursor_row || gui.col != gui.cursor_col)
im_set_position(gui.row, gui.col); im_set_position(gui.row, gui.col);
#endif #endif
@@ -1136,7 +1136,7 @@ gui_update_cursor(
if (id > 0) if (id > 0)
{ {
cattr = syn_id2colors(id, &cfg, &cbg); cattr = syn_id2colors(id, &cfg, &cbg);
#if defined(USE_IM_CONTROL) || defined(FEAT_HANGULIN) #if defined(FEAT_MBYTE) || defined(FEAT_HANGULIN)
{ {
static int iid; static int iid;
guicolor_T fg, bg; guicolor_T fg, bg;

View File

@@ -4,6 +4,7 @@
* *
* Contributors: * Contributors:
* - Ken Takata * - Ken Takata
* - Yasuhiro Matsumoto
* *
* Copyright (C) 2013 MURAOKA Taro <koron.kaoriya@gmail.com> * Copyright (C) 2013 MURAOKA Taro <koron.kaoriya@gmail.com>
* THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. * THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
@@ -23,7 +24,21 @@
#include <math.h> #include <math.h>
#include <d2d1.h> #include <d2d1.h>
#include <d2d1helper.h> #include <d2d1helper.h>
#include <dwrite.h>
// Disable these macros to compile with old VC and newer SDK (V8.1 or later).
#if defined(_MSC_VER) && (_MSC_VER < 1700)
# define _COM_Outptr_ __out
# define _In_reads_(s)
# define _In_reads_opt_(s)
# define _Maybenull_
# define _Out_writes_(s)
# define _Out_writes_opt_(s)
# define _Out_writes_to_(x, y)
# define _Out_writes_to_opt_(x, y)
# define _Outptr_
#endif
#include <dwrite_2.h>
#include "gui_dwrite.h" #include "gui_dwrite.h"
@@ -79,16 +94,6 @@ template <class T> inline void SafeRelease(T **ppT)
} }
} }
struct GdiTextRendererContext
{
// const fields.
COLORREF color;
FLOAT cellWidth;
// working fields.
FLOAT offsetX;
};
static DWRITE_PIXEL_GEOMETRY static DWRITE_PIXEL_GEOMETRY
ToPixelGeometry(int value) ToPixelGeometry(int value)
{ {
@@ -184,17 +189,151 @@ ToInt(DWRITE_RENDERING_MODE value)
} }
} }
class FontCache {
public:
struct Item {
HFONT hFont;
IDWriteTextFormat* pTextFormat;
DWRITE_FONT_WEIGHT fontWeight;
DWRITE_FONT_STYLE fontStyle;
Item() : hFont(NULL), pTextFormat(NULL) {}
};
private:
int mSize;
Item *mItems;
public:
FontCache(int size = 2) :
mSize(size),
mItems(new Item[size])
{
}
~FontCache()
{
for (int i = 0; i < mSize; ++i)
SafeRelease(&mItems[i].pTextFormat);
delete[] mItems;
}
bool get(HFONT hFont, Item &item)
{
int n = find(hFont);
if (n < 0)
return false;
item = mItems[n];
slide(n);
return true;
}
void put(const Item& item)
{
int n = find(item.hFont);
if (n < 0)
n = mSize - 1;
if (mItems[n].pTextFormat != item.pTextFormat)
{
SafeRelease(&mItems[n].pTextFormat);
item.pTextFormat->AddRef();
}
mItems[n] = item;
slide(n);
}
private:
int find(HFONT hFont)
{
for (int i = 0; i < mSize; ++i)
{
if (mItems[i].hFont == hFont)
return i;
}
return -1;
}
void slide(int nextTop)
{
if (nextTop == 0)
return;
Item tmp = mItems[nextTop];
for (int i = nextTop - 1; i >= 0; --i)
mItems[i + 1] = mItems[i];
mItems[0] = tmp;
}
};
struct DWriteContext {
HDC mHDC;
bool mDrawing;
bool mFallbackDC;
ID2D1Factory *mD2D1Factory;
ID2D1DCRenderTarget *mRT;
ID2D1SolidColorBrush *mBrush;
IDWriteFactory *mDWriteFactory;
IDWriteFactory2 *mDWriteFactory2;
IDWriteGdiInterop *mGdiInterop;
IDWriteRenderingParams *mRenderingParams;
FontCache mFontCache;
IDWriteTextFormat *mTextFormat;
DWRITE_FONT_WEIGHT mFontWeight;
DWRITE_FONT_STYLE mFontStyle;
D2D1_TEXT_ANTIALIAS_MODE mTextAntialiasMode;
// METHODS
DWriteContext();
virtual ~DWriteContext();
HRESULT CreateTextFormatFromLOGFONT(const LOGFONTW &logFont,
IDWriteTextFormat **ppTextFormat);
HRESULT SetFontByLOGFONT(const LOGFONTW &logFont);
void SetFont(HFONT hFont);
void BindDC(HDC hdc, RECT *rect);
void AssureDrawing();
ID2D1Brush* SolidBrush(COLORREF color);
void DrawText(const WCHAR* text, int len,
int x, int y, int w, int h, int cellWidth, COLORREF color,
UINT fuOptions, CONST RECT *lprc, CONST INT * lpDx);
void FillRect(RECT *rc, COLORREF color);
void Flush();
void SetRenderingParams(
const DWriteRenderingParams *params);
DWriteRenderingParams *GetRenderingParams(
DWriteRenderingParams *params);
};
class AdjustedGlyphRun : public DWRITE_GLYPH_RUN class AdjustedGlyphRun : public DWRITE_GLYPH_RUN
{ {
private: private:
FLOAT &mAccum;
FLOAT mDelta; FLOAT mDelta;
FLOAT *mAdjustedAdvances; FLOAT *mAdjustedAdvances;
public: public:
AdjustedGlyphRun( AdjustedGlyphRun(
const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN *glyphRun,
FLOAT cellWidth) : FLOAT cellWidth,
FLOAT &accum) :
DWRITE_GLYPH_RUN(*glyphRun), DWRITE_GLYPH_RUN(*glyphRun),
mAccum(accum),
mDelta(0.0f), mDelta(0.0f),
mAdjustedAdvances(new FLOAT[glyphRun->glyphCount]) mAdjustedAdvances(new FLOAT[glyphRun->glyphCount])
{ {
@@ -209,45 +348,44 @@ public:
glyphAdvances = mAdjustedAdvances; glyphAdvances = mAdjustedAdvances;
} }
~AdjustedGlyphRun(void) ~AdjustedGlyphRun()
{ {
mAccum += mDelta;
delete[] mAdjustedAdvances; delete[] mAdjustedAdvances;
} }
FLOAT getDelta(void) const
{
return mDelta;
}
static FLOAT adjustToCell(FLOAT value, FLOAT cellWidth) static FLOAT adjustToCell(FLOAT value, FLOAT cellWidth)
{ {
int cellCount = (int)floor(value / cellWidth + 0.5f); int cellCount = int(floor(value / cellWidth + 0.5f));
if (cellCount < 1) if (cellCount < 1)
cellCount = 1; cellCount = 1;
return cellCount * cellWidth; return cellCount * cellWidth;
} }
}; };
class GdiTextRenderer FINAL : public IDWriteTextRenderer struct TextRendererContext {
// const fields.
COLORREF color;
FLOAT cellWidth;
// working fields.
FLOAT offsetX;
};
class TextRenderer FINAL : public IDWriteTextRenderer
{ {
public: public:
GdiTextRenderer( TextRenderer(
IDWriteBitmapRenderTarget* bitmapRenderTarget, DWriteContext* pDWC) :
IDWriteRenderingParams* renderingParams) :
cRefCount_(0), cRefCount_(0),
pRenderTarget_(bitmapRenderTarget), pDWC_(pDWC)
pRenderingParams_(renderingParams)
{ {
pRenderTarget_->AddRef();
pRenderingParams_->AddRef();
AddRef(); AddRef();
} }
// add "virtual" to avoid a compiler warning // add "virtual" to avoid a compiler warning
virtual ~GdiTextRenderer() virtual ~TextRenderer()
{ {
SafeRelease(&pRenderTarget_);
SafeRelease(&pRenderingParams_);
} }
IFACEMETHOD(IsPixelSnappingDisabled)( IFACEMETHOD(IsPixelSnappingDisabled)(
@@ -263,7 +401,8 @@ public:
__out DWRITE_MATRIX* transform) __out DWRITE_MATRIX* transform)
{ {
// forward the render target's transform // forward the render target's transform
pRenderTarget_->GetCurrentTransform(transform); pDWC_->mRT->GetTransform(
reinterpret_cast<D2D1_MATRIX_3X2_F*>(transform));
return S_OK; return S_OK;
} }
@@ -271,43 +410,12 @@ public:
__maybenull void* clientDrawingContext, __maybenull void* clientDrawingContext,
__out FLOAT* pixelsPerDip) __out FLOAT* pixelsPerDip)
{ {
*pixelsPerDip = pRenderTarget_->GetPixelsPerDip(); float dpiX, unused;
pDWC_->mRT->GetDpi(&dpiX, &unused);
*pixelsPerDip = dpiX / 96.0f;
return S_OK; return S_OK;
} }
IFACEMETHOD(DrawGlyphRun)(
__maybenull void* clientDrawingContext,
FLOAT baselineOriginX,
FLOAT baselineOriginY,
DWRITE_MEASURING_MODE measuringMode,
__in DWRITE_GLYPH_RUN const* glyphRun,
__in DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription,
IUnknown* clientDrawingEffect)
{
HRESULT hr = S_OK;
GdiTextRendererContext *context =
reinterpret_cast<GdiTextRendererContext*>(clientDrawingContext);
AdjustedGlyphRun adjustedGlyphRun(glyphRun, context->cellWidth);
// Pass on the drawing call to the render target to do the real work.
RECT dirtyRect = {0};
hr = pRenderTarget_->DrawGlyphRun(
baselineOriginX + context->offsetX,
baselineOriginY,
measuringMode,
&adjustedGlyphRun,
pRenderingParams_,
context->color,
&dirtyRect);
context->offsetX += adjustedGlyphRun.getDelta();
return hr;
}
IFACEMETHOD(DrawUnderline)( IFACEMETHOD(DrawUnderline)(
__maybenull void* clientDrawingContext, __maybenull void* clientDrawingContext,
FLOAT baselineOriginX, FLOAT baselineOriginX,
@@ -340,6 +448,69 @@ public:
return E_NOTIMPL; return E_NOTIMPL;
} }
IFACEMETHOD(DrawGlyphRun)(
__maybenull void* clientDrawingContext,
FLOAT baselineOriginX,
FLOAT baselineOriginY,
DWRITE_MEASURING_MODE measuringMode,
__in DWRITE_GLYPH_RUN const* glyphRun,
__in DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription,
IUnknown* clientDrawingEffect)
{
TextRendererContext *context =
reinterpret_cast<TextRendererContext*>(clientDrawingContext);
AdjustedGlyphRun adjustedGlyphRun(glyphRun, context->cellWidth,
context->offsetX);
if (pDWC_->mDWriteFactory2 != NULL)
{
IDWriteColorGlyphRunEnumerator *enumerator = NULL;
HRESULT hr = pDWC_->mDWriteFactory2->TranslateColorGlyphRun(
baselineOriginX + context->offsetX,
baselineOriginY,
&adjustedGlyphRun,
NULL,
DWRITE_MEASURING_MODE_GDI_NATURAL,
NULL,
0,
&enumerator);
if (SUCCEEDED(hr))
{
// Draw by IDWriteFactory2 for color emoji
BOOL hasRun = TRUE;
enumerator->MoveNext(&hasRun);
while (hasRun)
{
const DWRITE_COLOR_GLYPH_RUN* colorGlyphRun;
enumerator->GetCurrentRun(&colorGlyphRun);
pDWC_->mBrush->SetColor(colorGlyphRun->runColor);
pDWC_->mRT->DrawGlyphRun(
D2D1::Point2F(
colorGlyphRun->baselineOriginX,
colorGlyphRun->baselineOriginY),
&colorGlyphRun->glyphRun,
pDWC_->mBrush,
DWRITE_MEASURING_MODE_NATURAL);
enumerator->MoveNext(&hasRun);
}
SafeRelease(&enumerator);
return S_OK;
}
}
// Draw by IDWriteFactory (without color emoji)
pDWC_->mRT->DrawGlyphRun(
D2D1::Point2F(
baselineOriginX + context->offsetX,
baselineOriginY),
&adjustedGlyphRun,
pDWC_->SolidBrush(context->color),
DWRITE_MEASURING_MODE_NATURAL);
return S_OK;
}
public: public:
IFACEMETHOD_(unsigned long, AddRef) () IFACEMETHOD_(unsigned long, AddRef) ()
{ {
@@ -385,80 +556,28 @@ public:
private: private:
long cRefCount_; long cRefCount_;
IDWriteBitmapRenderTarget* pRenderTarget_; DWriteContext* pDWC_;
IDWriteRenderingParams* pRenderingParams_;
};
struct DWriteContext {
FLOAT mDpiScaleX;
FLOAT mDpiScaleY;
bool mDrawing;
ID2D1Factory *mD2D1Factory;
ID2D1DCRenderTarget *mRT;
ID2D1SolidColorBrush *mBrush;
IDWriteFactory *mDWriteFactory;
IDWriteGdiInterop *mGdiInterop;
IDWriteRenderingParams *mRenderingParams;
IDWriteTextFormat *mTextFormat;
HFONT mLastHFont;
DWRITE_FONT_WEIGHT mFontWeight;
DWRITE_FONT_STYLE mFontStyle;
D2D1_TEXT_ANTIALIAS_MODE mTextAntialiasMode;
// METHODS
DWriteContext();
virtual ~DWriteContext();
HRESULT SetLOGFONT(const LOGFONTW &logFont, float fontSize);
void SetFont(HFONT hFont);
void SetFont(const LOGFONTW &logFont);
void DrawText(HDC hdc, const WCHAR* text, int len,
int x, int y, int w, int h, int cellWidth, COLORREF color);
float PixelsToDipsX(int x);
float PixelsToDipsY(int y);
void SetRenderingParams(
const DWriteRenderingParams *params);
DWriteRenderingParams *GetRenderingParams(
DWriteRenderingParams *params);
}; };
DWriteContext::DWriteContext() : DWriteContext::DWriteContext() :
mDpiScaleX(1.f), mHDC(NULL),
mDpiScaleY(1.f),
mDrawing(false), mDrawing(false),
mFallbackDC(false),
mD2D1Factory(NULL), mD2D1Factory(NULL),
mRT(NULL), mRT(NULL),
mBrush(NULL), mBrush(NULL),
mDWriteFactory(NULL), mDWriteFactory(NULL),
mDWriteFactory2(NULL),
mGdiInterop(NULL), mGdiInterop(NULL),
mRenderingParams(NULL), mRenderingParams(NULL),
mFontCache(8),
mTextFormat(NULL), mTextFormat(NULL),
mLastHFont(NULL),
mFontWeight(DWRITE_FONT_WEIGHT_NORMAL), mFontWeight(DWRITE_FONT_WEIGHT_NORMAL),
mFontStyle(DWRITE_FONT_STYLE_NORMAL), mFontStyle(DWRITE_FONT_STYLE_NORMAL),
mTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE_DEFAULT) mTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE_DEFAULT)
{ {
HRESULT hr; HRESULT hr;
HDC screen = ::GetDC(0);
mDpiScaleX = ::GetDeviceCaps(screen, LOGPIXELSX) / 96.0f;
mDpiScaleY = ::GetDeviceCaps(screen, LOGPIXELSY) / 96.0f;
::ReleaseDC(0, screen);
hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED,
__uuidof(ID2D1Factory), NULL, __uuidof(ID2D1Factory), NULL,
reinterpret_cast<void**>(&mD2D1Factory)); reinterpret_cast<void**>(&mD2D1Factory));
@@ -495,6 +614,15 @@ DWriteContext::DWriteContext() :
mDWriteFactory); mDWriteFactory);
} }
if (SUCCEEDED(hr))
{
DWriteCreateFactory(
DWRITE_FACTORY_TYPE_SHARED,
__uuidof(IDWriteFactory2),
reinterpret_cast<IUnknown**>(&mDWriteFactory2));
_RPT1(_CRT_WARN, "IDWriteFactory2: %s\n", SUCCEEDED(hr) ? "available" : "not available");
}
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
hr = mDWriteFactory->GetGdiInterop(&mGdiInterop); hr = mDWriteFactory->GetGdiInterop(&mGdiInterop);
@@ -515,20 +643,24 @@ DWriteContext::~DWriteContext()
SafeRelease(&mRenderingParams); SafeRelease(&mRenderingParams);
SafeRelease(&mGdiInterop); SafeRelease(&mGdiInterop);
SafeRelease(&mDWriteFactory); SafeRelease(&mDWriteFactory);
SafeRelease(&mDWriteFactory2);
SafeRelease(&mBrush); SafeRelease(&mBrush);
SafeRelease(&mRT); SafeRelease(&mRT);
SafeRelease(&mD2D1Factory); SafeRelease(&mD2D1Factory);
} }
HRESULT HRESULT
DWriteContext::SetLOGFONT(const LOGFONTW &logFont, float fontSize) DWriteContext::CreateTextFormatFromLOGFONT(const LOGFONTW &logFont,
IDWriteTextFormat **ppTextFormat)
{ {
// Most of this function is copy from: http://msdn.microsoft.com/en-us/library/windows/desktop/dd941783(v=vs.85).aspx // Most of this function is copied from: https://github.com/Microsoft/Windows-classic-samples/blob/master/Samples/Win7Samples/multimedia/DirectWrite/RenderTest/TextHelpers.cpp
HRESULT hr = S_OK; HRESULT hr = S_OK;
IDWriteTextFormat *pTextFormat = NULL;
IDWriteFont *font = NULL; IDWriteFont *font = NULL;
IDWriteFontFamily *fontFamily = NULL; IDWriteFontFamily *fontFamily = NULL;
IDWriteLocalizedStrings *localizedFamilyNames = NULL; IDWriteLocalizedStrings *localizedFamilyNames = NULL;
float fontSize = 0;
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
@@ -561,33 +693,30 @@ DWriteContext::SetLOGFONT(const LOGFONTW &logFont, float fontSize)
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
// If no font size was passed in use the lfHeight of the LOGFONT. // Use lfHeight of the LOGFONT as font size.
if (fontSize == 0) fontSize = float(logFont.lfHeight);
if (fontSize < 0)
{ {
// Convert from pixels to DIPs. // Negative lfHeight represents the size of the em unit.
fontSize = PixelsToDipsY(logFont.lfHeight); fontSize = -fontSize;
if (fontSize < 0) }
{ else
// Negative lfHeight represents the size of the em unit. {
fontSize = -fontSize; // Positive lfHeight represents the cell height (ascent +
} // descent).
else DWRITE_FONT_METRICS fontMetrics;
{ font->GetMetrics(&fontMetrics);
// Positive lfHeight represents the cell height (ascent +
// descent).
DWRITE_FONT_METRICS fontMetrics;
font->GetMetrics(&fontMetrics);
// Convert the cell height (ascent + descent) from design units // Convert the cell height (ascent + descent) from design units
// to ems. // to ems.
float cellHeight = static_cast<float>( float cellHeight = static_cast<float>(
fontMetrics.ascent + fontMetrics.descent) fontMetrics.ascent + fontMetrics.descent)
/ fontMetrics.designUnitsPerEm; / fontMetrics.designUnitsPerEm;
// Divide the font size by the cell height to get the font em // Divide the font size by the cell height to get the font em
// size. // size.
fontSize /= cellHeight; fontSize /= cellHeight;
}
} }
} }
@@ -612,123 +741,165 @@ DWriteContext::SetLOGFONT(const LOGFONTW &logFont, float fontSize)
font->GetStretch(), font->GetStretch(),
fontSize, fontSize,
localeName, localeName,
&mTextFormat); &pTextFormat);
} }
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ hr = pTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);
mFontWeight = static_cast<DWRITE_FONT_WEIGHT>(logFont.lfWeight);
mFontStyle = logFont.lfItalic ? DWRITE_FONT_STYLE_ITALIC if (SUCCEEDED(hr))
: DWRITE_FONT_STYLE_NORMAL; hr = pTextFormat->SetParagraphAlignment(
} DWRITE_PARAGRAPH_ALIGNMENT_CENTER);
if (SUCCEEDED(hr))
hr = pTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);
SafeRelease(&localizedFamilyNames); SafeRelease(&localizedFamilyNames);
SafeRelease(&fontFamily); SafeRelease(&fontFamily);
SafeRelease(&font); SafeRelease(&font);
if (SUCCEEDED(hr))
*ppTextFormat = pTextFormat;
else
SafeRelease(&pTextFormat);
return hr;
}
HRESULT
DWriteContext::SetFontByLOGFONT(const LOGFONTW &logFont)
{
HRESULT hr = S_OK;
IDWriteTextFormat *pTextFormat = NULL;
hr = CreateTextFormatFromLOGFONT(logFont, &pTextFormat);
if (SUCCEEDED(hr))
{
SafeRelease(&mTextFormat);
mTextFormat = pTextFormat;
mFontWeight = static_cast<DWRITE_FONT_WEIGHT>(logFont.lfWeight);
mFontStyle = logFont.lfItalic ? DWRITE_FONT_STYLE_ITALIC
: DWRITE_FONT_STYLE_NORMAL;
}
return hr; return hr;
} }
void void
DWriteContext::SetFont(HFONT hFont) DWriteContext::SetFont(HFONT hFont)
{ {
if (mLastHFont != hFont) FontCache::Item item;
if (mFontCache.get(hFont, item))
{ {
LOGFONTW lf; if (item.pTextFormat != NULL)
if (GetObjectW(hFont, sizeof(lf), &lf))
{ {
SetFont(lf); item.pTextFormat->AddRef();
mLastHFont = hFont; SafeRelease(&mTextFormat);
mTextFormat = item.pTextFormat;
mFontWeight = item.fontWeight;
mFontStyle = item.fontStyle;
mFallbackDC = false;
} }
else
mFallbackDC = true;
return;
} }
HRESULT hr = E_FAIL;
LOGFONTW lf;
if (GetObjectW(hFont, sizeof(lf), &lf))
hr = SetFontByLOGFONT(lf);
item.hFont = hFont;
if (SUCCEEDED(hr))
{
item.pTextFormat = mTextFormat;
item.fontWeight = mFontWeight;
item.fontStyle = mFontStyle;
}
mFontCache.put(item);
} }
void void
DWriteContext::SetFont(const LOGFONTW &logFont) DWriteContext::BindDC(HDC hdc, RECT *rect)
{ {
SafeRelease(&mTextFormat); Flush();
mLastHFont = NULL; mRT->BindDC(hdc, rect);
mRT->SetTransform(D2D1::IdentityMatrix());
HRESULT hr = SetLOGFONT(logFont, 0.f); mHDC = hdc;
if (SUCCEEDED(hr))
hr = mTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);
if (SUCCEEDED(hr))
hr = mTextFormat->SetParagraphAlignment(
DWRITE_PARAGRAPH_ALIGNMENT_CENTER);
if (SUCCEEDED(hr))
hr = mTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);
} }
void void
DWriteContext::DrawText(HDC hdc, const WCHAR* text, int len, DWriteContext::AssureDrawing()
int x, int y, int w, int h, int cellWidth, COLORREF color)
{ {
HRESULT hr = S_OK; if (mDrawing == false)
IDWriteBitmapRenderTarget *bmpRT = NULL; {
mRT->BeginDraw();
mDrawing = true;
}
}
// Skip when any fonts are not set. ID2D1Brush*
if (mTextFormat == NULL) DWriteContext::SolidBrush(COLORREF color)
{
mBrush->SetColor(D2D1::ColorF(UINT32(GetRValue(color)) << 16 |
UINT32(GetGValue(color)) << 8 | UINT32(GetBValue(color))));
return mBrush;
}
void
DWriteContext::DrawText(const WCHAR* text, int len,
int x, int y, int w, int h, int cellWidth, COLORREF color,
UINT fuOptions, CONST RECT *lprc, CONST INT * lpDx)
{
if (mFallbackDC)
{
Flush();
ExtTextOutW(mHDC, x, y, fuOptions, lprc, text, len, lpDx);
return; return;
}
// Check possibility of zero divided error. AssureDrawing();
if (cellWidth == 0 || mDpiScaleX == 0.0f || mDpiScaleY == 0.0f)
return;
if (SUCCEEDED(hr)) HRESULT hr;
hr = mGdiInterop->CreateBitmapRenderTarget(hdc, w, h, &bmpRT); IDWriteTextLayout *textLayout = NULL;
hr = mDWriteFactory->CreateTextLayout(text, len, mTextFormat,
FLOAT(w), FLOAT(h), &textLayout);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
IDWriteTextLayout *textLayout = NULL; DWRITE_TEXT_RANGE textRange = { 0, UINT32(len) };
textLayout->SetFontWeight(mFontWeight, textRange);
textLayout->SetFontStyle(mFontStyle, textRange);
HDC memdc = bmpRT->GetMemoryDC(); TextRenderer renderer(this);
BitBlt(memdc, 0, 0, w, h, hdc, x, y, SRCCOPY); TextRendererContext context = { color, FLOAT(cellWidth), 0.0f };
textLayout->Draw(&context, &renderer, FLOAT(x), FLOAT(y));
hr = mDWriteFactory->CreateGdiCompatibleTextLayout(
text, len, mTextFormat, PixelsToDipsX(w),
PixelsToDipsY(h), mDpiScaleX, NULL, TRUE, &textLayout);
if (SUCCEEDED(hr))
{
DWRITE_TEXT_RANGE textRange = { 0, (UINT32)len };
textLayout->SetFontWeight(mFontWeight, textRange);
textLayout->SetFontStyle(mFontStyle, textRange);
}
if (SUCCEEDED(hr))
{
GdiTextRenderer *renderer = new GdiTextRenderer(bmpRT,
mRenderingParams);
GdiTextRendererContext data = {
color,
PixelsToDipsX(cellWidth),
0.0f
};
textLayout->Draw(&data, renderer, 0, 0);
SafeRelease(&renderer);
}
BitBlt(hdc, x, y, w, h, memdc, 0, 0, SRCCOPY);
SafeRelease(&textLayout);
} }
SafeRelease(&bmpRT); SafeRelease(&textLayout);
} }
float void
DWriteContext::PixelsToDipsX(int x) DWriteContext::FillRect(RECT *rc, COLORREF color)
{ {
return x / mDpiScaleX; AssureDrawing();
mRT->FillRectangle(
D2D1::RectF(FLOAT(rc->left), FLOAT(rc->top),
FLOAT(rc->right), FLOAT(rc->bottom)),
SolidBrush(color));
} }
float void
DWriteContext::PixelsToDipsY(int y) DWriteContext::Flush()
{ {
return y / mDpiScaleY; if (mDrawing)
{
mRT->EndDraw();
mDrawing = false;
}
} }
void void
@@ -757,6 +928,10 @@ DWriteContext::SetRenderingParams(
SafeRelease(&mRenderingParams); SafeRelease(&mRenderingParams);
mRenderingParams = renderingParams; mRenderingParams = renderingParams;
mTextAntialiasMode = textAntialiasMode; mTextAntialiasMode = textAntialiasMode;
Flush();
mRT->SetTextRenderingParams(mRenderingParams);
mRT->SetTextAntialiasMode(mTextAntialiasMode);
} }
} }
@@ -824,40 +999,23 @@ DWriteContext_Open(void)
return new DWriteContext(); return new DWriteContext();
} }
void
DWriteContext_BeginDraw(DWriteContext *ctx)
{
if (ctx != NULL && ctx->mRT != NULL)
{
ctx->mRT->BeginDraw();
ctx->mRT->SetTransform(D2D1::IdentityMatrix());
ctx->mDrawing = true;
}
}
void void
DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, RECT *rect) DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, RECT *rect)
{ {
if (ctx != NULL && ctx->mRT != NULL) if (ctx != NULL)
{ ctx->BindDC(hdc, rect);
ctx->mRT->BindDC(hdc, rect);
ctx->mRT->SetTextAntialiasMode(ctx->mTextAntialiasMode);
}
} }
void void
DWriteContext_SetFont(DWriteContext *ctx, HFONT hFont) DWriteContext_SetFont(DWriteContext *ctx, HFONT hFont)
{ {
if (ctx != NULL) if (ctx != NULL)
{
ctx->SetFont(hFont); ctx->SetFont(hFont);
}
} }
void void
DWriteContext_DrawText( DWriteContext_DrawText(
DWriteContext *ctx, DWriteContext *ctx,
HDC hdc,
const WCHAR* text, const WCHAR* text,
int len, int len,
int x, int x,
@@ -865,20 +1023,28 @@ DWriteContext_DrawText(
int w, int w,
int h, int h,
int cellWidth, int cellWidth,
COLORREF color) COLORREF color,
UINT fuOptions,
CONST RECT *lprc,
CONST INT * lpDx)
{ {
if (ctx != NULL) if (ctx != NULL)
ctx->DrawText(hdc, text, len, x, y, w, h, cellWidth, color); ctx->DrawText(text, len, x, y, w, h, cellWidth, color,
fuOptions, lprc, lpDx);
} }
void void
DWriteContext_EndDraw(DWriteContext *ctx) DWriteContext_FillRect(DWriteContext *ctx, RECT *rc, COLORREF color)
{ {
if (ctx != NULL && ctx->mRT != NULL) if (ctx != NULL)
{ ctx->FillRect(rc, color);
ctx->mRT->EndDraw(); }
ctx->mDrawing = false;
} void
DWriteContext_Flush(DWriteContext *ctx)
{
if (ctx != NULL)
ctx->Flush();
} }
void void

View File

@@ -4,6 +4,7 @@
* *
* Contributors: * Contributors:
* - Ken Takata * - Ken Takata
* - Yasuhiro Matsumoto
* *
* Copyright (C) 2013 MURAOKA Taro <koron.kaoriya@gmail.com> * Copyright (C) 2013 MURAOKA Taro <koron.kaoriya@gmail.com>
* THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. * THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
@@ -54,12 +55,10 @@ void DWrite_Init(void);
void DWrite_Final(void); void DWrite_Final(void);
DWriteContext *DWriteContext_Open(void); DWriteContext *DWriteContext_Open(void);
void DWriteContext_BeginDraw(DWriteContext *ctx);
void DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, RECT *rect); void DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, 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,
HDC hdc,
const WCHAR* text, const WCHAR* text,
int len, int len,
int x, int x,
@@ -67,8 +66,12 @@ void DWriteContext_DrawText(
int w, int w,
int h, int h,
int cellWidth, int cellWidth,
COLORREF color); COLORREF color,
void DWriteContext_EndDraw(DWriteContext *ctx); UINT fuOptions,
CONST RECT *lprc,
CONST INT * lpDx);
void DWriteContext_FillRect(DWriteContext *ctx, RECT *rc, COLORREF color);
void DWriteContext_Flush(DWriteContext *ctx);
void DWriteContext_Close(DWriteContext *ctx); void DWriteContext_Close(DWriteContext *ctx);
void DWriteContext_SetRenderingParams( void DWriteContext_SetRenderingParams(

View File

@@ -2024,15 +2024,15 @@ gui_mac_handle_window_activate(
switch (eventKind) switch (eventKind)
{ {
case kEventWindowActivated: case kEventWindowActivated:
#if defined(USE_IM_CONTROL) # if defined(FEAT_MBYTE)
im_on_window_switch(TRUE); im_on_window_switch(TRUE);
#endif # endif
return noErr; return noErr;
case kEventWindowDeactivated: case kEventWindowDeactivated:
#if defined(USE_IM_CONTROL) # if defined(FEAT_MBYTE)
im_on_window_switch(FALSE); im_on_window_switch(FALSE);
#endif # endif
return noErr; return noErr;
} }
} }
@@ -6230,7 +6230,7 @@ char_u *FullPathFromFSSpec_save(FSSpec file)
#endif #endif
} }
#if (defined(USE_IM_CONTROL) || defined(PROTO)) && defined(USE_CARBONKEYHANDLER) #if (defined(FEAT_MBYTE) || defined(PROTO)) && defined(USE_CARBONKEYHANDLER)
/* /*
* Input Method Control functions. * Input Method Control functions.
*/ */
@@ -6317,7 +6317,7 @@ im_set_active(int active)
ScriptLanguageRecord *slptr = NULL; ScriptLanguageRecord *slptr = NULL;
OSStatus err; OSStatus err;
if (! gui.in_use) if (!gui.in_use)
return; return;
if (im_initialized == 0) if (im_initialized == 0)
@@ -6379,7 +6379,7 @@ im_get_status(void)
return im_is_active; return im_is_active;
} }
#endif /* defined(USE_IM_CONTROL) || defined(PROTO) */ #endif /* defined(FEAT_MBYTE) || defined(PROTO) */

View File

@@ -34,28 +34,14 @@ 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;
# 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 void directx_binddc(void);
#endif #endif
#ifdef FEAT_MENU #ifdef FEAT_MENU
static int gui_mswin_get_menu_height(int fix_window); static int gui_mswin_get_menu_height(int fix_window);
#endif #endif
#if defined(FEAT_DIRECTX) || defined(PROTO)
int
directx_enabled(void)
{
if (s_dwc != NULL)
return 1;
else if (s_directx_load_attempted)
return 0;
/* load DirectX */
DWrite_Init();
s_directx_load_attempted = 1;
s_dwc = DWriteContext_Open();
return s_dwc != NULL ? 1 : 0;
}
#endif
#if defined(FEAT_RENDER_OPTIONS) || defined(PROTO) #if defined(FEAT_RENDER_OPTIONS) || defined(PROTO)
int int
gui_mch_set_rendering_options(char_u *s) gui_mch_set_rendering_options(char_u *s)
@@ -369,6 +355,34 @@ static int allow_scrollbar = FALSE;
# define MyTranslateMessage(x) TranslateMessage(x) # define MyTranslateMessage(x) TranslateMessage(x)
#endif #endif
#if defined(FEAT_DIRECTX)
static int
directx_enabled(void)
{
if (s_dwc != NULL)
return 1;
else if (s_directx_load_attempted)
return 0;
/* load DirectX */
DWrite_Init();
s_directx_load_attempted = 1;
s_dwc = DWriteContext_Open();
directx_binddc();
return s_dwc != NULL ? 1 : 0;
}
static void
directx_binddc(void)
{
if (s_textArea != NULL)
{
RECT rect;
GetClientRect(s_textArea, &rect);
DWriteContext_BindDC(s_dwc, s_hdc, &rect);
}
}
#endif
#if defined(FEAT_MBYTE) || defined(GLOBAL_IME) #if defined(FEAT_MBYTE) || defined(GLOBAL_IME)
/* use of WindowProc depends on wide_WindowProc */ /* use of WindowProc depends on wide_WindowProc */
# define MyWindowProc vim_WindowProc # define MyWindowProc vim_WindowProc
@@ -485,12 +499,10 @@ static void TrackUserActivity(UINT uMsg);
* These LOGFONT used for IME. * These LOGFONT used for IME.
*/ */
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
# ifdef USE_IM_CONTROL
/* holds LOGFONT for 'guifontwide' if available, otherwise 'guifont' */ /* holds LOGFONT for 'guifontwide' if available, otherwise 'guifont' */
static LOGFONT norm_logfont; static LOGFONT norm_logfont;
/* holds LOGFONT for 'guifont' always. */ /* holds LOGFONT for 'guifont' always. */
static LOGFONT sub_logfont; static LOGFONT sub_logfont;
# endif
#endif #endif
#ifdef FEAT_MBYTE_IME #ifdef FEAT_MBYTE_IME
@@ -591,6 +603,10 @@ _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)
if (IS_ENABLE_DIRECTX())
DWriteContext_Flush(s_dwc);
#endif
} }
static void static void
@@ -1002,6 +1018,19 @@ _OnMouseMoveOrRelease(
_OnMouseEvent(button, x, y, FALSE, keyFlags); _OnMouseEvent(button, x, y, FALSE, keyFlags);
} }
static void
_OnSizeTextArea(
HWND hwnd UNUSED,
UINT state UNUSED,
int cx UNUSED,
int cy UNUSED)
{
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
directx_binddc();
#endif
}
#ifdef FEAT_MENU #ifdef FEAT_MENU
/* /*
* Find the vimmenu_T with the given id * Find the vimmenu_T with the given id
@@ -1236,6 +1265,7 @@ _TextAreaWndProc(
HANDLE_MSG(hwnd, WM_XBUTTONDBLCLK,_OnMouseButtonDown); HANDLE_MSG(hwnd, WM_XBUTTONDBLCLK,_OnMouseButtonDown);
HANDLE_MSG(hwnd, WM_XBUTTONDOWN,_OnMouseButtonDown); HANDLE_MSG(hwnd, WM_XBUTTONDOWN,_OnMouseButtonDown);
HANDLE_MSG(hwnd, WM_XBUTTONUP, _OnMouseMoveOrRelease); HANDLE_MSG(hwnd, WM_XBUTTONUP, _OnMouseMoveOrRelease);
HANDLE_MSG(hwnd, WM_SIZE, _OnSizeTextArea);
#ifdef FEAT_BEVAL_GUI #ifdef FEAT_BEVAL_GUI
case WM_NOTIFY: Handle_WM_Notify(hwnd, (LPNMHDR)lParam); case WM_NOTIFY: Handle_WM_Notify(hwnd, (LPNMHDR)lParam);
@@ -1635,6 +1665,11 @@ gui_mch_invert_rectangle(
{ {
RECT rc; RECT rc;
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
DWriteContext_Flush(s_dwc);
#endif
/* /*
* Note: InvertRect() excludes right and bottom of rectangle. * Note: InvertRect() excludes right and bottom of rectangle.
*/ */
@@ -1663,6 +1698,11 @@ gui_mch_draw_hollow_cursor(guicolor_T color)
HBRUSH hbr; HBRUSH hbr;
RECT rc; RECT rc;
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
DWriteContext_Flush(s_dwc);
#endif
/* /*
* Note: FrameRect() excludes right and bottom of rectangle. * Note: FrameRect() excludes right and bottom of rectangle.
*/ */
@@ -1703,6 +1743,12 @@ gui_mch_draw_part_cursor(
rc.top = FILL_Y(gui.row) + gui.char_height - h; rc.top = FILL_Y(gui.row) + gui.char_height - h;
rc.right = rc.left + w; rc.right = rc.left + w;
rc.bottom = rc.top + h; rc.bottom = rc.top + h;
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
DWriteContext_Flush(s_dwc);
#endif
hbr = CreateSolidBrush(color); hbr = CreateSolidBrush(color);
FillRect(s_hdc, &rc, hbr); FillRect(s_hdc, &rc, hbr);
DeleteBrush(hbr); DeleteBrush(hbr);
@@ -2858,10 +2904,6 @@ _OnPaint(
out_flush(); /* make sure all output has been processed */ out_flush(); /* make sure all output has been processed */
(void)BeginPaint(hwnd, &ps); (void)BeginPaint(hwnd, &ps);
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
DWriteContext_BeginDraw(s_dwc);
#endif
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
/* prevent multi-byte characters from misprinting on an invalid /* prevent multi-byte characters from misprinting on an invalid
@@ -2878,19 +2920,11 @@ _OnPaint(
if (!IsRectEmpty(&ps.rcPaint)) if (!IsRectEmpty(&ps.rcPaint))
{ {
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
DWriteContext_BindDC(s_dwc, s_hdc, &ps.rcPaint);
#endif
gui_redraw(ps.rcPaint.left, ps.rcPaint.top, gui_redraw(ps.rcPaint.left, ps.rcPaint.top,
ps.rcPaint.right - ps.rcPaint.left + 1, ps.rcPaint.right - ps.rcPaint.left + 1,
ps.rcPaint.bottom - ps.rcPaint.top + 1); ps.rcPaint.bottom - ps.rcPaint.top + 1);
} }
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
DWriteContext_EndDraw(s_dwc);
#endif
EndPaint(hwnd, &ps); EndPaint(hwnd, &ps);
} }
} }
@@ -3012,6 +3046,11 @@ gui_mch_flash(int msec)
{ {
RECT rc; RECT rc;
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
DWriteContext_Flush(s_dwc);
#endif
/* /*
* Note: InvertRect() excludes right and bottom of rectangle. * Note: InvertRect() excludes right and bottom of rectangle.
*/ */
@@ -3084,6 +3123,12 @@ gui_mch_delete_lines(
intel_gpu_workaround(); intel_gpu_workaround();
#if defined(FEAT_DIRECTX)
// Commit drawing queue before ScrollWindowEx.
if (IS_ENABLE_DIRECTX())
DWriteContext_Flush(s_dwc);
#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);
@@ -3117,6 +3162,12 @@ gui_mch_insert_lines(
intel_gpu_workaround(); intel_gpu_workaround();
#if defined(FEAT_DIRECTX)
// Commit drawing queue before ScrollWindowEx.
if (IS_ENABLE_DIRECTX())
DWriteContext_Flush(s_dwc);
#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);
@@ -6147,9 +6198,6 @@ gui_mch_draw_string(
#endif #endif
HPEN hpen, old_pen; HPEN hpen, old_pen;
int y; int y;
#ifdef FEAT_DIRECTX
int font_is_ttf_or_vector = 0;
#endif
/* /*
* Italic and bold text seems to have an extra row of pixels at the bottom * Italic and bold text seems to have an extra row of pixels at the bottom
@@ -6210,6 +6258,11 @@ gui_mch_draw_string(
hbr = hbr_cache[brush_lru]; hbr = hbr_cache[brush_lru];
brush_lru = !brush_lru; brush_lru = !brush_lru;
} }
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
DWriteContext_FillRect(s_dwc, &rc, gui.currBgColor);
#endif
FillRect(s_hdc, &rc, hbr); FillRect(s_hdc, &rc, hbr);
SetBkMode(s_hdc, TRANSPARENT); SetBkMode(s_hdc, TRANSPARENT);
@@ -6229,16 +6282,7 @@ gui_mch_draw_string(
#ifdef FEAT_DIRECTX #ifdef FEAT_DIRECTX
if (IS_ENABLE_DIRECTX()) if (IS_ENABLE_DIRECTX())
{ DWriteContext_SetFont(s_dwc, (HFONT)gui.currFont);
TEXTMETRIC tm;
GetTextMetrics(s_hdc, &tm);
if (tm.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR))
{
font_is_ttf_or_vector = 1;
DWriteContext_SetFont(s_dwc, (HFONT)gui.currFont);
}
}
#endif #endif
if (pad_size != Columns || padding == NULL || padding[0] != gui.char_width) if (pad_size != Columns || padding == NULL || padding[0] != gui.char_width)
@@ -6349,12 +6393,13 @@ gui_mch_draw_string(
++clen; ++clen;
} }
#if defined(FEAT_DIRECTX) #if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX() && font_is_ttf_or_vector) if (IS_ENABLE_DIRECTX())
{ {
/* Add one to "cells" for italics. */ /* Add one to "cells" for italics. */
DWriteContext_DrawText(s_dwc, s_hdc, unicodebuf, wlen, DWriteContext_DrawText(s_dwc, unicodebuf, wlen,
TEXT_X(col), TEXT_Y(row), FILL_X(cells + 1), FILL_Y(1), TEXT_X(col), TEXT_Y(row), FILL_X(cells + 1), FILL_Y(1),
gui.char_width, gui.currFgColor); gui.char_width, gui.currFgColor,
foptions, pcliprect, unicodepdy);
} }
else else
#endif #endif
@@ -6413,6 +6458,12 @@ 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)
{ {
@@ -6475,6 +6526,11 @@ gui_mch_flush(void)
BOOL __stdcall GdiFlush(void); BOOL __stdcall GdiFlush(void);
# endif # endif
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
DWriteContext_Flush(s_dwc);
#endif
GdiFlush(); GdiFlush();
} }
@@ -6483,6 +6539,14 @@ clear_rect(RECT *rcp)
{ {
HBRUSH hbr; HBRUSH hbr;
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
{
DWriteContext_FillRect(s_dwc, rcp, gui.back_pixel);
return;
}
#endif
hbr = CreateSolidBrush(gui.back_pixel); hbr = CreateSolidBrush(gui.back_pixel);
FillRect(s_hdc, rcp, hbr); FillRect(s_hdc, rcp, hbr);
DeleteBrush(hbr); DeleteBrush(hbr);
@@ -8388,6 +8452,11 @@ gui_mch_drawsign(int row, int col, int typenr)
if (!gui.in_use || (sign = (signicon_t *)sign_get_image(typenr)) == NULL) if (!gui.in_use || (sign = (signicon_t *)sign_get_image(typenr)) == NULL)
return; return;
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
DWriteContext_Flush(s_dwc);
#endif
x = TEXT_X(col); x = TEXT_X(col);
y = TEXT_Y(row); y = TEXT_Y(row);
w = gui.char_width * 2; w = gui.char_width * 2;
@@ -8867,6 +8936,11 @@ netbeans_draw_multisign_indicator(int row)
x = 0; x = 0;
y = TEXT_Y(row); y = TEXT_Y(row);
#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
DWriteContext_Flush(s_dwc);
#endif
for (i = 0; i < gui.char_height - 3; i++) for (i = 0; i < gui.char_height - 3; i++)
SetPixel(s_hdc, x+2, y++, gui.currFgColor); SetPixel(s_hdc, x+2, y++, gui.currFgColor);

View File

@@ -4782,6 +4782,48 @@ iconv_end(void)
#endif /* FEAT_MBYTE */ #endif /* FEAT_MBYTE */
#ifdef FEAT_GUI
# define USE_IMACTIVATEFUNC (!gui.in_use && *p_imaf != NUL)
# define USE_IMSTATUSFUNC (!gui.in_use && *p_imsf != NUL)
#else
# define USE_IMACTIVATEFUNC (*p_imaf != NUL)
# define USE_IMSTATUSFUNC (*p_imsf != NUL)
#endif
#ifdef FEAT_EVAL
static void
call_imactivatefunc(int active)
{
char_u *argv[1];
if (active)
argv[0] = (char_u *)"1";
else
argv[0] = (char_u *)"0";
(void)call_func_retnr(p_imaf, 1, argv, FALSE);
}
static int
call_imstatusfunc(void)
{
int is_active;
/* FIXME: Don't execute user function in unsafe situation. */
if (exiting
# ifdef FEAT_AUTOCMD
|| is_autocmd_blocked()
# endif
)
return FALSE;
/* FIXME: :py print 'xxx' is shown duplicate result.
* Use silent to avoid it. */
++msg_silent;
is_active = call_func_retnr(p_imsf, 0, NULL, FALSE);
--msg_silent;
return (is_active > 0);
}
#endif
#if defined(FEAT_XIM) || defined(PROTO) #if defined(FEAT_XIM) || defined(PROTO)
# if defined(FEAT_GUI_GTK) || defined(PROTO) # if defined(FEAT_GUI_GTK) || defined(PROTO)
@@ -5654,6 +5696,11 @@ im_synthesize_keypress(unsigned int keyval, unsigned int state)
void void
xim_reset(void) xim_reset(void)
{ {
#ifdef FEAT_EVAL
if (USE_IMACTIVATEFUNC)
call_imactivatefunc(im_is_active);
else
#endif
if (xic != NULL) if (xic != NULL)
{ {
gtk_im_context_reset(xic); gtk_im_context_reset(xic);
@@ -5664,20 +5711,7 @@ xim_reset(void)
{ {
xim_set_focus(gui.in_focus); xim_set_focus(gui.in_focus);
# ifdef FEAT_EVAL if (im_activatekey_keyval != GDK_VoidSymbol)
if (p_imaf[0] != NUL)
{
char_u *argv[1];
if (im_is_active)
argv[0] = (char_u *)"1";
else
argv[0] = (char_u *)"0";
(void)call_func_retnr(p_imaf, 1, argv, FALSE);
}
else
# endif
if (im_activatekey_keyval != GDK_VoidSymbol)
{ {
if (im_is_active) if (im_is_active)
{ {
@@ -5842,24 +5876,8 @@ xim_queue_key_press_event(GdkEventKey *event, int down)
im_get_status(void) im_get_status(void)
{ {
# ifdef FEAT_EVAL # ifdef FEAT_EVAL
if (p_imsf[0] != NUL) if (USE_IMSTATUSFUNC)
{ return call_imstatusfunc();
int is_active;
/* FIXME: Don't execute user function in unsafe situation. */
if (exiting
# ifdef FEAT_AUTOCMD
|| is_autocmd_blocked()
# endif
)
return FALSE;
/* FIXME: :py print 'xxx' is shown duplicate result.
* Use silent to avoid it. */
++msg_silent;
is_active = call_func_retnr(p_imsf, 0, NULL, FALSE);
--msg_silent;
return (is_active > 0);
}
# endif # endif
return im_is_active; return im_is_active;
} }
@@ -5881,30 +5899,43 @@ im_is_preediting(void)
static int xim_is_active = FALSE; /* XIM should be active in the current static int xim_is_active = FALSE; /* XIM should be active in the current
mode */ mode */
static int xim_has_focus = FALSE; /* XIM is really being used for Vim */ static int xim_has_focus = FALSE; /* XIM is really being used for Vim */
#ifdef FEAT_GUI_X11 # ifdef FEAT_GUI_X11
static XIMStyle input_style; static XIMStyle input_style;
static int status_area_enabled = TRUE; static int status_area_enabled = TRUE;
#endif # endif
/* /*
* Switch using XIM on/off. This is used by the code that changes "State". * Switch using XIM on/off. This is used by the code that changes "State".
* When 'imactivatefunc' is defined use that function instead.
*/ */
void void
im_set_active(int active) im_set_active(int active_arg)
{ {
if (xic == NULL) int active = active_arg;
return;
/* If 'imdisable' is set, XIM is never active. */ /* If 'imdisable' is set, XIM is never active. */
if (p_imdisable) if (p_imdisable)
active = FALSE; active = FALSE;
#if !defined(FEAT_GUI_GTK)
else if (input_style & XIMPreeditPosition) else if (input_style & XIMPreeditPosition)
/* There is a problem in switching XIM off when preediting is used, /* There is a problem in switching XIM off when preediting is used,
* and it is not clear how this can be solved. For now, keep XIM on * and it is not clear how this can be solved. For now, keep XIM on
* all the time, like it was done in Vim 5.8. */ * all the time, like it was done in Vim 5.8. */
active = TRUE; active = TRUE;
#endif
# if defined(FEAT_EVAL)
if (USE_IMACTIVATEFUNC)
{
if (active != im_get_status())
{
call_imactivatefunc(active);
xim_has_focus = active;
}
return;
}
# endif
if (xic == NULL)
return;
/* Remember the active state, it is needed when Vim gets keyboard focus. */ /* Remember the active state, it is needed when Vim gets keyboard focus. */
xim_is_active = active; xim_is_active = active;
@@ -6006,19 +6037,19 @@ xim_set_preedit(void)
} }
} }
#if defined(FEAT_GUI_X11) # if defined(FEAT_GUI_X11)
static char e_xim[] = N_("E285: Failed to create input context"); static char e_xim[] = N_("E285: Failed to create input context");
#endif # endif
#if defined(FEAT_GUI_X11) || defined(PROTO) # if defined(FEAT_GUI_X11) || defined(PROTO)
# if defined(XtSpecificationRelease) && XtSpecificationRelease >= 6 && !defined(SUN_SYSTEM) # if defined(XtSpecificationRelease) && XtSpecificationRelease >= 6 && !defined(SUN_SYSTEM)
# define USE_X11R6_XIM # define USE_X11R6_XIM
# endif # endif
static int xim_real_init(Window x11_window, Display *x11_display); static int xim_real_init(Window x11_window, Display *x11_display);
#ifdef USE_X11R6_XIM # ifdef USE_X11R6_XIM
static void xim_destroy_cb(XIM im, XPointer client_data, XPointer call_data); static void xim_destroy_cb(XIM im, XPointer client_data, XPointer call_data);
static void static void
@@ -6030,9 +6061,9 @@ xim_instantiate_cb(
Window x11_window; Window x11_window;
Display *x11_display; Display *x11_display;
#ifdef XIM_DEBUG # ifdef XIM_DEBUG
xim_log("xim_instantiate_cb()\n"); xim_log("xim_instantiate_cb()\n");
#endif # endif
gui_get_x11_windis(&x11_window, &x11_display); gui_get_x11_windis(&x11_window, &x11_display);
if (display != x11_display) if (display != x11_display)
@@ -6054,9 +6085,9 @@ xim_destroy_cb(
Window x11_window; Window x11_window;
Display *x11_display; Display *x11_display;
#ifdef XIM_DEBUG # ifdef XIM_DEBUG
xim_log("xim_destroy_cb()\n"); xim_log("xim_destroy_cb()\n");
#endif #endif
gui_get_x11_windis(&x11_window, &x11_display); gui_get_x11_windis(&x11_window, &x11_display);
xic = NULL; xic = NULL;
@@ -6067,7 +6098,7 @@ xim_destroy_cb(
XRegisterIMInstantiateCallback(x11_display, NULL, NULL, NULL, XRegisterIMInstantiateCallback(x11_display, NULL, NULL, NULL,
xim_instantiate_cb, NULL); xim_instantiate_cb, NULL);
} }
#endif # endif
void void
xim_init(void) xim_init(void)
@@ -6075,9 +6106,9 @@ xim_init(void)
Window x11_window; Window x11_window;
Display *x11_display; Display *x11_display;
#ifdef XIM_DEBUG # ifdef XIM_DEBUG
xim_log("xim_init()\n"); xim_log("xim_init()\n");
#endif # endif
gui_get_x11_windis(&x11_window, &x11_display); gui_get_x11_windis(&x11_window, &x11_display);
@@ -6088,10 +6119,10 @@ xim_init(void)
gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH); gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH);
#ifdef USE_X11R6_XIM # ifdef USE_X11R6_XIM
XRegisterIMInstantiateCallback(x11_display, NULL, NULL, NULL, XRegisterIMInstantiateCallback(x11_display, NULL, NULL, NULL,
xim_instantiate_cb, NULL); xim_instantiate_cb, NULL);
#endif # endif
} }
static int static int
@@ -6103,7 +6134,7 @@ xim_real_init(Window x11_window, Display *x11_display)
*ns, *ns,
*end, *end,
tmp[1024]; tmp[1024];
#define IMLEN_MAX 40 # define IMLEN_MAX 40
char buf[IMLEN_MAX + 7]; char buf[IMLEN_MAX + 7];
XIM xim = NULL; XIM xim = NULL;
XIMStyles *xim_styles; XIMStyles *xim_styles;
@@ -6168,7 +6199,7 @@ xim_real_init(Window x11_window, Display *x11_display)
return FALSE; return FALSE;
} }
#ifdef USE_X11R6_XIM # ifdef USE_X11R6_XIM
{ {
XIMCallback destroy_cb; XIMCallback destroy_cb;
@@ -6177,7 +6208,7 @@ xim_real_init(Window x11_window, Display *x11_display)
if (XSetIMValues(xim, XNDestroyCallback, &destroy_cb, NULL)) if (XSetIMValues(xim, XNDestroyCallback, &destroy_cb, NULL))
EMSG(_("E287: Warning: Could not set destroy callback to IM")); EMSG(_("E287: Warning: Could not set destroy callback to IM"));
} }
#endif # endif
if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles) if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles)
{ {
@@ -6253,7 +6284,7 @@ xim_real_init(Window x11_window, Display *x11_display)
/* A crash was reported when trying to pass gui.norm_font as XNFontSet, /* A crash was reported when trying to pass gui.norm_font as XNFontSet,
* thus that has been removed. Hopefully the default works... */ * thus that has been removed. Hopefully the default works... */
#ifdef FEAT_XFONTSET # ifdef FEAT_XFONTSET
if (gui.fontset != NOFONTSET) if (gui.fontset != NOFONTSET)
{ {
preedit_list = XVaCreateNestedList(0, preedit_list = XVaCreateNestedList(0,
@@ -6269,7 +6300,7 @@ xim_real_init(Window x11_window, Display *x11_display)
NULL); NULL);
} }
else else
#endif # endif
{ {
preedit_list = XVaCreateNestedList(0, preedit_list = XVaCreateNestedList(0,
XNSpotLocation, &over_spot, XNSpotLocation, &over_spot,
@@ -6303,7 +6334,8 @@ xim_real_init(Window x11_window, Display *x11_display)
} }
else else
{ {
EMSG(_(e_xim)); if (!is_not_a_term())
EMSG(_(e_xim));
XCloseIM(xim); XCloseIM(xim);
return FALSE; return FALSE;
} }
@@ -6311,7 +6343,7 @@ xim_real_init(Window x11_window, Display *x11_display)
return TRUE; return TRUE;
} }
#endif /* FEAT_GUI_X11 */ # endif /* FEAT_GUI_X11 */
/* /*
* Get IM status. When IM is on, return TRUE. Else return FALSE. * Get IM status. When IM is on, return TRUE. Else return FALSE.
@@ -6322,6 +6354,10 @@ xim_real_init(Window x11_window, Display *x11_display)
int int
im_get_status(void) im_get_status(void)
{ {
# ifdef FEAT_EVAL
if (USE_IMSTATUSFUNC)
return call_imstatusfunc();
# endif
return xim_has_focus; return xim_has_focus;
} }
@@ -6442,6 +6478,43 @@ xim_get_status_area_height(void)
} }
# endif # endif
#else /* !defined(FEAT_XIM) */
# if !defined(FEAT_GUI_W32) || !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))
static int im_was_set_active = FALSE;
int
im_get_status()
{
# ifdef FEAT_EVAL
if (USE_IMSTATUSFUNC)
return call_imstatusfunc();
# endif
return im_was_set_active;
}
void
im_set_active(int active_arg)
{
# if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
int active = !p_imdisable && active_arg;
if (USE_IMACTIVATEFUNC && active != im_get_status())
{
call_imactivatefunc(active);
im_was_set_active = active;
}
# endif
}
# ifdef FEAT_GUI
void
im_set_position(int row, int col)
{
}
# endif
# endif
#endif /* FEAT_XIM */ #endif /* FEAT_XIM */
#if defined(FEAT_MBYTE) || defined(PROTO) #if defined(FEAT_MBYTE) || defined(PROTO)

View File

@@ -892,7 +892,7 @@ getcount:
int lit = FALSE; /* get extra character literally */ int lit = FALSE; /* get extra character literally */
int langmap_active = FALSE; /* using :lmap mappings */ int langmap_active = FALSE; /* using :lmap mappings */
int lang; /* getting a text character */ int lang; /* getting a text character */
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
int save_smd; /* saved value of p_smd */ int save_smd; /* saved value of p_smd */
#endif #endif
@@ -957,7 +957,7 @@ getcount:
State = LANGMAP; State = LANGMAP;
langmap_active = TRUE; langmap_active = TRUE;
} }
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
save_smd = p_smd; save_smd = p_smd;
p_smd = FALSE; /* Don't let the IM code show the mode here */ p_smd = FALSE; /* Don't let the IM code show the mode here */
if (lang && curbuf->b_p_iminsert == B_IMODE_IM) if (lang && curbuf->b_p_iminsert == B_IMODE_IM)
@@ -973,7 +973,7 @@ getcount:
++allow_keys; ++allow_keys;
State = NORMAL_BUSY; State = NORMAL_BUSY;
} }
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
if (lang) if (lang)
{ {
if (curbuf->b_p_iminsert != B_IMODE_LMAP) if (curbuf->b_p_iminsert != B_IMODE_LMAP)

View File

@@ -1539,7 +1539,7 @@ static struct vimoption options[] =
(char_u *)&p_ic, PV_NONE, (char_u *)&p_ic, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
{"imactivatefunc","imaf",P_STRING|P_VI_DEF|P_SECURE, {"imactivatefunc","imaf",P_STRING|P_VI_DEF|P_SECURE,
# if defined(FEAT_EVAL) && defined(FEAT_XIM) && defined(FEAT_GUI_GTK) #if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
(char_u *)&p_imaf, PV_NONE, (char_u *)&p_imaf, PV_NONE,
{(char_u *)"", (char_u *)NULL} {(char_u *)"", (char_u *)NULL}
# else # else
@@ -1555,14 +1555,14 @@ static struct vimoption options[] =
#endif #endif
{(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
{"imcmdline", "imc", P_BOOL|P_VI_DEF, {"imcmdline", "imc", P_BOOL|P_VI_DEF,
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
(char_u *)&p_imcmdline, PV_NONE, (char_u *)&p_imcmdline, PV_NONE,
#else #else
(char_u *)NULL, PV_NONE, (char_u *)NULL, PV_NONE,
#endif #endif
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
{"imdisable", "imd", P_BOOL|P_VI_DEF, {"imdisable", "imd", P_BOOL|P_VI_DEF,
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
(char_u *)&p_imdisable, PV_NONE, (char_u *)&p_imdisable, PV_NONE,
#else #else
(char_u *)NULL, PV_NONE, (char_u *)NULL, PV_NONE,
@@ -1582,7 +1582,7 @@ static struct vimoption options[] =
{(char_u *)B_IMODE_USE_INSERT, (char_u *)0L} {(char_u *)B_IMODE_USE_INSERT, (char_u *)0L}
SCRIPTID_INIT}, SCRIPTID_INIT},
{"imstatusfunc","imsf",P_STRING|P_VI_DEF|P_SECURE, {"imstatusfunc","imsf",P_STRING|P_VI_DEF|P_SECURE,
#if defined(FEAT_EVAL) && defined(FEAT_XIM) && defined(FEAT_GUI_GTK) #if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
(char_u *)&p_imsf, PV_NONE, (char_u *)&p_imsf, PV_NONE,
{(char_u *)"", (char_u *)NULL} {(char_u *)"", (char_u *)NULL}
#else #else
@@ -6369,8 +6369,13 @@ did_set_string_option(
* display output conversion. */ * display output conversion. */
if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc)) if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc))
{ {
convert_setup(&input_conv, p_tenc, p_enc); if (convert_setup(&input_conv, p_tenc, p_enc) == FAIL
convert_setup(&output_conv, p_enc, p_tenc); || convert_setup(&output_conv, p_enc, p_tenc) == FAIL)
{
EMSG3(_("E950: Cannot convert between %s and %s"),
p_tenc, p_enc);
errmsg = e_invarg;
}
} }
# if defined(WIN3264) && defined(FEAT_MBYTE) # if defined(WIN3264) && defined(FEAT_MBYTE)
@@ -8469,7 +8474,7 @@ set_bool_option(
} }
#endif #endif
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
/* 'imdisable' */ /* 'imdisable' */
else if ((int *)varp == &p_imdisable) else if ((int *)varp == &p_imdisable)
{ {

View File

@@ -581,13 +581,15 @@ EXTERN char_u *p_iconstring; /* 'iconstring' */
EXTERN int p_ic; /* 'ignorecase' */ EXTERN int p_ic; /* 'ignorecase' */
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
EXTERN char_u *p_imak; /* 'imactivatekey' */ EXTERN char_u *p_imak; /* 'imactivatekey' */
#define IM_ON_THE_SPOT 0L
#define IM_OVER_THE_SPOT 1L
EXTERN long p_imst; /* 'imstyle' */
#endif
#if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
EXTERN char_u *p_imaf; /* 'imactivatefunc' */ EXTERN char_u *p_imaf; /* 'imactivatefunc' */
EXTERN char_u *p_imsf; /* 'imstatusfunc' */ EXTERN char_u *p_imsf; /* 'imstatusfunc' */
EXTERN long p_imst; /* 'imstyle' */
# define IM_ON_THE_SPOT 0L
# define IM_OVER_THE_SPOT 1L
#endif #endif
#ifdef USE_IM_CONTROL #ifdef FEAT_MBYTE
EXTERN int p_imcmdline; /* 'imcmdline' */ EXTERN int p_imcmdline; /* 'imcmdline' */
EXTERN int p_imdisable; /* 'imdisable' */ EXTERN int p_imdisable; /* 'imdisable' */
#endif #endif

View File

@@ -836,7 +836,7 @@ split_message(char_u *mesg, pumitem_T **array)
item->bytelen = p - item->start; item->bytelen = p - item->start;
if (item->cells > max_cells) if (item->cells > max_cells)
max_cells = item->cells; max_cells = item->cells;
long_item_count += item->cells / BALLOON_MIN_WIDTH; long_item_count += (item->cells - 1) / BALLOON_MIN_WIDTH;
} }
height = 2 + ga.ga_len; height = 2 + ga.ga_len;

View File

@@ -1,5 +1,4 @@
/* gui_w32.c */ /* gui_w32.c */
int directx_enabled(void);
int gui_mch_set_rendering_options(char_u *s); int gui_mch_set_rendering_options(char_u *s);
int gui_mch_is_blinking(void); int gui_mch_is_blinking(void);
int gui_mch_is_blink_off(void); int gui_mch_is_blink_off(void);

View File

@@ -2654,6 +2654,9 @@ qf_list(exarg_T *eap)
int idx2 = -1; int idx2 = -1;
char_u *arg = eap->arg; char_u *arg = eap->arg;
int plus = FALSE; int plus = FALSE;
int qfFileAttr;
int qfSepAttr;
int qfLineAttr;
int all = eap->forceit; /* if not :cl!, only show int all = eap->forceit; /* if not :cl!, only show
recognised errors */ recognised errors */
qf_info_T *qi = &ql_info; qf_info_T *qi = &ql_info;
@@ -2699,6 +2702,20 @@ qf_list(exarg_T *eap)
idx2 = (-idx2 > i) ? 0 : idx2 + i + 1; idx2 = (-idx2 > i) ? 0 : idx2 + i + 1;
} }
/*
* Get the attributes for the different quickfix highlight items. Note
* that this depends on syntax items defined in the qf.vim syntax file
*/
qfFileAttr = syn_name2attr((char_u *)"qfFileName");
if (qfFileAttr == 0)
qfFileAttr = HL_ATTR(HLF_D);
qfSepAttr = syn_name2attr((char_u *)"qfSeparator");
if (qfSepAttr == 0)
qfSepAttr = HL_ATTR(HLF_D);
qfLineAttr = syn_name2attr((char_u *)"qfLineNr");
if (qfLineAttr == 0)
qfLineAttr = HL_ATTR(HLF_N);
if (qi->qf_lists[qi->qf_curlist].qf_nonevalid) if (qi->qf_lists[qi->qf_curlist].qf_nonevalid)
all = TRUE; all = TRUE;
qfp = qi->qf_lists[qi->qf_curlist].qf_start; qfp = qi->qf_lists[qi->qf_curlist].qf_start;
@@ -2724,22 +2741,26 @@ qf_list(exarg_T *eap)
vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", vim_snprintf((char *)IObuff, IOSIZE, "%2d %s",
i, (char *)fname); i, (char *)fname);
msg_outtrans_attr(IObuff, i == qi->qf_lists[qi->qf_curlist].qf_index msg_outtrans_attr(IObuff, i == qi->qf_lists[qi->qf_curlist].qf_index
? HL_ATTR(HLF_QFL) : HL_ATTR(HLF_D)); ? HL_ATTR(HLF_QFL) : qfFileAttr);
if (qfp->qf_lnum != 0)
msg_puts_attr((char_u *)":", qfSepAttr);
if (qfp->qf_lnum == 0) if (qfp->qf_lnum == 0)
IObuff[0] = NUL; IObuff[0] = NUL;
else if (qfp->qf_col == 0) else if (qfp->qf_col == 0)
sprintf((char *)IObuff, ":%ld", qfp->qf_lnum); sprintf((char *)IObuff, "%ld", qfp->qf_lnum);
else else
sprintf((char *)IObuff, ":%ld col %d", sprintf((char *)IObuff, "%ld col %d",
qfp->qf_lnum, qfp->qf_col); qfp->qf_lnum, qfp->qf_col);
sprintf((char *)IObuff + STRLEN(IObuff), "%s:", sprintf((char *)IObuff + STRLEN(IObuff), "%s",
(char *)qf_types(qfp->qf_type, qfp->qf_nr)); (char *)qf_types(qfp->qf_type, qfp->qf_nr));
msg_puts_attr(IObuff, HL_ATTR(HLF_N)); msg_puts_attr(IObuff, qfLineAttr);
msg_puts_attr((char_u *)":", qfSepAttr);
if (qfp->qf_pattern != NULL) if (qfp->qf_pattern != NULL)
{ {
qf_fmt_text(qfp->qf_pattern, IObuff, IOSIZE); qf_fmt_text(qfp->qf_pattern, IObuff, IOSIZE);
STRCAT(IObuff, ":");
msg_puts(IObuff); msg_puts(IObuff);
msg_puts_attr((char_u *)":", qfSepAttr);
} }
msg_puts((char_u *)" "); msg_puts((char_u *)" ");

View File

@@ -2091,12 +2091,8 @@ struct file_buffer
#define B_IMODE_USE_INSERT -1 /* Use b_p_iminsert value for search */ #define B_IMODE_USE_INSERT -1 /* Use b_p_iminsert value for search */
#define B_IMODE_NONE 0 /* Input via none */ #define B_IMODE_NONE 0 /* Input via none */
#define B_IMODE_LMAP 1 /* Input via langmap */ #define B_IMODE_LMAP 1 /* Input via langmap */
#ifndef USE_IM_CONTROL #define B_IMODE_IM 2 /* Input via input method */
# define B_IMODE_LAST 1 #define B_IMODE_LAST 2
#else
# define B_IMODE_IM 2 /* Input via input method */
# define B_IMODE_LAST 2
#endif
#ifdef FEAT_KEYMAP #ifdef FEAT_KEYMAP
short b_kmap_state; /* using "lmap" mappings */ short b_kmap_state; /* using "lmap" mappings */

View File

@@ -79,7 +79,6 @@ NEW_TESTS = test_arabic.res \
test_cdo.res \ test_cdo.res \
test_channel.res \ test_channel.res \
test_charsearch.res \ test_charsearch.res \
test_charsearch_utf8.res \
test_cindent.res \ test_cindent.res \
test_clientserver.res \ test_clientserver.res \
test_close_count.res \ test_close_count.res \
@@ -98,7 +97,6 @@ NEW_TESTS = test_arabic.res \
test_exec_while_if.res \ test_exec_while_if.res \
test_exists.res \ test_exists.res \
test_exists_autocmd.res \ test_exists_autocmd.res \
test_expr_utf8.res \
test_farsi.res \ test_farsi.res \
test_file_size.res \ test_file_size.res \
test_find_complete.res \ test_find_complete.res \
@@ -117,6 +115,7 @@ NEW_TESTS = test_arabic.res \
test_highlight.res \ test_highlight.res \
test_history.res \ test_history.res \
test_hlsearch.res \ test_hlsearch.res \
test_iminsert.res \
test_increment.res \ test_increment.res \
test_increment_dbcs.res \ test_increment_dbcs.res \
test_ins_complete.res \ test_ins_complete.res \
@@ -128,16 +127,13 @@ NEW_TESTS = test_arabic.res \
test_listchars.res \ test_listchars.res \
test_listdict.res \ test_listdict.res \
test_listlbr.res \ test_listlbr.res \
test_listlbr_utf8.res \
test_lua.res \ test_lua.res \
test_makeencoding.res \ test_makeencoding.res \
test_man.res \ test_man.res \
test_maparg.res \ test_maparg.res \
test_marks.res \ test_marks.res \
test_matchadd_conceal.res \ test_matchadd_conceal.res \
test_matchadd_conceal_utf8.res \
test_mksession.res \ test_mksession.res \
test_mksession_utf8.res \
test_nested_function.res \ test_nested_function.res \
test_netbeans.res \ test_netbeans.res \
test_normal.res \ test_normal.res \
@@ -156,8 +152,6 @@ NEW_TESTS = test_arabic.res \
test_quickfix.res \ test_quickfix.res \
test_quotestar.res \ test_quotestar.res \
test_regex_char_classes.res \ test_regex_char_classes.res \
test_regexp_latin.res \
test_regexp_utf8.res \
test_registers.res \ test_registers.res \
test_retab.res \ test_retab.res \
test_ruby.res \ test_ruby.res \
@@ -165,10 +159,8 @@ NEW_TESTS = test_arabic.res \
test_search.res \ test_search.res \
test_signs.res \ test_signs.res \
test_smartindent.res \ test_smartindent.res \
test_source_utf8.res \
test_spell.res \ test_spell.res \
test_startup.res \ test_startup.res \
test_startup_utf8.res \
test_stat.res \ test_stat.res \
test_substitute.res \ test_substitute.res \
test_swap.res \ test_swap.res \
@@ -183,8 +175,6 @@ NEW_TESTS = test_arabic.res \
test_undo.res \ test_undo.res \
test_user_func.res \ test_user_func.res \
test_usercommands.res \ test_usercommands.res \
test_utf8.res \
test_utf8_comparisons.res \
test_viminfo.res \ test_viminfo.res \
test_vimscript.res \ test_vimscript.res \
test_visual.res \ test_visual.res \

View File

@@ -11,7 +11,8 @@ endfor
for nr in range(8, 15) for nr in range(8, 15)
let s .= "\033[10" . (nr - 8) . "m " let s .= "\033[10" . (nr - 8) . "m "
endfor endfor
let s .= "\033[107m|" " Add | in original color pair to see white background.
let s .= "\033[m|"
call setline(2, s) call setline(2, s)
" 6 x 6 x 6 color cube " 6 x 6 x 6 color cube
@@ -22,7 +23,7 @@ for high in range(0, 5)
let nr = low + high * 36 let nr = low + high * 36
let s .= "\033[48;5;" . (nr + 16) . "m " let s .= "\033[48;5;" . (nr + 16) . "m "
endfor endfor
let s .= "\033[107m|" let s .= "\033[m|"
call setline(high + 4, s) call setline(high + 4, s)
endfor endfor
@@ -32,9 +33,9 @@ let s = ''
for nr in range(0, 23) for nr in range(0, 23)
let s .= "\033[48;5;" . (nr + 232) . "m " let s .= "\033[48;5;" . (nr + 232) . "m "
endfor endfor
let s .= "\033[107m|" let s .= "\033[m|"
call setline(11, s) call setline(11, s)
set binary set binary
write! <sfile>:h/xterm_ramp.txt write! <sfile>:h/color_ramp.txt
quit quit

View File

@@ -19,6 +19,9 @@ let script = [
/#define p_term /#define p_term
let end = line('.') let end = line('.')
" font name that works everywhere (hopefully)
let fontname = has('win32') ? 'fixedsys' : 'fixed'
" Two lists with values: values that work and values that fail. " Two lists with values: values that work and values that fail.
" When not listed, "othernum" or "otherstring" is used. " When not listed, "othernum" or "otherstring" is used.
let test_values = { let test_values = {
@@ -93,8 +96,9 @@ let test_values = {
\ 'foldmarker': [['((,))'], ['', 'xxx']], \ 'foldmarker': [['((,))'], ['', 'xxx']],
\ 'formatoptions': [['', 'vt', 'v,t'], ['xxx']], \ 'formatoptions': [['', 'vt', 'v,t'], ['xxx']],
\ 'guicursor': [['', 'n:block-Cursor'], ['xxx']], \ 'guicursor': [['', 'n:block-Cursor'], ['xxx']],
\ 'guifont': [['', 'fixedsys'], []], \ 'guifont': [['', fontname], []],
\ 'guifontwide': [['', 'fixedsys'], []], \ 'guifontwide': [['', fontname], []],
\ 'guifontset': [['', fontname], []],
\ 'helplang': [['', 'de', 'de,it'], ['xxx']], \ 'helplang': [['', 'de', 'de,it'], ['xxx']],
\ 'highlight': [['', 'e:Error'], ['xxx']], \ 'highlight': [['', 'e:Error'], ['xxx']],
\ 'imactivatekey': [['', 'S-space'], ['xxx']], \ 'imactivatekey': [['', 'S-space'], ['xxx']],
@@ -126,6 +130,7 @@ let test_values = {
\ 'tagcase': [['smart', 'match'], ['', 'xxx', 'smart,match']], \ 'tagcase': [['smart', 'match'], ['', 'xxx', 'smart,match']],
\ 'term': [[], []], \ 'term': [[], []],
\ 'termsize': [['', '24x80', '0x80', '32x0', '0x0'], ['xxx', '80', '8ax9', '24x80b']], \ 'termsize': [['', '24x80', '0x80', '32x0', '0x0'], ['xxx', '80', '8ax9', '24x80b']],
\ 'termencoding': [has('gui_gtk') ? [] : ['', 'utf-8'], ['xxx']],
\ 'toolbar': [['', 'icons', 'text'], ['xxx']], \ 'toolbar': [['', 'icons', 'text'], ['xxx']],
\ 'toolbariconsize': [['', 'tiny', 'huge'], ['xxx']], \ 'toolbariconsize': [['', 'tiny', 'huge'], ['xxx']],
\ 'ttymouse': [['', 'xterm'], ['xxx']], \ 'ttymouse': [['', 'xterm'], ['xxx']],
@@ -189,8 +194,11 @@ while 1
call add(script, "endif") call add(script, "endif")
endif endif
call add(script, 'set ' . name . '&') " cannot change 'termencoding' in GTK
call add(script, 'set ' . shortname . '&') if name != 'termencoding' || !has('gui_gtk')
call add(script, 'set ' . name . '&')
call add(script, 'set ' . shortname . '&')
endif
if name == 'verbosefile' if name == 'verbosefile'
call add(script, 'call delete("xxx")') call add(script, 'call delete("xxx")')
endif endif

View File

@@ -7,8 +7,11 @@
source test_charsearch_utf8.vim source test_charsearch_utf8.vim
source test_expr_utf8.vim source test_expr_utf8.vim
source test_listlbr_utf8.vim
source test_matchadd_conceal_utf8.vim source test_matchadd_conceal_utf8.vim
source test_mksession_utf8.vim
source test_regexp_utf8.vim source test_regexp_utf8.vim
source test_source_utf8.vim source test_source_utf8.vim
source test_startup_utf8.vim
source test_utf8.vim source test_utf8.vim
source test_utf8_comparisons.vim source test_utf8_comparisons.vim

View File

@@ -0,0 +1,31 @@
if !has('multi_byte')
finish
endif
source view_util.vim
let s:imactivatefunc_called = 0
let s:imstatusfunc_called = 0
func IM_activatefunc(active)
let s:imactivatefunc_called = 1
endfunc
func IM_statusfunc()
let s:imstatusfunc_called = 1
return 0
endfunc
func Test_iminsert2()
set imactivatefunc=IM_activatefunc
set imstatusfunc=IM_statusfunc
set iminsert=2
normal! i
set iminsert=0
set imactivatefunc=
set imstatusfunc=
let expected = has('gui_running') ? 0 : 1
call assert_equal(expected, s:imactivatefunc_called)
call assert_equal(expected, s:imstatusfunc_called)
endfunc

View File

@@ -99,6 +99,7 @@ func Test_mksession_utf8()
call delete('test_mks.out') call delete('test_mks.out')
call delete(tmpfile) call delete(tmpfile)
let &wrap = wrap_save let &wrap = wrap_save
set sessionoptions& splitbelow& fileencoding&
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@@ -707,6 +707,10 @@ func Test_balloon_split()
if !exists('*balloon_split') if !exists('*balloon_split')
return return
endif endif
call assert_equal([
\ 'tempname: 0x555555e380a0 "/home/mool/.viminfz.tmp"',
\ ], balloon_split(
\ 'tempname: 0x555555e380a0 "/home/mool/.viminfz.tmp"'))
call assert_equal([ call assert_equal([
\ 'one two three four one two three four one two thre', \ 'one two three four one two three four one two thre',
\ 'e four', \ 'e four',

View File

@@ -100,3 +100,11 @@ func Test_writefile_sync_arg()
call writefile(['two'], 'Xtest', 'S') call writefile(['two'], 'Xtest', 'S')
call delete('Xtest') call delete('Xtest')
endfunc endfunc
func Test_writefile_sync_dev_stdout()
if !has('unix')
return
endif
" Just check that this doesn't cause an error.
call writefile(['one'], '/dev/stdout')
endfunc

View File

@@ -3307,7 +3307,7 @@ ui_focus_change(
} }
#endif #endif
#if defined(USE_IM_CONTROL) || defined(PROTO) #if defined(FEAT_MBYTE) || defined(PROTO)
/* /*
* Save current Input Method status to specified place. * Save current Input Method status to specified place.
*/ */

View File

@@ -771,6 +771,44 @@ 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 */
/**/
1349,
/**/
1348,
/**/
1347,
/**/
1346,
/**/
1345,
/**/
1344,
/**/
1343,
/**/
1342,
/**/
1341,
/**/
1340,
/**/
1339,
/**/
1338,
/**/
1337,
/**/
1336,
/**/
1335,
/**/
1334,
/**/
1333,
/**/
1332,
/**/
1331,
/**/ /**/
1330, 1330,
/**/ /**/

View File

@@ -533,15 +533,6 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */
# endif # endif
#endif #endif
/*
* Check input method control.
*/
#if defined(FEAT_XIM) \
|| (defined(FEAT_GUI) && (defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \
|| (defined(FEAT_GUI_MAC) && defined(FEAT_MBYTE))
# define USE_IM_CONTROL
#endif
/* /*
* For dynamically loaded gettext library. Currently, only for Win32. * For dynamically loaded gettext library. Currently, only for Win32.
*/ */
@@ -1485,6 +1476,11 @@ typedef UINT32_TYPEDEF UINT32_T;
#define MIN_COLUMNS 12 /* minimal columns for screen */ #define MIN_COLUMNS 12 /* minimal columns for screen */
#define MIN_LINES 2 /* minimal lines for screen */ #define MIN_LINES 2 /* minimal lines for screen */
#define STATUS_HEIGHT 1 /* height of a status line under a window */ #define STATUS_HEIGHT 1 /* height of a status line under a window */
#ifdef FEAT_MENU /* height of a status line under a window */
# define WINBAR_HEIGHT(wp) (wp)->w_winbar_height
#else
# define WINBAR_HEIGHT(wp) 0
#endif
#define QF_WINHEIGHT 10 /* default height for quickfix window */ #define QF_WINHEIGHT 10 /* default height for quickfix window */
/* /*

View File

@@ -1081,8 +1081,7 @@ win_split_ins(
/* Set w_fraction now so that the cursor keeps the same relative /* Set w_fraction now so that the cursor keeps the same relative
* vertical position. */ * vertical position. */
if (oldwin->w_height > 0) set_fraction(oldwin);
set_fraction(oldwin);
wp->w_fraction = oldwin->w_fraction; wp->w_fraction = oldwin->w_fraction;
if (flags & WSP_VERT) if (flags & WSP_VERT)
@@ -1099,21 +1098,14 @@ win_split_ins(
/* set height and row of new window to full height */ /* set height and row of new window to full height */
wp->w_winrow = tabline_height(); wp->w_winrow = tabline_height();
win_new_height(wp, curfrp->fr_height - (p_ls > 0) win_new_height(wp, curfrp->fr_height - (p_ls > 0)
#ifdef FEAT_MENU - WINBAR_HEIGHT(wp));
- wp->w_winbar_height
#endif
);
wp->w_status_height = (p_ls > 0); wp->w_status_height = (p_ls > 0);
} }
else else
{ {
/* height and row of new window is same as current window */ /* height and row of new window is same as current window */
wp->w_winrow = oldwin->w_winrow; wp->w_winrow = oldwin->w_winrow;
win_new_height(wp, oldwin->w_height win_new_height(wp, oldwin->w_height + WINBAR_HEIGHT(oldwin));
#ifdef FEAT_MENU
+ oldwin->w_winbar_height
#endif
);
wp->w_status_height = oldwin->w_status_height; wp->w_status_height = oldwin->w_status_height;
} }
frp->fr_height = curfrp->fr_height; frp->fr_height = curfrp->fr_height;
@@ -1172,10 +1164,7 @@ win_split_ins(
if (flags & (WSP_TOP | WSP_BOT)) if (flags & (WSP_TOP | WSP_BOT))
{ {
int new_fr_height = curfrp->fr_height - new_size int new_fr_height = curfrp->fr_height - new_size
#ifdef FEAT_MENU + WINBAR_HEIGHT(wp) ;
+ wp->w_winbar_height
#endif
;
if (!((flags & WSP_BOT) && p_ls == 0)) if (!((flags & WSP_BOT) && p_ls == 0))
new_fr_height -= STATUS_HEIGHT; new_fr_height -= STATUS_HEIGHT;
@@ -1191,7 +1180,8 @@ win_split_ins(
} }
else /* new window below current one */ else /* new window below current one */
{ {
wp->w_winrow = oldwin->w_winrow + oldwin->w_height + STATUS_HEIGHT; wp->w_winrow = oldwin->w_winrow + oldwin->w_height
+ STATUS_HEIGHT + WINBAR_HEIGHT(oldwin);
wp->w_status_height = oldwin->w_status_height; wp->w_status_height = oldwin->w_status_height;
if (!(flags & WSP_BOT)) if (!(flags & WSP_BOT))
oldwin->w_status_height = STATUS_HEIGHT; oldwin->w_status_height = STATUS_HEIGHT;
@@ -2868,10 +2858,7 @@ frame_new_height(
/* Simple case: just one window. */ /* Simple case: just one window. */
win_new_height(topfrp->fr_win, win_new_height(topfrp->fr_win,
height - topfrp->fr_win->w_status_height height - topfrp->fr_win->w_status_height
#ifdef FEAT_MENU - WINBAR_HEIGHT(topfrp->fr_win));
- topfrp->fr_win->w_winbar_height
#endif
);
} }
else if (topfrp->fr_layout == FR_ROW) else if (topfrp->fr_layout == FR_ROW)
{ {
@@ -3218,10 +3205,7 @@ frame_fix_width(win_T *wp)
frame_fix_height(win_T *wp) frame_fix_height(win_T *wp)
{ {
wp->w_frame->fr_height = wp->w_height + wp->w_status_height wp->w_frame->fr_height = wp->w_height + wp->w_status_height
#ifdef FEAT_MENU + WINBAR_HEIGHT(wp) ;
+ wp->w_winbar_height
#endif
;
} }
/* /*
@@ -5682,11 +5666,13 @@ win_drag_vsep_line(win_T *dragwin, int offset)
/* /*
* Set wp->w_fraction for the current w_wrow and w_height. * Set wp->w_fraction for the current w_wrow and w_height.
* Has no effect when the window is less than two lines.
*/ */
void void
set_fraction(win_T *wp) set_fraction(win_T *wp)
{ {
wp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT if (wp->w_height > 1)
wp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT
+ wp->w_height / 2) / (long)wp->w_height; + wp->w_height / 2) / (long)wp->w_height;
} }