Skip to content

Commit 6688ed2

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 3ad944b + e76c4b2 commit 6688ed2

8 files changed

Lines changed: 79 additions & 26 deletions

File tree

src/ex_cmds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ EX(CMD_for, "for", ex_while,
584584
EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
585585
ADDR_LINES),
586586
EX(CMD_function, "function", ex_function,
587-
EXTRA|BANG|CMDWIN,
587+
EXTRA|BANG|SBOXOK|CMDWIN,
588588
ADDR_LINES),
589589
EX(CMD_global, "global", ex_global,
590590
RANGE|WHOLEFOLD|BANG|EXTRA|DFLALL|SBOXOK|CMDWIN,

src/if_ole.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ extern "C" void InitOLE(int *pbDoRestart)
759759
hr = RegisterActiveObject(
760760
app,
761761
MYCLSID,
762-
NULL,
762+
0,
763763
&app_id);
764764

765765
if (FAILED(hr))

src/move.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,22 +2486,27 @@ onepage(int dir, long count)
24862486
beginline(BL_SOL | BL_FIX);
24872487
curwin->w_valid &= ~(VALID_WCOL|VALID_WROW|VALID_VIRTCOL);
24882488

2489-
/*
2490-
* Avoid the screen jumping up and down when 'scrolloff' is non-zero.
2491-
* But make sure we scroll at least one line (happens with mix of long
2492-
* wrapping lines and non-wrapping line).
2493-
*/
2494-
if (retval == OK && dir == FORWARD && check_top_offset())
2489+
if (retval == OK && dir == FORWARD)
24952490
{
2496-
scroll_cursor_top(1, FALSE);
2497-
if (curwin->w_topline <= old_topline
2498-
&& old_topline < curbuf->b_ml.ml_line_count)
2491+
// Avoid the screen jumping up and down when 'scrolloff' is non-zero.
2492+
// But make sure we scroll at least one line (happens with mix of long
2493+
// wrapping lines and non-wrapping line).
2494+
if (check_top_offset())
24992495
{
2500-
curwin->w_topline = old_topline + 1;
2496+
scroll_cursor_top(1, FALSE);
2497+
if (curwin->w_topline <= old_topline
2498+
&& old_topline < curbuf->b_ml.ml_line_count)
2499+
{
2500+
curwin->w_topline = old_topline + 1;
25012501
#ifdef FEAT_FOLDING
2502-
(void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL);
2502+
(void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL);
25032503
#endif
2504+
}
25042505
}
2506+
#ifdef FEAT_FOLDING
2507+
else if (curwin->w_botline > curbuf->b_ml.ml_line_count)
2508+
(void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL);
2509+
#endif
25052510
}
25062511

25072512
redraw_later(VALID);

src/term.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,7 @@ parse_builtin_tcap(char_u *term)
14891489
if (term_7to8bit(t))
14901490
{
14911491
*t = term_7to8bit(t);
1492-
STRCPY(t + 1, t + 2);
1492+
STRMOVE(t + 1, t + 2);
14931493
}
14941494
term_strings[p->bt_entry] = s;
14951495
set_term_option_alloced(&term_strings[p->bt_entry]);

src/testdir/test_fold.vim

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
" Test for folding
22

3+
source view_util.vim
4+
35
func PrepIndent(arg)
46
return [a:arg] + repeat(["\t".a:arg], 5)
57
endfu
@@ -648,3 +650,27 @@ func Test_foldopen_exception()
648650
endtry
649651
call assert_match('E492:', a)
650652
endfunc
653+
654+
func Test_fold_last_line_with_pagedown()
655+
enew!
656+
set fdm=manual
657+
658+
let expect = '+-- 11 lines: 9---'
659+
let content = range(1,19)
660+
call append(0, content)
661+
normal dd9G
662+
normal zfG
663+
normal zt
664+
call assert_equal('9', getline(foldclosed('.')))
665+
call assert_equal('19', getline(foldclosedend('.')))
666+
call assert_equal(expect, ScreenLines(1, len(expect))[0])
667+
call feedkeys("\<C-F>", 'xt')
668+
call assert_equal(expect, ScreenLines(1, len(expect))[0])
669+
call feedkeys("\<C-F>", 'xt')
670+
call assert_equal(expect, ScreenLines(1, len(expect))[0])
671+
call feedkeys("\<C-B>\<C-F>\<C-F>", 'xt')
672+
call assert_equal(expect, ScreenLines(1, len(expect))[0])
673+
674+
set fdm&
675+
enew!
676+
endfunc

src/testdir/test_marks.vim

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,12 @@ func Test_marks_cmd_multibyte()
126126
return
127127
endif
128128
new Xone
129-
call setline(1, ['ááááááááááááááááááááááááááááááááááááááááááááááááááááááááááááááááááááááááááááááááá'])
129+
call setline(1, [repeat('á', &columns)])
130130
norm! ma
131131

132132
let a = split(execute('marks a'), "\n")
133133
call assert_equal(2, len(a))
134-
let expected = ' a 1 0 '
135-
while strwidth(expected) < &columns - 1
136-
let expected .= 'á'
137-
endwhile
134+
let expected = ' a 1 0 ' . repeat('á', &columns - 16)
138135
call assert_equal(expected, a[1])
139136

140137
bwipe!

src/userfunc.c

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
#include "vim.h"
1515

1616
#if defined(FEAT_EVAL) || defined(PROTO)
17-
/* function flags */
18-
#define FC_ABORT 0x01 /* abort function on error */
19-
#define FC_RANGE 0x02 /* function accepts range */
20-
#define FC_DICT 0x04 /* Dict function, uses "self" */
21-
#define FC_CLOSURE 0x08 /* closure, uses outer scope variables */
22-
#define FC_DELETED 0x10 /* :delfunction used while uf_refcount > 0 */
23-
#define FC_REMOVED 0x20 /* function redefined while uf_refcount > 0 */
17+
// flags used in uf_flags
18+
#define FC_ABORT 0x01 // abort function on error
19+
#define FC_RANGE 0x02 // function accepts range
20+
#define FC_DICT 0x04 // Dict function, uses "self"
21+
#define FC_CLOSURE 0x08 // closure, uses outer scope variables
22+
#define FC_DELETED 0x10 // :delfunction used while uf_refcount > 0
23+
#define FC_REMOVED 0x20 // function redefined while uf_refcount > 0
24+
#define FC_SANDBOX 0x40 // function defined in the sandbox
2425

2526
/* From user function to hashitem and back. */
2627
#define UF2HIKEY(fp) ((fp)->uf_name)
@@ -296,6 +297,8 @@ get_lambda_tv(char_u **arg, typval_T *rettv, int evaluate)
296297
if (prof_def_func())
297298
func_do_profile(fp);
298299
#endif
300+
if (sandbox)
301+
flags |= FC_SANDBOX;
299302
fp->uf_varargs = TRUE;
300303
fp->uf_flags = flags;
301304
fp->uf_calls = 0;
@@ -688,6 +691,7 @@ call_user_func(
688691
char_u *save_sourcing_name;
689692
linenr_T save_sourcing_lnum;
690693
scid_T save_current_SID;
694+
int using_sandbox = FALSE;
691695
funccall_T *fc;
692696
int save_did_emsg;
693697
static int depth = 0;
@@ -854,6 +858,13 @@ call_user_func(
854858
save_sourcing_name = sourcing_name;
855859
save_sourcing_lnum = sourcing_lnum;
856860
sourcing_lnum = 1;
861+
862+
if (fp->uf_flags & FC_SANDBOX)
863+
{
864+
using_sandbox = TRUE;
865+
++sandbox;
866+
}
867+
857868
/* need space for function name + ("function " + 3) or "[number]" */
858869
len = (save_sourcing_name == NULL ? 0 : STRLEN(save_sourcing_name))
859870
+ STRLEN(fp->uf_name) + 20;
@@ -1020,6 +1031,8 @@ call_user_func(
10201031
if (do_profiling == PROF_YES)
10211032
script_prof_restore(&wait_start);
10221033
#endif
1034+
if (using_sandbox)
1035+
--sandbox;
10231036

10241037
if (p_verbose >= 12 && sourcing_name != NULL)
10251038
{
@@ -2429,6 +2442,8 @@ ex_function(exarg_T *eap)
24292442
func_do_profile(fp);
24302443
#endif
24312444
fp->uf_varargs = varargs;
2445+
if (sandbox)
2446+
flags |= FC_SANDBOX;
24322447
fp->uf_flags = flags;
24332448
fp->uf_calls = 0;
24342449
fp->uf_script_ID = current_SID;

src/version.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,16 @@ static char *(features[]) =
804804

805805
static int included_patches[] =
806806
{ /* Add new patch number below this line */
807+
/**/
808+
178,
809+
/**/
810+
177,
811+
/**/
812+
176,
813+
/**/
814+
175,
815+
/**/
816+
174,
807817
/**/
808818
173,
809819
/**/

0 commit comments

Comments
 (0)