Compare commits

...

26 Commits

Author SHA1 Message Date
Bram Moolenaar
7e2ec008f5 patch 7.4.855
Problem:    GTK: font glitches for combining characters
Solution:   Use pango_shape_full() instead of pango_shape(). (luchr, PR #393)
2015-09-08 16:31:06 +02:00
Bram Moolenaar
b58988b832 patch 7.4.854
Problem:    Missing information about runtime files.
Solution:   Add section about runtime files. (Christian Brabandt)
2015-09-01 21:25:44 +02:00
Bram Moolenaar
cf619daa8e patch 7.4.853
Problem:    "zt" in diff mode does not always work properly. (Gary Johnson)
Solution:   Don't count filler lines twice. (Christian Brabandt)
2015-09-01 20:53:24 +02:00
Bram Moolenaar
ac360bf2ca patch 7.4.852
Problem:    On MS-Windows console Vim uses ANSI APIs for keyboard input and
            console output, it cannot input/output Unicode characters.
Solution:   Use Unicode APIs for console I/O. (Ken Takata, Yasuhiro Matsumoto)
2015-09-01 20:31:20 +02:00
Bram Moolenaar
615942452e patch 7.4.851
Problem:    Saving and restoring the console buffer does not work properly.
Solution:   Instead of ReadConsoleOutputA/WriteConsoleOutputA use
            CreateConsoleScreenBuffer and SetConsoleActiveScreenBuffer.
            (Ken Takata)
2015-09-01 20:23:37 +02:00
Bram Moolenaar
544780248b patch 7.4.850
Problem:    <Esc> does not show up.
Solution:   Use &gt; and &lt;. (Kazunobu Kuriyama)
2015-09-01 19:50:09 +02:00
Bram Moolenaar
8b5f65a527 patch 7.4.849
Problem:    Moving the cursor in Insert mode starts new undo sequence.
Solution:   Add CTRL-G U to keep the undo sequence for the following cursor
            movement command. (Christian Brabandt)
2015-09-01 19:26:12 +02:00
Bram Moolenaar
5adfea1ac6 patch 7.4.848
Problem:    CTRL-A on hex number in Visual block mode is incorrect.
Solution:   Account for the "0x". (Hirohito Higashi)
2015-09-01 18:51:39 +02:00
Bram Moolenaar
8667d66ca9 patch 7.4.847
Problem:    "vi)d" may leave a character behind.
Solution:   Skip over multi-byte character. (Christian Brabandt)
2015-09-01 18:27:49 +02:00
Bram Moolenaar
6017f3799d patch 7.4.846
Problem:    Some GitHub users don't know how to use issues.
Solution:   Add a file that explains the basics of contributing.
2015-09-01 17:50:48 +02:00
Bram Moolenaar
5df1ed2de3 patch 7.4.845
Problem:    Compiler warning for possible loss of data.
Solution:   Add a type cast. (Erich Ritz)
2015-09-01 16:25:34 +02:00
Bram Moolenaar
37a8de17d4 patch 7.4.844
Problem:    When '#' is in 'isident' the is# comparator doesn't work.
Solution:   Don't use vim_isIDc(). (Yasuhiro Matsumoto)
2015-09-01 16:05:00 +02:00
Bram Moolenaar
d43f0951bc patch 7.4.843
Problem:    Still possible to go beyond the end of a string.
Solution:   Check for NUL also in second string. (Dominique Pelle)
2015-08-27 22:30:47 +02:00
Bram Moolenaar
cdf0442d00 patch 7.4.842
Problem:    Sending too many messages to close the balloon.
Solution:   Only send a WM_CLOSE message. (Jurgen Kramer)
2015-08-27 22:25:10 +02:00
Bram Moolenaar
5ea87a0496 patch 7.4.841
Problem:    Can't compile without the multi-byte feature. (John Marriott)
Solution:   Add more #ifdef's.
2015-08-26 23:24:09 +02:00
Bram Moolenaar
8e5f5b47c2 patch 7.4.840
Problem:    Tooltip window stays open.
Solution:   Send a WM_CLOSE message. (Jurgen Kramer)
2015-08-26 23:12:38 +02:00
Bram Moolenaar
6ed535dbc0 patch 7.4.839
Problem:    Compiler warning on 64-bit system.
Solution:   Add cast to int. (Mike Williams)
2015-08-26 23:01:21 +02:00
Bram Moolenaar
8060687905 patch 7.4.838
Problem:    Can't compile without the crypt feature. (John Marriott)
Solution:   Add #ifdef.
2015-08-25 21:27:35 +02:00
Bram Moolenaar
88774fdd23 Updated runtime files and Italian messages. 2015-08-25 19:52:04 +02:00
Bram Moolenaar
80ce282107 patch 7.4.837
Problem:    Compiler warning with MSVC compiler when using +sniff.
Solution:   Use Sleep() instead of _sleep(). (Tux)
2015-08-25 19:49:50 +02:00
Bram Moolenaar
0a38dd29d6 patch 7.4.836
Problem:    Accessing unitinialized memory.
Solution:   Add missing calls to init_tv(). (Dominique Pelle)
2015-08-25 16:49:01 +02:00
Bram Moolenaar
f6470c288c patch 7.4.835
Problem:    Comparing utf-8 sequences does not handle different byte sizes
            correctly.
Solution:   Get the byte size of each character. (Dominique Pelle)
2015-08-25 16:31:40 +02:00
Bram Moolenaar
7e47d1ac6a patch 7.4.834
Problem:    gettabvar() doesn't work after Vim start. (Szymon Wrozynski)
Solution:   Handle first window in tab still being NULL. (Christian Brabandt)
2015-08-25 16:19:05 +02:00
Bram Moolenaar
e68c25c677 patch 7.4.833
Problem:    More side effects of ":set all&" are missing. (Björn Linse)
Solution:   Call didset_options() and add didset_options2() to collect more
            side effects to take care of.  Still not everything...
2015-08-25 15:39:55 +02:00
Bram Moolenaar
be83b73ddb patch 7.4.832
Problem:    $HOME in  is expanded too early.
Solution:   Skip over  when expanding environment names.
2015-08-25 14:21:19 +02:00
Bram Moolenaar
3f188935ec patch 7.4.831
Problem:    When expanding  on the command line and encountering an
            error, the command is executed anyway.
Solution:   Bail out when an error is detected.
2015-08-25 13:57:04 +02:00
38 changed files with 1050 additions and 594 deletions

54
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,54 @@
# Contributing to Vim
Patches are welcome in whatever form.
Discussions about patches happen on the vim-dev maillist.
If you create a pull request on GitHub it will be
forwarded to the vim-dev maillist. You can also send your patch there
directly. An attachment with a unified diff format is preferred.
Information about the maillist can be found [on the Vim website].
[on the Vim website]: http://www.vim.org/maillist.php#vim-dev
Please consider adding a test. Test coverage isn't very good yet, this needs
to improve. Look through recent patches for examples. The tests are located
under "src/testdir".
# Reporting issues
We use GitHub issues, but that is not a requirement. Writing to the Vim
maillist is also fine.
Please use the GitHub issues only for actual issues. If you are not 100% sure
that your problem is a Vim issue, please first discuss this on the Vim user
maillist. Try reproducing the problem without any plugins or settings:
vim -N -u NONE
If you report an issue, please describe exactly how to reproduce it.
For example, don't say "insert some text" but say what you did exactly:
"ahere is some text&lt;Esc&gt;".
Ideally, the steps you list can be used to write a test to verify the problem
is fixed.
Feel free to report even the smallest problem, also typos in the documentation.
You can find known issues in the todo file: ":help todo".
Or open [the todo file] on GitHub to see the latest version.
[the todo file]: https://github.com/vim/vim/blob/master/runtime/doc/todo.txt
# Syntax, indent and other runtime files
The latest version of these files can be obtained from the repository.
They are usually not updated with numbered patches.
If you find a problem with one of these files or have a suggestion for
improvement, please first try to contact the maintainer directly.
Look in the header of the file for the name and email address.
The maintainer will take care of issues and send updates to Bram for
distribution with Vim.
If the maintainer does not react, contact the vim-dev maillist.

View File

@@ -482,6 +482,7 @@ SRC_EXTRA = \
RT_ALL = \
README.txt \
README.md \
CONTRIBUTING.md \
runtime/bugreport.vim \
runtime/doc/*.awk \
runtime/doc/*.pl \

View File

@@ -1,4 +1,4 @@
*autocmd.txt* For Vim version 7.4. Last change: 2015 Aug 05
*autocmd.txt* For Vim version 7.4. Last change: 2015 Aug 18
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1072,7 +1072,7 @@ Instead of a pattern buffer-local autocommands use one of these forms:
Examples: >
:au CursorHold <buffer> echo 'hold'
:au CursorHold <buffer=33> echo 'hold'
:au BufNewFile * CursorHold <buffer=abuf> echo 'hold'
:au BufNewFile * au CursorHold <buffer=abuf> echo 'hold'
All the commands for autocommands also work with buffer-local autocommands,
simply use the special string instead of the pattern. Examples: >

View File

@@ -1,4 +1,4 @@
*editing.txt* For Vim version 7.4. Last change: 2015 Jul 28
*editing.txt* For Vim version 7.4. Last change: 2015 Aug 25
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -415,6 +415,7 @@ Finds files:
On Unix and a few other systems you can also use backticks for the file name
argument, for example: >
:next `find . -name ver\\*.c -print`
:view `ls -t *.patch \| head -n1`
The backslashes before the star are required to prevent the shell from
expanding "ver*.c" prior to execution of the find program. The backslash
before the shell pipe symbol "|" prevents Vim from parsing it as command
@@ -432,13 +433,11 @@ The expression can contain just about anything, thus this can also be used to
avoid the special meaning of '"', '|', '%' and '#'. However, 'wildignore'
does apply like to other wildcards.
Environment variables are expanded before evaluating the expression, thus this
does not work: >
:e `=$HOME . '.vimrc'`
Because $HOME is expanding early, resulting in: >
:e `=/home/user . '.vimrc'`
This does work: >
:e `=expand('$HOME') . '.vimrc'`
Environment variables in the expression are expanded when evaluating the
expression, thus this works: >
:e `=$HOME . '/.vimrc'`
This does not work, $HOME is inside a string and used literally: >
:e `='$HOME' . '/.vimrc'`
If the expression returns a string then names are to be separated with line
breaks. When the result is a |List| then each item is used as a name. Line
@@ -1407,7 +1406,7 @@ reveal it to others. The 'viminfo' file is not encrypted.
You could do this to edit very secret text: >
:set noundofile viminfo=
:noswapfile edit secrets.txt
Keep in mind that without a swap file you risk loosing your work in the event
Keep in mind that without a swap file you risk losing your work in the event
of a crash or a power failure.
WARNING: If you make a typo when entering the key and then write the file and

View File

@@ -377,6 +377,9 @@ CTRL-O execute one command, return to Insert mode *i_CTRL-O*
CTRL-\ CTRL-O like CTRL-O but don't move the cursor *i_CTRL-\_CTRL-O*
CTRL-L when 'insertmode' is set: go to Normal mode *i_CTRL-L*
CTRL-G u break undo sequence, start new change *i_CTRL-G_u*
CTRL-G U don't break undo with next left/right cursor *i_CTRL-G_U*
movement (but only if the cursor stays
within same the line)
-----------------------------------------------------------------------
Note: If the cursor keys take you out of Insert mode, check the 'noesckeys'
@@ -416,6 +419,28 @@ that, with CTRL-O u. Another example: >
This breaks undo at each line break. It also expands abbreviations before
this.
An example for using CTRL-G U: >
inoremap <Left> <C-G>U<Left>
inoremap <Right> <C-G>U<Right>
inoremap <expr> <Home> col('.') == match(getline('.'), '\S') + 1 ?
\ repeat('<C-G>U<Left>', col('.') - 1) :
\ (col('.') < match(getline('.'), '\S') ?
\ repeat('<C-G>U<Right>', match(getline('.'), '\S') + 0) :
\ repeat('<C-G>U<Left>', col('.') - 1 - match(getline('.'), '\S')))
inoremap <expr> <End> repeat('<C-G>U<Right>', col('$') - col('.'))
inoremap ( ()<C-G>U<Left>
This makes it possible to use the cursor keys in Insert mode, without breaking
the undo sequence and therefore using |.| (redo) will work as expected.
Also entering a text like (with the "(" mapping from above): >
Lorem ipsum (dolor
will be repeatable by the |.|to the expected
Lorem ipsum (dolor)
Using CTRL-O splits undo: the text typed before and after it is undone
separately. If you want to avoid this (e.g., in a mapping) you might be able
to use CTRL-R = |i_CTRL-R|. E.g., to call a function: >

View File

@@ -1,4 +1,4 @@
*options.txt* For Vim version 7.4. Last change: 2015 Jul 17
*options.txt* For Vim version 7.4. Last change: 2015 Aug 25
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -50,9 +50,19 @@ achieve special effects. These options come in three forms:
:se[t] {option}&vi Reset option to its Vi default value. {not in Vi}
:se[t] {option}&vim Reset option to its Vim default value. {not in Vi}
:se[t] all& Set all options, except terminal options, to their
default value. The values of 'term', 'lines' and
'columns' are not changed. {not in Vi}
:se[t] all& Set all options to their default value. The values of
these options are not changed:
all terminal options, starting with t_
'columns'
'cryptmethod'
'encoding'
'key'
'lines'
'term'
'ttymouse'
'ttytype'
Warning: This may have a lot of side effects.
{not in Vi}
*:set-args* *E487* *E521*
:se[t] {option}={value} or
@@ -7386,14 +7396,12 @@ A jump table for the options with a short description can be found at |Q_op|.
the GUI it only applies to the keyboard ( 'encoding' is used for the
display). Except for the Mac when 'macatsui' is off, then
'termencoding' should be "macroman".
In the Win32 console version the default value is the console codepage
when it differs from the ANSI codepage.
*E617*
Note: This does not apply to the GTK+ 2 GUI. After the GUI has been
successfully initialized, 'termencoding' is forcibly set to "utf-8".
Any attempts to set a different value will be rejected, and an error
message is shown.
For the Win32 GUI 'termencoding' is not used for typed characters,
For the Win32 GUI and console versions 'termencoding' is not used,
because the Win32 system always passes Unicode characters.
When empty, the same encoding is used as for the 'encoding' option.
This is the normal value.

View File

@@ -1,4 +1,4 @@
*syntax.txt* For Vim version 7.4. Last change: 2015 Jul 21
*syntax.txt* For Vim version 7.4. Last change: 2015 Aug 13
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3445,7 +3445,7 @@ DEFINING KEYWORDS *:syn-keyword*
:syntax keyword Type contained int long char
:syntax keyword Type int long contained char
:syntax keyword Type int long char contained
< *E789*
< *E789* *E890*
When you have a keyword with an optional tail, like Ex commands in
Vim, you can put the optional characters inside [], to define all the
variations at once: >

View File

@@ -4353,6 +4353,7 @@ E887 if_pyth.txt /*E887*
E888 pattern.txt /*E888*
E889 map.txt /*E889*
E89 message.txt /*E89*
E890 syntax.txt /*E890*
E90 message.txt /*E90*
E91 options.txt /*E91*
E92 message.txt /*E92*

View File

@@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.4. Last change: 2015 Aug 11
*todo.txt* For Vim version 7.4. Last change: 2015 Aug 25
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -35,6 +35,9 @@ not be repeated below, unless there is extra information.
-------------------- Known bugs and current work -----------------------
Regexp problems:
- The regexp engines are not reentrant, causing havoc when interrupted by a
remote expression or something else. Move global variables onto the stack
or into an allocated struct.
- The old engine does not find a match for "/\%#=1\(\)\{80}", the new engine
matches everywhere.
- Using win_linetabsize() can still be slow. Cache the result, store col and
@@ -88,14 +91,13 @@ Perhaps we can use ":silent window"?
Illegal memory access, requires ASAN to see. (Dominique Pelle, 2015 Jul 28)
Patch for better documentaiton of cmdline expansion. (Pavol Juhas, 2015 Jul
24)
Crash when changing the 'tags' option from a remote command.
(Benjamin Fritz, 2015 Mar 18, stack trace Mar 20)
Gvim: when both Tab and CTRL-I are mapped, use CTRL-I not for Tab.
Updated Breton spell script. (pull request 396, Dominique)
Can src/GvimExt/Make_cyg.mak be removed?
Same for src/xxd/Make_cyg.mak
@@ -115,6 +117,8 @@ inconsistent with the documentation.
Better greek spell checking. Issue 299.
Add bzl filetype support. (David Barnett, 2015 Aug 11)
When complete() first argument is before where insert started and 'backspace'
is Vi compatible, the completion fails. (Hirohito Higashi, 2015 Feb 19)
@@ -136,16 +140,25 @@ Patch to support Unicode I/O in the MS-Windows console.
The argument for "-S" is not taken literally, the ":so" command expands
wildcards. Add a ":nowild" command modifier? (ZyX, 2015 March 4)
":set all&" still does not handle all side effects. Centralize handling side
effects for when set by the user, on init and when reset to default.
Proposal to make options.txt easier to read. (Arnaud Decara, 2015 Aug 5)
Update Aug 14.
Build with Python on Mac does not always use the right library.
(Kazunobu Kuriyama, 2015 Mar 28)
Example in editing.txt uses $HOME with the expectating that it ends in a
slash. For me it does, but perhaps not for everybody. Add a function that
inserts a slash when needed? pathconcat(dir, path) (Thilo Six, 2015 Aug 12)
ml_updatechunk() is slow when retrying for another encoding. (John Little,
2014 Sep 11)
Patch to fix that "zt" in diff mode doesn't always work properly.
(Christian Brabandt, 2015 Aug 6) Doesn't fix the problem?
(Christian Brabandt, 2015 Aug 6) Need to uncomment a line to not have filler
lines.
Patch to fix checking global option value when not using it.
(Arnaud Decara, 2015 Jul 23)
@@ -167,6 +180,9 @@ Work in progress.
Patch for global-local options consistency. (Arnaud Decara, 2015 Jul 22)
Is this right?
Patch to have CTRL-A and CTRL-X update the '[ and '] marks.
(Yukihiro Nakadaira, 2015 Aug 23)
Patch to make getregtype() return the right size for non-linux systems.
(Yasuhiro Matsumoto, 2014 Jul 8)
Breaks test_eval. Inefficient, can we only compute y_width when needed?
@@ -222,6 +238,11 @@ Adding "~" to 'cdpath' doesn't work for completion? (Davido, 2013 Aug 19)
Should be easy to highlight all matches with 'incsearch'. Idea by Itchyny,
2015 Feb 6.
Patch to add ":ldo" and ":cdo", execute commands over quickfix list and
location list. (Yegappan Lakshmanan, 2013 Jun 2, update 2015 Mar 21)
Update by Florian Walch, 2015 Jul 1.
Update by Yegappan, 2015 Jul 24.
Plugins need to make a lot of effort, lots of mappings, to know what happened
before pressing the key that triggers a plugin action. How about keeping the
last N pressed keys, so that they do not need to be mapped?
@@ -625,11 +646,6 @@ Win32: When 'autochdir' is on and 'encoding' is changed, files on the command
line are opened again, but from the wrong directory. Apply 'autochdir' only
after starting up?
Patch to add ":ldo" and ":cdo", execute commands over quickfix list and
location list. (Yegappan Lakshmanan, 2013 Jun 2, update 2015 Mar 21)
Update by Florian Walch, 2015 Jul 1.
Update by Yegappan, 2015 Jul 24.
8 "stl" and "stlnc" in 'fillchars' don't work for multi-byte characters.
Patch by Christian Wellenbrock, 2013 Jul 5.

View File

@@ -1909,6 +1909,8 @@ vim_str2nr(start, hexp, len, dooct, dohex, nptr, unptr, maxlen)
else if (hex != 0 || dohex > 1)
{
/* hex */
if (hex != 0)
n += 2; /* skip over "0x" */
while (vim_isxdigit(*ptr))
{
un = 16 * un + (unsigned long)hex2nr(*ptr);

View File

@@ -202,6 +202,8 @@ static void internal_format __ARGS((int textwidth, int second_indent, int flags,
static void check_auto_format __ARGS((int));
static void redo_literal __ARGS((int c));
static void start_arrow __ARGS((pos_T *end_insert_pos));
static void start_arrow_with_change __ARGS((pos_T *end_insert_pos, int change));
static void start_arrow_common __ARGS((pos_T *end_insert_pos, int change));
#ifdef FEAT_SPELL
static void check_spell_redraw __ARGS((void));
static void spell_back_to_badword __ARGS((void));
@@ -241,11 +243,11 @@ static void ins_mousescroll __ARGS((int dir));
#if defined(FEAT_GUI_TABLINE) || defined(PROTO)
static void ins_tabline __ARGS((int c));
#endif
static void ins_left __ARGS((void));
static void ins_left __ARGS((int end_change));
static void ins_home __ARGS((int c));
static void ins_end __ARGS((int c));
static void ins_s_left __ARGS((void));
static void ins_right __ARGS((void));
static void ins_right __ARGS((int end_change));
static void ins_s_right __ARGS((void));
static void ins_up __ARGS((int startcol));
static void ins_pageup __ARGS((void));
@@ -297,6 +299,8 @@ static int ins_need_undo; /* call u_save() before inserting a
static int did_add_space = FALSE; /* auto_format() added an extra space
under the cursor */
static int dont_sync_undo = FALSE; /* CTRL-G U prevents syncing undo for
the next left/right cursor */
/*
* edit(): Start inserting text.
@@ -767,6 +771,12 @@ edit(cmdchar, startln, count)
*/
if (c != K_CURSORHOLD)
lastc = c; /* remember the previous char for CTRL-D */
/* After using CTRL-G U the next cursor key will not break undo. */
if (dont_sync_undo == MAYBE)
dont_sync_undo = TRUE;
else
dont_sync_undo = FALSE;
do
{
c = safe_vgetc();
@@ -1237,7 +1247,7 @@ doESCkey:
if (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL))
ins_s_left();
else
ins_left();
ins_left(dont_sync_undo == FALSE);
break;
case K_S_LEFT: /* <S-Left> */
@@ -1249,7 +1259,7 @@ doESCkey:
if (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL))
ins_s_right();
else
ins_right();
ins_right(dont_sync_undo == FALSE);
break;
case K_S_RIGHT: /* <S-Right> */
@@ -6787,9 +6797,34 @@ redo_literal(c)
*/
static void
start_arrow(end_insert_pos)
pos_T *end_insert_pos; /* can be NULL */
pos_T *end_insert_pos; /* can be NULL */
{
if (!arrow_used) /* something has been inserted */
start_arrow_common(end_insert_pos, TRUE);
}
/*
* Like start_arrow() but with end_change argument.
* Will prepare for redo of CTRL-G U if "end_change" is FALSE.
*/
static void
start_arrow_with_change(end_insert_pos, end_change)
pos_T *end_insert_pos; /* can be NULL */
int end_change; /* end undoable change */
{
start_arrow_common(end_insert_pos, end_change);
if (!end_change)
{
AppendCharToRedobuff(Ctrl_G);
AppendCharToRedobuff('U');
}
}
static void
start_arrow_common(end_insert_pos, end_change)
pos_T *end_insert_pos; /* can be NULL */
int end_change; /* end undoable change */
{
if (!arrow_used && end_change) /* something has been inserted */
{
AppendToRedobuff(ESC_STR);
stop_insert(end_insert_pos, FALSE, FALSE);
@@ -8359,6 +8394,13 @@ ins_ctrl_g()
Insstart = curwin->w_cursor;
break;
/* CTRL-G U: do not break undo with the next char */
case 'U':
/* Allow one left/right cursor movement with the next char,
* without breaking undo. */
dont_sync_undo = MAYBE;
break;
/* Unknown CTRL-G command, reserved for future expansion. */
default: vim_beep(BO_CTRLG);
}
@@ -9440,7 +9482,8 @@ ins_horscroll()
#endif
static void
ins_left()
ins_left(end_change)
int end_change; /* end undoable change */
{
pos_T tpos;
@@ -9457,7 +9500,11 @@ ins_left()
* break undo. K_LEFT is inserted in im_correct_cursor(). */
if (!im_is_preediting())
#endif
start_arrow(&tpos);
{
start_arrow_with_change(&tpos, end_change);
if (!end_change)
AppendCharToRedobuff(K_LEFT);
}
#ifdef FEAT_RIGHTLEFT
/* If exit reversed string, position is fixed */
if (revins_scol != -1 && (int)curwin->w_cursor.col >= revins_scol)
@@ -9472,6 +9519,7 @@ ins_left()
*/
else if (vim_strchr(p_ww, '[') != NULL && curwin->w_cursor.lnum > 1)
{
/* always break undo when moving upwards/downwards, else undo may break */
start_arrow(&tpos);
--(curwin->w_cursor.lnum);
coladvance((colnr_T)MAXCOL);
@@ -9479,6 +9527,7 @@ ins_left()
}
else
vim_beep(BO_CRSR);
dont_sync_undo = FALSE;
}
static void
@@ -9542,7 +9591,8 @@ ins_s_left()
}
static void
ins_right()
ins_right(end_change)
int end_change; /* end undoable change */
{
#ifdef FEAT_FOLDING
if ((fdo_flags & FDO_HOR) && KeyTyped)
@@ -9555,7 +9605,9 @@ ins_right()
#endif
)
{
start_arrow(&curwin->w_cursor);
start_arrow_with_change(&curwin->w_cursor, end_change);
if (!end_change)
AppendCharToRedobuff(K_RIGHT);
curwin->w_set_curswant = TRUE;
#ifdef FEAT_VIRTUALEDIT
if (virtual_active())
@@ -9589,6 +9641,7 @@ ins_right()
}
else
vim_beep(BO_CRSR);
dont_sync_undo = FALSE;
}
static void

View File

@@ -4431,7 +4431,8 @@ eval4(arg, rettv, evaluate)
{
if (p[2] == 'n' && p[3] == 'o' && p[4] == 't')
len = 5;
if (!vim_isIDc(p[len]))
i = p[len];
if (!isalnum(i) && i != '_')
{
type = len == 2 ? TYPE_EQUAL : TYPE_NEQUAL;
type_is = TRUE;
@@ -5371,6 +5372,8 @@ eval_index(arg, rettv, evaluate, verbose)
}
#endif
init_tv(&var1);
init_tv(&var2);
if (**arg == '.')
{
/*
@@ -12291,7 +12294,8 @@ f_gettabvar(argvars, rettv)
{
/* Set tp to be our tabpage, temporarily. Also set the window to the
* first window in the tabpage, otherwise the window is not valid. */
if (switch_win(&oldcurwin, &oldtabpage, tp->tp_firstwin, tp, TRUE)
if (switch_win(&oldcurwin, &oldtabpage,
tp->tp_firstwin == NULL ? firstwin : tp->tp_firstwin, tp, TRUE)
== OK)
{
/* look up the variable */

View File

@@ -5063,8 +5063,8 @@ not_ascii:
* done, because drawing the cursor would change the display. */
item->analysis.shape_engine = default_shape_engine;
pango_shape((const char *)s + item->offset, item->length,
&item->analysis, glyphs);
pango_shape_full((const char *)s + item->offset, item->length,
(const char *)s, len, &item->analysis, glyphs);
/*
* Fixed-width hack: iterate over the array and assign a fixed
* width to each glyph, thus overriding the choice made by the

View File

@@ -4836,8 +4836,7 @@ make_tooltip(beval, text, pt)
delete_tooltip(beval)
BalloonEval *beval;
{
PostMessage(beval->balloon, WM_DESTROY, 0, 0);
PostMessage(beval->balloon, WM_NCDESTROY, 0, 0);
PostMessage(beval->balloon, WM_CLOSE, 0, 0);
}
/*ARGSUSED*/

View File

@@ -655,7 +655,11 @@ sniff_disconnect(immediately)
else
{
#ifdef WIN32
# if (defined(_MSC_VER) && _MSC_VER >= 1400)
Sleep(2);
# else
_sleep(2);
# endif
if (!sniff_request_processed)
ProcessSniffRequests();
#else

View File

@@ -3969,6 +3969,26 @@ expand_env_esc(srcp, dst, dstlen, esc, one, startstr)
--dstlen; /* leave one char space for "\," */
while (*src && dstlen > 0)
{
#ifdef FEAT_EVAL
/* Skip over `=expr`. */
if (src[0] == '`' && src[1] == '=')
{
size_t len;
var = src;
src += 2;
(void)skip_expr(&src);
if (*src == '`')
++src;
len = src - var;
if (len > (size_t)dstlen)
len = dstlen;
vim_strncpy(dst, var, len);
dst += len;
dstlen -= (int)len;
continue;
}
#endif
copy_char = TRUE;
if ((*src == '$'
#ifdef VMS
@@ -10875,6 +10895,7 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags)
char_u *p;
static int recursive = FALSE;
int add_pat;
int retval = OK;
#if defined(FEAT_SEARCHPATH)
int did_expand_in_path = FALSE;
#endif
@@ -10924,7 +10945,11 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags)
#ifdef VIM_BACKTICK
if (vim_backtick(p))
{
add_pat = expand_backtick(&ga, p, flags);
if (add_pat == -1)
retval = FAIL;
}
else
#endif
{
@@ -11013,7 +11038,7 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags)
recursive = FALSE;
return (ga.ga_data != NULL) ? OK : FAIL;
return (ga.ga_data != NULL) ? retval : FAIL;
}
# ifdef VIM_BACKTICK
@@ -11031,7 +11056,7 @@ vim_backtick(p)
/*
* Expand an item in `backticks` by executing it as a command.
* Currently only works when pat[] starts and ends with a `.
* Returns number of file names found.
* Returns number of file names found, -1 if an error is encountered.
*/
static int
expand_backtick(gap, pat, flags)
@@ -11048,7 +11073,7 @@ expand_backtick(gap, pat, flags)
/* Create the command: lop off the backticks. */
cmd = vim_strnsave(pat + 1, (int)STRLEN(pat) - 2);
if (cmd == NULL)
return 0;
return -1;
#ifdef FEAT_EVAL
if (*cmd == '=') /* `={expr}`: Expand expression */
@@ -11059,7 +11084,7 @@ expand_backtick(gap, pat, flags)
(flags & EW_SILENT) ? SHELL_SILENT : 0, NULL);
vim_free(cmd);
if (buffer == NULL)
return 0;
return -1;
cmd = buffer;
while (*cmd != NUL)

View File

@@ -5058,7 +5058,9 @@ ff_wc_equal(s1, s2)
char_u *s1;
char_u *s2;
{
int i;
int i, j;
int c1 = NUL;
int c2 = NUL;
int prev1 = NUL;
int prev2 = NUL;
@@ -5068,21 +5070,21 @@ ff_wc_equal(s1, s2)
if (s1 == NULL || s2 == NULL)
return FALSE;
if (STRLEN(s1) != STRLEN(s2))
return FAIL;
for (i = 0; s1[i] != NUL && s2[i] != NUL; i += MB_PTR2LEN(s1 + i))
for (i = 0, j = 0; s1[i] != NUL && s2[j] != NUL;)
{
int c1 = PTR2CHAR(s1 + i);
int c2 = PTR2CHAR(s2 + i);
c1 = PTR2CHAR(s1 + i);
c2 = PTR2CHAR(s2 + j);
if ((p_fic ? MB_TOLOWER(c1) != MB_TOLOWER(c2) : c1 != c2)
&& (prev1 != '*' || prev2 != '*'))
return FAIL;
return FALSE;
prev2 = prev1;
prev1 = c1;
i += MB_PTR2LEN(s1 + i);
j += MB_PTR2LEN(s2 + j);
}
return TRUE;
return c1 == c2;
}
#endif
@@ -5814,14 +5816,14 @@ pathcmp(p, q, maxlen)
const char *p, *q;
int maxlen;
{
int i;
int i, j;
int c1, c2;
const char *s = NULL;
for (i = 0; maxlen < 0 || i < maxlen; i += MB_PTR2LEN((char_u *)p + i))
for (i = 0, j = 0; maxlen < 0 || (i < maxlen && j < maxlen);)
{
c1 = PTR2CHAR((char_u *)p + i);
c2 = PTR2CHAR((char_u *)q + i);
c2 = PTR2CHAR((char_u *)q + j);
/* End of "p": check if "q" also ends or just has a slash. */
if (c1 == NUL)
@@ -5829,6 +5831,7 @@ pathcmp(p, q, maxlen)
if (c2 == NUL) /* full match */
return 0;
s = q;
i = j;
break;
}
@@ -5854,8 +5857,11 @@ pathcmp(p, q, maxlen)
return p_fic ? MB_TOUPPER(c1) - MB_TOUPPER(c2)
: c1 - c2; /* no match */
}
i += MB_PTR2LEN((char_u *)p + i);
j += MB_PTR2LEN((char_u *)q + j);
}
if (s == NULL) /* "i" ran into "maxlen" */
if (s == NULL) /* "i" or "j" ran into "maxlen" */
return 0;
c1 = PTR2CHAR((char_u *)s + i);

View File

@@ -1732,7 +1732,7 @@ scroll_cursor_top(min_scroll, always)
* - at least 'scrolloff' lines above and below the cursor
*/
validate_cheight();
used = curwin->w_cline_height;
used = curwin->w_cline_height; /* includes filler lines above */
if (curwin->w_cursor.lnum < curwin->w_topline)
scrolled = used;
@@ -1751,10 +1751,12 @@ scroll_cursor_top(min_scroll, always)
new_topline = top + 1;
#ifdef FEAT_DIFF
/* count filler lines of the cursor window as context */
i = diff_check_fill(curwin, curwin->w_cursor.lnum);
used += i;
extra += i;
/* used already contains the number of filler lines above, don't add it
* again.
* TODO: if filler lines above new top are to be considered as context for
* the current window, leave next statement commented, else hide filler
* lines above cursor line, by adding them to extra */
/* extra += diff_check_fill(curwin, curwin->w_cursor.lnum); */
#endif
/*

View File

@@ -3079,6 +3079,7 @@ static void did_set_title __ARGS((int icon));
#endif
static char_u *option_expand __ARGS((int opt_idx, char_u *val));
static void didset_options __ARGS((void));
static void didset_options2 __ARGS((void));
static void check_string_option __ARGS((char_u **pp));
#if defined(FEAT_EVAL) || defined(PROTO)
static long_u *insecure_flag __ARGS((int opt_idx, int opt_flags));
@@ -3096,6 +3097,7 @@ static int int_cmp __ARGS((const void *a, const void *b));
static char_u *check_clipboard_option __ARGS((void));
#endif
#ifdef FEAT_SPELL
static char_u *did_set_spell_option __ARGS((int is_spellfile));
static char_u *compile_cap_prog __ARGS((synblock_T *synblock));
#endif
#ifdef FEAT_EVAL
@@ -3376,17 +3378,11 @@ set_init_1()
didset_options();
#ifdef FEAT_SPELL
/* Use the current chartab for the generic chartab. */
/* Use the current chartab for the generic chartab. This is not in
* didset_options() because it only depends on 'encoding'. */
init_spell_chartab();
#endif
#ifdef FEAT_LINEBREAK
/*
* initialize the table for 'breakat'.
*/
fill_breakat_flags();
#endif
/*
* Expand environment variables and things like "~" for the defaults.
* If option_expand() returns non-NULL the variable is expanded. This can
@@ -3418,14 +3414,8 @@ set_init_1()
}
}
/* Initialize the highlight_attr[] table. */
highlight_changed();
save_file_ff(curbuf); /* Buffer is unchanged */
/* Parse default for 'wildmode' */
check_opt_wim();
#if defined(FEAT_ARABIC)
/* Detect use of mlterm.
* Mlterm is a terminal emulator akin to xterm that has some special
@@ -3437,15 +3427,7 @@ set_init_1()
set_option_value((char_u *)"tbidi", 1L, NULL, 0);
#endif
#if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
/* Parse default for 'fillchars'. */
(void)set_chars_option(&p_fcs);
#endif
#ifdef FEAT_CLIPBOARD
/* Parse default for 'clipboard' */
(void)check_clipboard_option();
#endif
didset_options2();
#ifdef FEAT_MBYTE
# if defined(WIN3264) && defined(FEAT_GETTEXT)
@@ -3670,7 +3652,19 @@ set_options_default(opt_flags)
for (i = 0; !istermoption(&options[i]); i++)
if (!(options[i].flags & P_NODEFAULT)
&& (opt_flags == 0 || options[i].var != (char_u *)&p_enc))
#if defined(FEAT_MBYTE) || defined(FEAT_CRYPT)
&& (opt_flags == 0
|| (TRUE
# if defined(FEAT_MBYTE)
&& options[i].var != (char_u *)&p_enc
# endif
# if defined(FEAT_CRYPT)
&& options[i].var != (char_u *)&p_cm
&& options[i].var != (char_u *)&p_key
# endif
))
#endif
)
set_option_default(i, opt_flags, p_cp);
#ifdef FEAT_WINDOWS
@@ -4206,6 +4200,8 @@ do_set(arg, opt_flags)
++arg;
/* Only for :set command set global value of local options. */
set_options_default(OPT_FREE | opt_flags);
didset_options();
didset_options2();
redraw_all_later(CLEAR);
}
else
@@ -5348,6 +5344,7 @@ didset_options()
(void)spell_check_msm();
(void)spell_check_sps();
(void)compile_cap_prog(curwin->w_s);
(void)did_set_spell_option(TRUE);
#endif
#if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
(void)opt_strings_flags(p_toolbar, p_toolbar_values, &toolbar_flags, TRUE);
@@ -5362,6 +5359,35 @@ didset_options()
#ifdef FEAT_LINEBREAK
briopt_check(curwin);
#endif
#ifdef FEAT_LINEBREAK
/* initialize the table for 'breakat'. */
fill_breakat_flags();
#endif
}
/*
* More side effects of setting options.
*/
static void
didset_options2()
{
/* Initialize the highlight_attr[] table. */
(void)highlight_changed();
/* Parse default for 'wildmode' */
check_opt_wim();
(void)set_chars_option(&p_lcs);
#if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING)
/* Parse default for 'fillchars'. */
(void)set_chars_option(&p_fcs);
#endif
#ifdef FEAT_CLIPBOARD
/* Parse default for 'clipboard' */
(void)check_clipboard_option();
#endif
}
/*
@@ -6794,28 +6820,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
else if (varp == &(curwin->w_s->b_p_spl)
|| varp == &(curwin->w_s->b_p_spf))
{
win_T *wp;
int l;
if (varp == &(curwin->w_s->b_p_spf))
{
l = (int)STRLEN(curwin->w_s->b_p_spf);
if (l > 0 && (l < 4 || STRCMP(curwin->w_s->b_p_spf + l - 4,
".add") != 0))
errmsg = e_invarg;
}
if (errmsg == NULL)
{
FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == curbuf && wp->w_p_spell)
{
errmsg = did_set_spelllang(wp);
# ifdef FEAT_WINDOWS
break;
# endif
}
}
errmsg = did_set_spell_option(varp == &(curwin->w_s->b_p_spf));
}
/* When 'spellcapcheck' is set compile the regexp program. */
else if (varp == &(curwin->w_s->b_p_spc))
@@ -7687,6 +7692,36 @@ check_clipboard_option()
#endif
#ifdef FEAT_SPELL
static char_u *
did_set_spell_option(is_spellfile)
int is_spellfile;
{
char_u *errmsg = NULL;
win_T *wp;
int l;
if (is_spellfile)
{
l = (int)STRLEN(curwin->w_s->b_p_spf);
if (l > 0 && (l < 4
|| STRCMP(curwin->w_s->b_p_spf + l - 4, ".add") != 0))
errmsg = e_invarg;
}
if (errmsg == NULL)
{
FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == curbuf && wp->w_p_spell)
{
errmsg = did_set_spelllang(wp);
# ifdef FEAT_WINDOWS
break;
# endif
}
}
return errmsg;
}
/*
* Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'.
* Return error message when failed, NULL when OK.
@@ -11741,6 +11776,7 @@ vimrc_found(fname, envname)
if (!(options[opt_idx].flags & (P_WAS_SET|P_VI_DEF)))
set_option_default(opt_idx, OPT_FREE, FALSE);
didset_options();
didset_options2();
}
if (fname != NULL)
@@ -11829,6 +11865,7 @@ compatible_set()
|| (!(options[opt_idx].flags & P_VI_DEF) && !p_cp))
set_option_default(opt_idx, OPT_FREE, p_cp);
didset_options();
didset_options2();
}
#ifdef FEAT_LINEBREAK

View File

@@ -213,8 +213,8 @@ static void standout(void);
static void standend(void);
static void visual_bell(void);
static void cursor_visible(BOOL fVisible);
static BOOL write_chars(LPCSTR pchBuf, DWORD cchToWrite);
static char_u tgetch(int *pmodifiers, char_u *pch2);
static DWORD write_chars(char_u *pchBuf, DWORD cbToWrite);
static WCHAR tgetch(int *pmodifiers, WCHAR *pch2);
static void create_conin(void);
static int s_cursor_visible = TRUE;
static int did_create_conin = FALSE;
@@ -265,15 +265,15 @@ read_console_input(
if (!win8_or_later)
{
if (nLength == -1)
return PeekConsoleInput(hInput, lpBuffer, 1, lpEvents);
return ReadConsoleInput(hInput, lpBuffer, 1, &dwEvents);
return PeekConsoleInputW(hInput, lpBuffer, 1, lpEvents);
return ReadConsoleInputW(hInput, lpBuffer, 1, &dwEvents);
}
if (s_dwMax == 0)
{
if (nLength == -1)
return PeekConsoleInput(hInput, lpBuffer, 1, lpEvents);
if (!ReadConsoleInput(hInput, s_irCache, IRSIZE, &dwEvents))
return PeekConsoleInputW(hInput, lpBuffer, 1, lpEvents);
if (!ReadConsoleInputW(hInput, s_irCache, IRSIZE, &dwEvents))
return FALSE;
s_dwIndex = 0;
s_dwMax = dwEvents;
@@ -868,9 +868,9 @@ static const struct
#endif
#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__CYGWIN__)
# define AChar AsciiChar
# define UChar UnicodeChar
#else
# define AChar uChar.AsciiChar
# define UChar uChar.UnicodeChar
#endif
/* The return code indicates key code size. */
@@ -889,12 +889,12 @@ win32_kbd_patch_key(
if (s_iIsDead == 2)
{
pker->AChar = (CHAR) awAnsiCode[1];
pker->UChar = (WCHAR) awAnsiCode[1];
s_iIsDead = 0;
return 1;
}
if (pker->AChar != 0)
if (pker->UChar != 0)
return 1;
vim_memset(abKeystate, 0, sizeof (abKeystate));
@@ -909,7 +909,7 @@ win32_kbd_patch_key(
}
/* Clear any pending dead keys */
ToAscii(VK_SPACE, MapVirtualKey(VK_SPACE, 0), abKeystate, awAnsiCode, 0);
ToUnicode(VK_SPACE, MapVirtualKey(VK_SPACE, 0), abKeystate, awAnsiCode, 2, 0);
if (uMods & SHIFT_PRESSED)
abKeystate[VK_SHIFT] = 0x80;
@@ -922,11 +922,11 @@ win32_kbd_patch_key(
abKeystate[VK_MENU] = abKeystate[VK_RMENU] = 0x80;
}
s_iIsDead = ToAscii(pker->wVirtualKeyCode, pker->wVirtualScanCode,
abKeystate, awAnsiCode, 0);
s_iIsDead = ToUnicode(pker->wVirtualKeyCode, pker->wVirtualScanCode,
abKeystate, awAnsiCode, 2, 0);
if (s_iIsDead > 0)
pker->AChar = (CHAR) awAnsiCode[0];
pker->UChar = (WCHAR) awAnsiCode[0];
return s_iIsDead;
}
@@ -953,8 +953,8 @@ static BOOL g_fJustGotFocus = FALSE;
static BOOL
decode_key_event(
KEY_EVENT_RECORD *pker,
char_u *pch,
char_u *pch2,
WCHAR *pch,
WCHAR *pch2,
int *pmodifiers,
BOOL fDoPost)
{
@@ -982,7 +982,7 @@ decode_key_event(
}
/* special cases */
if ((nModifs & CTRL) != 0 && (nModifs & ~CTRL) == 0 && pker->AChar == NUL)
if ((nModifs & CTRL) != 0 && (nModifs & ~CTRL) == 0 && pker->UChar == NUL)
{
/* Ctrl-6 is Ctrl-^ */
if (pker->wVirtualKeyCode == '6')
@@ -1044,7 +1044,7 @@ decode_key_event(
*pch = NUL;
else
{
*pch = (i > 0) ? pker->AChar : NUL;
*pch = (i > 0) ? pker->UChar : NUL;
if (pmodifiers != NULL)
{
@@ -1436,7 +1436,7 @@ WaitForChar(long msec)
DWORD dwNow = 0, dwEndTime = 0;
INPUT_RECORD ir;
DWORD cRecords;
char_u ch, ch2;
WCHAR ch, ch2;
if (msec > 0)
/* Wait until the specified time has elapsed. */
@@ -1523,7 +1523,7 @@ WaitForChar(long msec)
#ifdef FEAT_MBYTE_IME
/* Windows IME sends two '\n's with only one 'ENTER'. First:
* wVirtualKeyCode == 13. second: wVirtualKeyCode == 0 */
if (ir.Event.KeyEvent.uChar.UnicodeChar == 0
if (ir.Event.KeyEvent.UChar == 0
&& ir.Event.KeyEvent.wVirtualKeyCode == 13)
{
read_console_input(g_hConIn, &ir, 1, &cRecords);
@@ -1586,10 +1586,10 @@ create_conin(void)
/*
* Get a keystroke or a mouse event
*/
static char_u
tgetch(int *pmodifiers, char_u *pch2)
static WCHAR
tgetch(int *pmodifiers, WCHAR *pch2)
{
char_u ch;
WCHAR ch;
for (;;)
{
@@ -1658,11 +1658,6 @@ mch_inchar(
#define TYPEAHEADLEN 20
static char_u typeahead[TYPEAHEADLEN]; /* previously typed bytes. */
static int typeaheadlen = 0;
#ifdef FEAT_MBYTE
static char_u *rest = NULL; /* unconverted rest of previous read */
static int restlen = 0;
int unconverted;
#endif
/* First use any typeahead that was kept because "buf" was too small. */
if (typeaheadlen > 0)
@@ -1761,38 +1756,11 @@ mch_inchar(
else
#endif
{
char_u ch2 = NUL;
WCHAR ch2 = NUL;
int modifiers = 0;
c = tgetch(&modifiers, &ch2);
#ifdef FEAT_MBYTE
/* stolen from fill_input_buf() in ui.c */
if (rest != NULL)
{
/* Use remainder of previous call, starts with an invalid
* character that may become valid when reading more. */
if (restlen > TYPEAHEADLEN - typeaheadlen)
unconverted = TYPEAHEADLEN - typeaheadlen;
else
unconverted = restlen;
mch_memmove(typeahead + typeaheadlen, rest, unconverted);
if (unconverted == restlen)
{
vim_free(rest);
rest = NULL;
}
else
{
restlen -= unconverted;
mch_memmove(rest, rest + unconverted, restlen);
}
typeaheadlen += unconverted;
}
else
unconverted = 0;
#endif
if (typebuf_changed(tb_change_cnt))
{
/* "buf" may be invalid now if a client put something in the
@@ -1816,27 +1784,36 @@ mch_inchar(
int n = 1;
int conv = FALSE;
typeahead[typeaheadlen] = c;
#ifdef FEAT_MBYTE
if (ch2 == NUL)
{
int i;
char_u *p;
WCHAR ch[2];
ch[0] = c;
if (c >= 0xD800 && c <= 0xDBFF) /* High surrogate */
{
ch[1] = tgetch(&modifiers, &ch2);
n++;
}
p = utf16_to_enc(ch, &n);
if (p != NULL)
{
for (i = 0; i < n; i++)
typeahead[typeaheadlen + i] = p[i];
vim_free(p);
}
}
else
#endif
typeahead[typeaheadlen] = c;
if (ch2 != NUL)
{
typeahead[typeaheadlen + 1] = 3;
typeahead[typeaheadlen + 2] = ch2;
typeahead[typeaheadlen + n] = 3;
typeahead[typeaheadlen + n + 1] = (char_u)ch2;
n += 2;
}
#ifdef FEAT_MBYTE
/* Only convert normal characters, not special keys. Need to
* convert before applying ALT, otherwise mapping <M-x> breaks
* when 'tenc' is set. */
if (input_conv.vc_type != CONV_NONE
&& (ch2 == NUL || c != K_NUL))
{
conv = TRUE;
typeaheadlen -= unconverted;
n = convert_input_safe(typeahead + typeaheadlen,
n + unconverted, TYPEAHEADLEN - typeaheadlen,
rest == NULL ? &rest : NULL, &restlen);
}
#endif
if (conv)
{
@@ -2192,8 +2169,7 @@ typedef struct ConsoleBufferStruct
{
BOOL IsValid;
CONSOLE_SCREEN_BUFFER_INFO Info;
PCHAR_INFO Buffer;
COORD BufferSize;
HANDLE handle;
} ConsoleBuffer;
/*
@@ -2210,77 +2186,81 @@ typedef struct ConsoleBufferStruct
SaveConsoleBuffer(
ConsoleBuffer *cb)
{
DWORD NumCells;
COORD BufferCoord;
SMALL_RECT ReadRegion;
WORD Y, Y_incr;
if (cb == NULL)
return FALSE;
if (!GetConsoleScreenBufferInfo(g_hConOut, &cb->Info))
if (!GetConsoleScreenBufferInfo(cb->handle, &cb->Info))
{
cb->IsValid = FALSE;
return FALSE;
}
cb->IsValid = TRUE;
/*
* Allocate a buffer large enough to hold the entire console screen
* buffer. If this ConsoleBuffer structure has already been initialized
* with a buffer of the correct size, then just use that one.
*/
if (!cb->IsValid || cb->Buffer == NULL ||
cb->BufferSize.X != cb->Info.dwSize.X ||
cb->BufferSize.Y != cb->Info.dwSize.Y)
{
cb->BufferSize.X = cb->Info.dwSize.X;
cb->BufferSize.Y = cb->Info.dwSize.Y;
NumCells = cb->BufferSize.X * cb->BufferSize.Y;
vim_free(cb->Buffer);
cb->Buffer = (PCHAR_INFO)alloc(NumCells * sizeof(CHAR_INFO));
if (cb->Buffer == NULL)
return FALSE;
}
return TRUE;
}
/*
* CopyOldConsoleBuffer()
* Description:
* Copies the old console buffer contents to the current console buffer.
* This is used when 'restorescreen' is off.
* Returns:
* TRUE on success
*/
static BOOL
CopyOldConsoleBuffer(
ConsoleBuffer *cb,
HANDLE hConOld)
{
COORD BufferCoord;
COORD BufferSize;
PCHAR_INFO Buffer;
DWORD NumCells;
SMALL_RECT ReadRegion;
/*
* We will now copy the console screen buffer into our buffer.
* ReadConsoleOutput() seems to be limited as far as how much you
* can read at a time. Empirically, this number seems to be about
* 12000 cells (rows * columns). Start at position (0, 0) and copy
* in chunks until it is all copied. The chunks will all have the
* same horizontal characteristics, so initialize them now. The
* height of each chunk will be (12000 / width).
* Before copying the buffer contents, clear the current buffer, and
* restore the window information. Doing this now prevents old buffer
* contents from "flashing" onto the screen.
*/
BufferCoord.X = 0;
ClearConsoleBuffer(cb->Info.wAttributes);
/* We only need to copy the window area, not whole buffer. */
BufferSize.X = cb->Info.srWindow.Right - cb->Info.srWindow.Left + 1;
BufferSize.Y = cb->Info.srWindow.Bottom - cb->Info.srWindow.Top + 1;
ReadRegion.Left = 0;
ReadRegion.Right = cb->Info.dwSize.X - 1;
Y_incr = 12000 / cb->Info.dwSize.X;
for (Y = 0; Y < cb->BufferSize.Y; Y += Y_incr)
ReadRegion.Right = BufferSize.X - 1;
ReadRegion.Top = 0;
ReadRegion.Bottom = BufferSize.Y - 1;
NumCells = BufferSize.X * BufferSize.Y;
Buffer = (PCHAR_INFO)alloc(NumCells * sizeof(CHAR_INFO));
if (Buffer == NULL)
return FALSE;
BufferCoord.X = 0;
BufferCoord.Y = 0;
if (!ReadConsoleOutputW(hConOld, /* output handle */
Buffer, /* our buffer */
BufferSize, /* dimensions of our buffer */
BufferCoord, /* offset in our buffer */
&ReadRegion)) /* region to save */
{
/*
* Read into position (0, Y) in our buffer.
*/
BufferCoord.Y = Y;
/*
* Read the region whose top left corner is (0, Y) and whose bottom
* right corner is (width - 1, Y + Y_incr - 1). This should define
* a region of size width by Y_incr. Don't worry if this region is
* too large for the remaining buffer; it will be cropped.
*/
ReadRegion.Top = Y;
ReadRegion.Bottom = Y + Y_incr - 1;
if (!ReadConsoleOutput(g_hConOut, /* output handle */
cb->Buffer, /* our buffer */
cb->BufferSize, /* dimensions of our buffer */
BufferCoord, /* offset in our buffer */
&ReadRegion)) /* region to save */
{
vim_free(cb->Buffer);
cb->Buffer = NULL;
return FALSE;
}
vim_free(Buffer);
return FALSE;
}
if (!WriteConsoleOutputW(g_hConOut, /* output handle */
Buffer, /* our buffer */
BufferSize, /* dimensions of our buffer */
BufferCoord, /* offset in our buffer */
&ReadRegion)) /* region to restore */
{
vim_free(Buffer);
return FALSE;
}
vim_free(Buffer);
SetConsoleWindowInfo(g_hConOut, TRUE, &ReadRegion);
return TRUE;
}
@@ -2299,67 +2279,20 @@ RestoreConsoleBuffer(
ConsoleBuffer *cb,
BOOL RestoreScreen)
{
COORD BufferCoord;
SMALL_RECT WriteRegion;
HANDLE hConOld;
if (cb == NULL || !cb->IsValid)
return FALSE;
/*
* Before restoring the buffer contents, clear the current buffer, and
* restore the cursor position and window information. Doing this now
* prevents old buffer contents from "flashing" onto the screen.
*/
if (RestoreScreen)
ClearConsoleBuffer(cb->Info.wAttributes);
FitConsoleWindow(cb->Info.dwSize, TRUE);
if (!SetConsoleScreenBufferSize(g_hConOut, cb->Info.dwSize))
return FALSE;
if (!SetConsoleTextAttribute(g_hConOut, cb->Info.wAttributes))
return FALSE;
if (!RestoreScreen)
{
/*
* No need to restore the screen buffer contents, so we're done.
*/
return TRUE;
}
if (!SetConsoleCursorPosition(g_hConOut, cb->Info.dwCursorPosition))
return FALSE;
if (!SetConsoleWindowInfo(g_hConOut, TRUE, &cb->Info.srWindow))
return FALSE;
/*
* Restore the screen buffer contents.
*/
if (cb->Buffer != NULL)
{
BufferCoord.X = 0;
BufferCoord.Y = 0;
WriteRegion.Left = 0;
WriteRegion.Top = 0;
WriteRegion.Right = cb->Info.dwSize.X - 1;
WriteRegion.Bottom = cb->Info.dwSize.Y - 1;
if (!WriteConsoleOutput(g_hConOut, /* output handle */
cb->Buffer, /* our buffer */
cb->BufferSize, /* dimensions of our buffer */
BufferCoord, /* offset in our buffer */
&WriteRegion)) /* region to restore */
{
return FALSE;
}
}
hConOld = g_hConOut;
g_hConOut = cb->handle;
if (!RestoreScreen && exiting)
CopyOldConsoleBuffer(cb, hConOld);
SetConsoleActiveScreenBuffer(g_hConOut);
return TRUE;
}
#define FEAT_RESTORE_ORIG_SCREEN
#ifdef FEAT_RESTORE_ORIG_SCREEN
static ConsoleBuffer g_cbOrig = { 0 };
#endif
static ConsoleBuffer g_cbNonTermcap = { 0 };
static ConsoleBuffer g_cbTermcap = { 0 };
@@ -2498,9 +2431,6 @@ static DWORD g_cmodeout = 0;
void
mch_init(void)
{
#ifndef FEAT_RESTORE_ORIG_SCREEN
CONSOLE_SCREEN_BUFFER_INFO csbi;
#endif
#ifndef __MINGW32__
extern int _fmode;
#endif
@@ -2521,16 +2451,14 @@ mch_init(void)
else
create_conin();
g_hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
g_cbNonTermcap.handle = g_hConOut;
g_cbTermcap.handle = CreateConsoleScreenBuffer(
GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, CONSOLE_TEXTMODE_BUFFER, NULL);
#ifdef FEAT_RESTORE_ORIG_SCREEN
/* Save the initial console buffer for later restoration */
SaveConsoleBuffer(&g_cbOrig);
g_attrCurrent = g_attrDefault = g_cbOrig.Info.wAttributes;
#else
/* Get current text attributes */
GetConsoleScreenBufferInfo(g_hConOut, &csbi);
g_attrCurrent = g_attrDefault = csbi.wAttributes;
#endif
SaveConsoleBuffer(&g_cbNonTermcap);
g_attrCurrent = g_attrDefault = g_cbNonTermcap.Info.wAttributes;
if (cterm_normal_fg_color == 0)
cterm_normal_fg_color = (g_attrCurrent & 0xf) + 1;
if (cterm_normal_bg_color == 0)
@@ -2630,6 +2558,8 @@ mch_exit(int r)
SetConsoleMode(g_hConIn, g_cmodein);
SetConsoleMode(g_hConOut, g_cmodeout);
CloseHandle(g_cbTermcap.handle);
#ifdef DYNAMIC_GETTEXT
dyn_libintl_end();
#endif
@@ -5002,6 +4932,8 @@ termcap_mode_start(void)
* screen buffer, and resize the buffer to match the current window
* size. We will use this as the size of our editing environment.
*/
g_hConOut = g_cbTermcap.handle;
SetConsoleActiveScreenBuffer(g_hConOut);
ClearConsoleBuffer(g_attrCurrent);
ResizeConBufAndWindow(g_hConOut, Columns, Rows);
}
@@ -5045,11 +4977,7 @@ termcap_mode_end(void)
cmodein &= ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT);
SetConsoleMode(g_hConIn, cmodein);
#ifdef FEAT_RESTORE_ORIG_SCREEN
cb = exiting ? &g_cbOrig : &g_cbNonTermcap;
#else
cb = &g_cbNonTermcap;
#endif
RestoreConsoleBuffer(cb, p_rs);
SetConsoleCursorInfo(g_hConOut, &g_cci);
@@ -5415,27 +5343,73 @@ cursor_visible(BOOL fVisible)
/*
* write `cchToWrite' characters in `pchBuf' to the screen
* Returns the number of characters actually written (at least one).
* write `cbToWrite' bytes in `pchBuf' to the screen
* Returns the number of bytes actually written (at least one).
*/
static BOOL
static DWORD
write_chars(
LPCSTR pchBuf,
DWORD cchToWrite)
char_u *pchBuf,
DWORD cbToWrite)
{
COORD coord = g_coord;
DWORD written;
FillConsoleOutputAttribute(g_hConOut, g_attrCurrent, cchToWrite,
coord, &written);
/* When writing fails or didn't write a single character, pretend one
* character was written, otherwise we get stuck. */
if (WriteConsoleOutputCharacter(g_hConOut, pchBuf, cchToWrite,
coord, &written) == 0
|| written == 0)
written = 1;
#ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
static WCHAR *unicodebuf = NULL;
static int unibuflen = 0;
int length;
DWORD n, cchwritten, cells;
g_coord.X += (SHORT) written;
length = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)pchBuf, cbToWrite, 0, 0);
if (unicodebuf == NULL || length > unibuflen)
{
vim_free(unicodebuf);
unicodebuf = (WCHAR *)lalloc(length * sizeof(WCHAR), FALSE);
unibuflen = length;
}
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)pchBuf, cbToWrite,
unicodebuf, unibuflen);
cells = mb_string2cells(pchBuf, cbToWrite);
FillConsoleOutputAttribute(g_hConOut, g_attrCurrent, cells,
coord, &written);
/* When writing fails or didn't write a single character, pretend one
* character was written, otherwise we get stuck. */
if (WriteConsoleOutputCharacterW(g_hConOut, unicodebuf, length,
coord, &cchwritten) == 0
|| cchwritten == 0)
cchwritten = 1;
if (cchwritten == length)
{
written = cbToWrite;
g_coord.X += (SHORT)cells;
}
else
{
char_u *p = pchBuf;
for (n = 0; n < cchwritten; n++)
mb_cptr_adv(p);
written = p - pchBuf;
g_coord.X += (SHORT)mb_string2cells(pchBuf, written);
}
}
else
#endif
{
FillConsoleOutputAttribute(g_hConOut, g_attrCurrent, cbToWrite,
coord, &written);
/* When writing fails or didn't write a single character, pretend one
* character was written, otherwise we get stuck. */
if (WriteConsoleOutputCharacter(g_hConOut, (LPCSTR)pchBuf, cbToWrite,
coord, &written) == 0
|| written == 0)
written = 1;
g_coord.X += (SHORT) written;
}
while (g_coord.X > g_srScrollRegion.Right)
{

File diff suppressed because it is too large Load Diff

View File

@@ -1801,7 +1801,7 @@ find_rawstring_end(linep, startpos, endpos)
for (p = linep + startpos->col + 1; *p && *p != '('; ++p)
;
delim_len = (p - linep) - startpos->col - 1;
delim_copy = vim_strnsave(linep + startpos->col + 1, delim_len);
delim_copy = vim_strnsave(linep + startpos->col + 1, (int)delim_len);
if (delim_copy == NULL)
return FALSE;
for (lnum = startpos->lnum; lnum <= endpos->lnum; ++lnum)
@@ -3799,7 +3799,7 @@ current_block(oap, count, include, what, other)
if (VIsual_active)
{
if (*p_sel == 'e')
++curwin->w_cursor.col;
inc(&curwin->w_cursor);
if (sol && gchar_cursor() != NUL)
inc(&curwin->w_cursor); /* include the line break */
VIsual = start_pos;

View File

@@ -45,6 +45,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test_charsearch.out \
test_close_count.out \
test_command_count.out \
test_comparators.out \
test_erasebackword.out \
test_eval.out \
test_fixeol.out \
@@ -198,6 +199,7 @@ test_changelist.out: test_changelist.in
test_charsearch.out: test_charsearch.in
test_close_count.out: test_close_count.in
test_command_count.out: test_command_count.in
test_comparators.out: test_comparators.in
test_erasebackword.out: test_erasebackword.in
test_eval.out: test_eval.in
test_increment.out: test_increment.in

View File

@@ -44,6 +44,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test_charsearch.out \
test_close_count.out \
test_command_count.out \
test_comparators.out \
test_erasebackword.out \
test_eval.out \
test_fixeol.out \

View File

@@ -66,6 +66,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test_charsearch.out \
test_close_count.out \
test_command_count.out \
test_comparators.out \
test_erasebackword.out \
test_eval.out \
test_fixeol.out \

View File

@@ -46,6 +46,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test_charsearch.out \
test_close_count.out \
test_command_count.out \
test_comparators.out \
test_erasebackword.out \
test_eval.out \
test_fixeol.out \

View File

@@ -4,7 +4,7 @@
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
#
# Last change: 2015 Aug 11
# Last change: 2015 Sep 01
#
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
# Edit the lines in the Configuration section below to select.
@@ -105,6 +105,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
test_charsearch.out \
test_close_count.out \
test_command_count.out \
test_comparators.out \
test_erasebackword.out \
test_eval.out \
test_fixeol.out \

View File

@@ -42,6 +42,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test_charsearch.out \
test_close_count.out \
test_command_count.out \
test_comparators.out \
test_erasebackword.out \
test_eval.out \
test_fixeol.out \

View File

@@ -5,8 +5,12 @@ STARTTEST
:so small.vim
:so mbyte.vim
:"
:" Test for getbufvar()
:" Use strings to test for memory leaks.
:" First, check that in an empty window, gettabvar() returns the correct value
:let t:testvar='abcd'
:$put =string(gettabvar(1,'testvar'))
:$put =string(gettabvar(1,'testvar'))
:" Test for getbufvar()
:let b:var_num = '1234'
:let def_num = '5678'
:$put =string(getbufvar(1, 'var_num'))

View File

@@ -1,4 +1,6 @@
start:
'abcd'
'abcd'
'1234'
'1234'
{'var_num': '1234'}

View File

@@ -0,0 +1,21 @@
" Test for expression comparators. vim: set ft=vim :
STARTTEST
:so small.vim
:try
: let oldisident=&isident
: set isident+=#
: if 1 is#1
: $put ='ok'
: else
: $put ='ng'
: endif
:finally
: let &isident=oldisident
:endtry
:"
:/^marker/+1,$wq! test.out
ENDTEST
marker

View File

@@ -0,0 +1 @@
ok

View File

@@ -277,7 +277,15 @@ Text:
Expected:
1) <Ctrl-a> and cursor is on a
b
21) block-wise increment on part of hexadecimal
Text:
0x123456
Expected:
1) Ctrl-V f3 <ctrl-a>
0x124456
STARTTEST
@@ -401,6 +409,12 @@ V3kg..
:.put =col('.')
:set nrformats&vim
:" Test 21
:/^S21=/+,/^E21=/-y a
:/^E21=/+put a
:set nrformats&vim
f3
:" Save the report
:/^# Test 1/,$w! test.out
:qa!
@@ -594,6 +608,13 @@ E20====
# Test 21
S21====
0x123456
E21====
ENDTEST

View File

@@ -280,6 +280,14 @@ b
1
# Test 21
S21====
0x123456
E21====
0x124456
ENDTEST

View File

@@ -45,6 +45,21 @@ o+
:/^a b
0qqdw.ifooqj0@q:unmap .
:" <c-g>U<cursor> works only within a single line
:imapclear
:imap ( ()<c-g>U<left>
G2oki
Test1: text with a (here some more textk.
:" test undo
G2oki
Test2: text wit a (here some more text [und undo]uk.u
:"
:imapclear
:set whichwrap=<,>,[,]
G3o2k
:exe ":norm! iTest3: text with a (parenthesis here\<C-G>U\<Right>new line here\<esc>\<up>\<up>."
:/^test/,$w! test.out
:qa!

View File

@@ -10,3 +10,13 @@ vmap works
+
+
+
Test1: text with a (here some more text)
Test1: text with a (here some more text)
Test2: text wit a (here some more text [und undo])
new line here
Test3: text with a (parenthesis here
new line here

View File

@@ -42,7 +42,7 @@ ui_write(s, len)
/* Don't output anything in silent mode ("ex -s") unless 'verbose' set */
if (!(silent_mode && p_verbose == 0))
{
#ifdef FEAT_MBYTE
#if defined(FEAT_MBYTE) && !defined(WIN3264)
char_u *tofree = NULL;
if (output_conv.vc_type != CONV_NONE)
@@ -56,7 +56,7 @@ ui_write(s, len)
mch_write(s, len);
#ifdef FEAT_MBYTE
#if defined(FEAT_MBYTE) && !defined(WIN3264)
if (output_conv.vc_type != CONV_NONE)
vim_free(tofree);
#endif

View File

@@ -741,6 +741,56 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
855,
/**/
854,
/**/
853,
/**/
852,
/**/
851,
/**/
850,
/**/
849,
/**/
848,
/**/
847,
/**/
846,
/**/
845,
/**/
844,
/**/
843,
/**/
842,
/**/
841,
/**/
840,
/**/
839,
/**/
838,
/**/
837,
/**/
836,
/**/
835,
/**/
834,
/**/
833,
/**/
832,
/**/
831,
/**/
830,
/**/