Skip to content

Commit b1a3f4d

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents a217a8f + b146e01 commit b1a3f4d

50 files changed

Lines changed: 1590 additions & 472 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

runtime/doc/eval.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4941,8 +4941,11 @@ getbufinfo([{dict}])
49414941
<
49424942
To get buffer-local options use: >
49434943
getbufvar({bufnr}, '&option_name')
4944-
49454944
<
4945+
Can also be used as a |method|: >
4946+
GetBufnr()->getbufinfo()
4947+
<
4948+
49464949
*getbufline()*
49474950
getbufline({expr}, {lnum} [, {end}])
49484951
Return a |List| with the lines starting from {lnum} to {end}

runtime/doc/options.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,9 +1974,11 @@ A jump table for the options with a short description can be found at |Q_op|.
19741974
{not available when compiled without the |+textprop|
19751975
or |+quickfix| feature}
19761976
When 'completeopt' contains "popup" then this option is used for the
1977-
properties of the info popup when it is created. You can also use
1978-
|popup_findinfo()| and then set properties for an existing info popup
1979-
with |popup_setoptions()|. See |complete-popup|.
1977+
properties of the info popup when it is created. If an info popup
1978+
window already exists it is closed, so that the option value is
1979+
applied when it is created again.
1980+
You can also use |popup_findinfo()| and then set properties for an
1981+
existing info popup with |popup_setoptions()|. See |complete-popup|.
19801982

19811983

19821984
*'concealcursor'* *'cocu'*

runtime/doc/vim9.txt

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*vim9.txt* For Vim version 8.2. Last change: 2020 Jul 10
1+
*vim9.txt* For Vim version 8.2. Last change: 2020 Jul 17
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -64,20 +64,24 @@ THIS IS STILL UNDER DEVELOPMENT - ANYTHING CAN BREAK - ANYTHING CAN CHANGE
6464

6565
Comments starting with # ~
6666

67-
In Vim script comments start with double quote. That can also be the start of
68-
a string, thus in many places it cannot be used. In Vim9 script a comment
69-
normally starts with #. In Vi this is a command to list text with numbers,
70-
but you can also use `:number` for that. >
67+
In legacy Vim script comments start with double quote. In Vim9 script
68+
comments start with #. >
69+
# declarations
7170
let count = 0 # number of occurrences
7271
73-
To improve readability there must be a space between the command and the #
72+
The reason is that a double quote can also be the start of a string. In many
73+
places, especially halfway an expression with a line break, it's hard to tell
74+
what the meaning is. To avoid confusion only # comments are recognized.
75+
This is the same as in shell scripts and Python programs.
76+
77+
In Vi # is a command to list text with numbers. In Vim9 script you can use
78+
`:number` for that. >
79+
101number
80+
81+
To improve readability there must be a space between a command and the #
7482
that starts a comment. Note that #{ is the start of a dictionary, therefore
7583
it cannot start a comment.
7684

77-
Since Vim9 script allows for line breaks in many places, the double quoted
78-
comment also cannot be used at the start of a line after an expression. To
79-
avoid confusion it is best to only use # comments.
80-
8185

8286
Vim9 functions ~
8387

@@ -400,6 +404,7 @@ The boolean operators "||" and "&&" do not change the value: >
400404
0 || '' == ''
401405
8 && 2 == 2
402406
0 && 2 == 0
407+
2 && 0 == 0
403408
[] && 2 == []
404409
405410
When using `..` for string concatenation the arguments are always converted to
@@ -418,13 +423,15 @@ be made. Here is a summary of what might be unexpected.
418423

419424
Ex command ranges need to be prefixed with a colon. >
420425
-> " legacy Vim: shifts the previous line to the right
421-
->func() " Vim9: method call
426+
->func() " Vim9: method call in continuation line
422427
:-> " Vim9: shifts the previous line to the right
423428
424429
%s/a/b " legacy Vim: substitute on all lines
425430
x = alongname
426431
% another " Vim9: line continuation without a backslash
427432
:%s/a/b " Vim9: substitute on all lines
433+
'text'->func() " Vim9: method call
434+
:'t " legacy Vim: jump to mark m
428435
429436
Functions defined with `:def` compile the whole function. Legacy functions
430437
can bail out, and the following lines are not parsed: >

src/eval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1913,7 +1913,7 @@ eval_next_non_blank(char_u *arg, evalarg_T *evalarg, int *getnext)
19131913
&& evalarg != NULL
19141914
&& (evalarg->eval_cookie != NULL || evalarg->eval_cctx != NULL)
19151915
&& (*arg == NUL || (VIM_ISWHITE(arg[-1])
1916-
&& *arg == '#' && arg[1] != '{')))
1916+
&& vim9_comment_start(arg))))
19171917
{
19181918
char_u *p;
19191919

src/evalfunc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ static funcentry_T global_functions[] =
611611
{"function", 1, 3, FEARG_1, ret_f_function, f_function},
612612
{"garbagecollect", 0, 1, 0, ret_void, f_garbagecollect},
613613
{"get", 2, 3, FEARG_1, ret_any, f_get},
614-
{"getbufinfo", 0, 1, 0, ret_list_dict_any, f_getbufinfo},
614+
{"getbufinfo", 0, 1, FEARG_1, ret_list_dict_any, f_getbufinfo},
615615
{"getbufline", 2, 3, FEARG_1, ret_list_string, f_getbufline},
616616
{"getbufvar", 2, 3, FEARG_1, ret_any, f_getbufvar},
617617
{"getchangelist", 0, 1, FEARG_1, ret_list_any, f_getchangelist},

src/ex_docmd.c

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,6 +1655,16 @@ current_tab_nr(tabpage_T *tab)
16551655
return nr;
16561656
}
16571657

1658+
static int
1659+
comment_start(char_u *p, int starts_with_colon UNUSED)
1660+
{
1661+
#ifdef FEAT_EVAL
1662+
if (in_vim9script())
1663+
return p[0] == '#' && p[1] != '{' && !starts_with_colon;
1664+
#endif
1665+
return *p == '"';
1666+
}
1667+
16581668
# define CURRENT_WIN_NR current_win_nr(curwin)
16591669
# define LAST_WIN_NR current_win_nr(NULL)
16601670
# define CURRENT_TAB_NR current_tab_nr(curtab)
@@ -1704,8 +1714,8 @@ do_one_cmd(
17041714
int save_reg_executing = reg_executing;
17051715
int ni; // set when Not Implemented
17061716
char_u *cmd;
1717+
int starts_with_colon = FALSE;
17071718
#ifdef FEAT_EVAL
1708-
int starts_with_colon;
17091719
int starts_with_quote;
17101720
int vim9script = in_vim9script();
17111721
#endif
@@ -1892,12 +1902,8 @@ do_one_cmd(
18921902
* If we got a line, but no command, then go to the line.
18931903
* If we find a '|' or '\n' we set ea.nextcmd.
18941904
*/
1895-
if (*ea.cmd == NUL || *ea.cmd == '"'
1896-
#ifdef FEAT_EVAL
1897-
|| (*ea.cmd == '#' && ea.cmd[1] != '{'
1898-
&& !starts_with_colon && vim9script)
1899-
#endif
1900-
|| (ea.nextcmd = check_nextcmd(ea.cmd)) != NULL)
1905+
if (*ea.cmd == NUL || comment_start(ea.cmd, starts_with_colon)
1906+
|| (ea.nextcmd = check_nextcmd(ea.cmd)) != NULL)
19011907
{
19021908
/*
19031909
* strange vi behaviour:
@@ -2231,7 +2237,7 @@ do_one_cmd(
22312237
ea.do_ecmd_cmd = getargcmd(&ea.arg);
22322238

22332239
/*
2234-
* Check for '|' to separate commands and '"' to start comments.
2240+
* Check for '|' to separate commands and '"' or '#' to start comments.
22352241
* Don't do this for ":read !cmd" and ":write !cmd".
22362242
*/
22372243
if ((ea.argt & EX_TRLBAR) && !ea.usefilter)
@@ -2665,7 +2671,8 @@ do_one_cmd(
26652671
int
26662672
parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)
26672673
{
2668-
char_u *p;
2674+
char_u *p;
2675+
int starts_with_colon = FALSE;
26692676

26702677
CLEAR_FIELD(cmdmod);
26712678
eap->verbose_save = -1;
@@ -2675,7 +2682,11 @@ parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)
26752682
for (;;)
26762683
{
26772684
while (*eap->cmd == ' ' || *eap->cmd == '\t' || *eap->cmd == ':')
2685+
{
2686+
if (*eap->cmd == ':')
2687+
starts_with_colon = TRUE;
26782688
++eap->cmd;
2689+
}
26792690

26802691
// in ex mode, an empty line works like :+
26812692
if (*eap->cmd == NUL && exmode_active
@@ -2689,7 +2700,7 @@ parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)
26892700
}
26902701

26912702
// ignore comment and empty lines
2692-
if (*eap->cmd == '"')
2703+
if (comment_start(eap->cmd, starts_with_colon))
26932704
return FAIL;
26942705
if (*eap->cmd == NUL)
26952706
{
@@ -4527,14 +4538,20 @@ separate_nextcmd(exarg_T *eap)
45274538
// Check for '"': start of comment or '|': next command
45284539
// :@" and :*" do not start a comment!
45294540
// :redir @" doesn't either.
4530-
else if ((*p == '"' && !(eap->argt & EX_NOTRLCOM)
4541+
else if ((*p == '"'
4542+
#ifdef FEAT_EVAL
4543+
&& !in_vim9script()
4544+
#endif
4545+
&& !(eap->argt & EX_NOTRLCOM)
45314546
&& ((eap->cmdidx != CMD_at && eap->cmdidx != CMD_star)
4532-
|| p != eap->arg)
4547+
|| p != eap->arg)
45334548
&& (eap->cmdidx != CMD_redir
4534-
|| p != eap->arg + 1 || p[-1] != '@'))
4549+
|| p != eap->arg + 1 || p[-1] != '@'))
45354550
#ifdef FEAT_EVAL
4536-
|| (*p == '#' && in_vim9script()
4537-
&& p[1] != '{' && p > eap->cmd && VIM_ISWHITE(p[-1]))
4551+
|| (*p == '#'
4552+
&& in_vim9script()
4553+
&& p[1] != '{'
4554+
&& p > eap->cmd && VIM_ISWHITE(p[-1]))
45384555
#endif
45394556
|| *p == '|' || *p == '\n')
45404557
{
@@ -4873,11 +4890,13 @@ ex_blast(exarg_T *eap)
48734890
int
48744891
ends_excmd(int c)
48754892
{
4893+
int comment_char = '"';
4894+
48764895
#ifdef FEAT_EVAL
4877-
if (c == '#')
4878-
return in_vim9script();
4896+
if (in_vim9script())
4897+
comment_char = '#';
48794898
#endif
4880-
return (c == NUL || c == '|' || c == '"' || c == '\n');
4899+
return (c == NUL || c == '|' || c == comment_char || c == '\n');
48814900
}
48824901

48834902
/*
@@ -4889,11 +4908,14 @@ ends_excmd2(char_u *cmd_start UNUSED, char_u *cmd)
48894908
{
48904909
int c = *cmd;
48914910

4911+
if (c == NUL || c == '|' || c == '\n')
4912+
return TRUE;
48924913
#ifdef FEAT_EVAL
4893-
if (c == '#' && cmd[1] != '{' && (cmd == cmd_start || VIM_ISWHITE(cmd[-1])))
4894-
return in_vim9script();
4914+
if (in_vim9script())
4915+
return c == '#' && cmd[1] != '{'
4916+
&& (cmd == cmd_start || VIM_ISWHITE(cmd[-1]));
48954917
#endif
4896-
return (c == NUL || c == '|' || c == '"' || c == '\n');
4918+
return c == '"';
48974919
}
48984920

48994921
#if defined(FEAT_SYN_HL) || defined(FEAT_SEARCH_EXTRA) || defined(FEAT_EVAL) \
@@ -7037,7 +7059,12 @@ ex_wincmd(exarg_T *eap)
70377059

70387060
eap->nextcmd = check_nextcmd(p);
70397061
p = skipwhite(p);
7040-
if (*p != NUL && *p != '"' && eap->nextcmd == NULL)
7062+
if (*p != NUL && *p != (
7063+
#ifdef FEAT_EVAL
7064+
in_vim9script() ? '#' :
7065+
#endif
7066+
'"')
7067+
&& eap->nextcmd == NULL)
70417068
emsg(_(e_invarg));
70427069
else if (!eap->skip)
70437070
{

src/gui.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,11 +1439,13 @@ gui_position_components(int total_width UNUSED)
14391439
if (gui.which_scrollbars[SBAR_BOTTOM])
14401440
gui_mch_set_scrollbar_pos(&gui.bottom_sbar,
14411441
text_area_x,
1442-
text_area_y + text_area_height,
1442+
text_area_y + text_area_height
1443+
+ gui_mch_get_scrollbar_ypadding(),
14431444
text_area_width,
14441445
gui.scrollbar_height);
14451446
gui.left_sbar_x = 0;
1446-
gui.right_sbar_x = text_area_x + text_area_width;
1447+
gui.right_sbar_x = text_area_x + text_area_width
1448+
+ gui_mch_get_scrollbar_xpadding();
14471449

14481450
--hold_gui_events;
14491451
}

src/gui_athena.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,6 +1889,22 @@ gui_mch_set_scrollbar_pos(
18891889
XtManageChild(sb->id);
18901890
}
18911891

1892+
int
1893+
gui_mch_get_scrollbar_xpadding(void)
1894+
{
1895+
// TODO: Calculate the padding for adjust scrollbar position when the
1896+
// Window is maximized.
1897+
return 0;
1898+
}
1899+
1900+
int
1901+
gui_mch_get_scrollbar_ypadding(void)
1902+
{
1903+
// TODO: Calculate the padding for adjust scrollbar position when the
1904+
// Window is maximized.
1905+
return 0;
1906+
}
1907+
18921908
void
18931909
gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)
18941910
{

src/gui_gtk.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,22 @@ gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h)
10081008
gtk_form_move_resize(GTK_FORM(gui.formwin), sb->id, x, y, w, h);
10091009
}
10101010

1011+
int
1012+
gui_mch_get_scrollbar_xpadding(void)
1013+
{
1014+
// TODO: Calculate the padding for adjust scrollbar position when the
1015+
// Window is maximized.
1016+
return 0;
1017+
}
1018+
1019+
int
1020+
gui_mch_get_scrollbar_ypadding(void)
1021+
{
1022+
// TODO: Calculate the padding for adjust scrollbar position when the
1023+
// Window is maximized.
1024+
return 0;
1025+
}
1026+
10111027
/*
10121028
* Take action upon scrollbar dragging.
10131029
*/

src/gui_haiku.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3665,6 +3665,22 @@ gui_mch_set_scrollbar_pos(
36653665
}
36663666
}
36673667

3668+
int
3669+
gui_mch_get_scrollbar_xpadding(void)
3670+
{
3671+
// TODO: Calculate the padding for adjust scrollbar position when the
3672+
// Window is maximized.
3673+
return 0;
3674+
}
3675+
3676+
int
3677+
gui_mch_get_scrollbar_ypadding(void)
3678+
{
3679+
// TODO: Calculate the padding for adjust scrollbar position when the
3680+
// Window is maximized.
3681+
return 0;
3682+
}
3683+
36683684
void
36693685
gui_mch_create_scrollbar(
36703686
scrollbar_T *sb,

0 commit comments

Comments
 (0)