Skip to content

Commit 9b6331e

Browse files
committed
Merge pull request #163 from chdiza/master
Merge remote-tracking branch 'vim/master'
2 parents f3b74dd + c2a7d0f commit 9b6331e

19 files changed

Lines changed: 144 additions & 38 deletions

runtime/doc/eval.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5803,6 +5803,10 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702*
58035803
strtod() function to parse numbers, Strings, Lists, Dicts and
58045804
Funcrefs will be considered as being 0).
58055805

5806+
When {func} is given and it is 'N' then all items will be
5807+
sorted numerical. This is like 'n' but a string containing
5808+
digits will be used as the number they represent.
5809+
58065810
When {func} is a |Funcref| or a function name, this function
58075811
is called to compare items. The function is invoked with two
58085812
items as argument and must return zero if they are equal, 1 or
@@ -5817,6 +5821,11 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702*
58175821
on numbers, text strings will sort next to each other, in the
58185822
same order as they were originally.
58195823

5824+
The sort is stable, items which compare equal (as number or as
5825+
string) will keep their relative position. E.g., when sorting
5826+
on numbers, text strings will sort next to each other, in the
5827+
same order as they were originally.
5828+
58205829
Also see |uniq()|.
58215830

58225831
Example: >

src/eval.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,7 @@ eval_init()
900900
set_vim_var_nr(VV_SEARCHFORWARD, 1L);
901901
set_vim_var_nr(VV_HLSEARCH, 1L);
902902
set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc());
903+
set_vim_var_list(VV_ERRORS, list_alloc());
903904
set_reg_var(0); /* default for v:register is not 0 but '"' */
904905

905906
#ifdef EBCDIC
@@ -8749,7 +8750,9 @@ call_func(funcname, len, rettv, argcount, argvars, firstline, lastline,
87498750
* redo buffer.
87508751
*/
87518752
save_search_patterns();
8753+
#ifdef FEAT_INS_EXPAND
87528754
if (!ins_compl_active())
8755+
#endif
87538756
{
87548757
saveRedobuff();
87558758
did_save_redo = TRUE;
@@ -17953,6 +17956,7 @@ typedef struct
1795317956

1795417957
static int item_compare_ic;
1795517958
static int item_compare_numeric;
17959+
static int item_compare_numbers;
1795617960
static char_u *item_compare_func;
1795717961
static dict_T *item_compare_selfdict;
1795817962
static int item_compare_func_err;
@@ -17983,6 +17987,15 @@ item_compare(s1, s2)
1798317987
si2 = (sortItem_T *)s2;
1798417988
tv1 = &si1->item->li_tv;
1798517989
tv2 = &si2->item->li_tv;
17990+
17991+
if (item_compare_numbers)
17992+
{
17993+
long v1 = get_tv_number(tv1);
17994+
long v2 = get_tv_number(tv2);
17995+
17996+
return v1 == v2 ? 0 : v1 > v2 ? 1 : -1;
17997+
}
17998+
1798617999
/* tv2string() puts quotes around a string and allocates memory. Don't do
1798718000
* that for string variables. Use a single quote when comparing with a
1798818001
* non-string to do what the docs promise. */
@@ -18116,6 +18129,7 @@ do_sort_uniq(argvars, rettv, sort)
1811618129

1811718130
item_compare_ic = FALSE;
1811818131
item_compare_numeric = FALSE;
18132+
item_compare_numbers = FALSE;
1811918133
item_compare_func = NULL;
1812018134
item_compare_selfdict = NULL;
1812118135
if (argvars[1].v_type != VAR_UNKNOWN)
@@ -18141,6 +18155,11 @@ do_sort_uniq(argvars, rettv, sort)
1814118155
item_compare_func = NULL;
1814218156
item_compare_numeric = TRUE;
1814318157
}
18158+
else if (STRCMP(item_compare_func, "N") == 0)
18159+
{
18160+
item_compare_func = NULL;
18161+
item_compare_numbers = TRUE;
18162+
}
1814418163
else if (STRCMP(item_compare_func, "i") == 0)
1814518164
{
1814618165
item_compare_func = NULL;

src/fileio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9488,7 +9488,9 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap)
94889488
if (!autocmd_busy)
94899489
{
94909490
save_search_patterns();
9491+
#ifdef FEAT_INS_EXPAND
94919492
if (!ins_compl_active())
9493+
#endif
94929494
{
94939495
saveRedobuff();
94949496
did_save_redobuff = TRUE;

src/screen.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5427,7 +5427,12 @@ win_line(wp, lnum, startrow, endrow, nochange)
54275427
else
54285428
/* DBCS: Put second byte in the second screen char. */
54295429
ScreenLines[off] = mb_c & 0xff;
5430-
++vcol;
5430+
if (draw_state > WL_NR
5431+
#ifdef FEAT_DIFF
5432+
&& filler_todo <= 0
5433+
#endif
5434+
)
5435+
++vcol;
54315436
/* When "tocol" is halfway a character, set it to the end of
54325437
* the character, otherwise highlighting won't stop. */
54335438
if (tocol == vcol)

src/testdir/Make_amiga.mak

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
3434
test81.out test82.out test83.out test84.out test88.out \
3535
test89.out test90.out test91.out test92.out test93.out \
3636
test94.out test95.out test96.out test97.out test98.out \
37-
test99.out test100.out test101.out test102.out test103.out \
37+
test99.out test101.out test102.out test103.out \
3838
test104.out test105.out test106.out test107.out \
3939
test_argument_0count.out \
4040
test_argument_count.out \
@@ -185,7 +185,6 @@ test96.out: test96.in
185185
test97.out: test97.in
186186
test98.out: test98.in
187187
test99.out: test99.in
188-
test100.out: test100.in
189188
test101.out: test101.in
190189
test102.out: test102.in
191190
test103.out: test103.in

src/testdir/Make_dos.mak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
3333
test84.out test85.out test86.out test87.out test88.out \
3434
test89.out test90.out test91.out test92.out test93.out \
3535
test94.out test95.out test96.out test98.out test99.out \
36-
test100.out test101.out test102.out test103.out test104.out \
36+
test101.out test102.out test103.out test104.out \
3737
test105.out test106.out test107.out\
3838
test_argument_0count.out \
3939
test_argument_count.out \

src/testdir/Make_ming.mak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
5555
test84.out test85.out test86.out test87.out test88.out \
5656
test89.out test90.out test91.out test92.out test93.out \
5757
test94.out test95.out test96.out test98.out test99.out \
58-
test100.out test101.out test102.out test103.out test104.out \
58+
test101.out test102.out test103.out test104.out \
5959
test105.out test106.out test107.out \
6060
test_argument_0count.out \
6161
test_argument_count.out \

src/testdir/Make_os2.mak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
3535
test81.out test82.out test83.out test84.out test88.out \
3636
test89.out test90.out test91.out test92.out test93.out \
3737
test94.out test95.out test96.out test98.out test99.out \
38-
test100.out test101.out test102.out test103.out test104.out \
38+
test101.out test102.out test103.out test104.out \
3939
test105.out test106.out test107.out \
4040
test_argument_0count.out \
4141
test_argument_count.out \

src/testdir/Make_vms.mms

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Authors: Zoltan Arpadffy, <[email protected]>
55
# Sandor Kopanyi, <[email protected]>
66
#
7-
# Last change: 2015 Sep 08
7+
# Last change: 2015 Dec 03
88
#
99
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
1010
# Edit the lines in the Configuration section below to select.
@@ -94,7 +94,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
9494
test82.out test84.out test88.out test89.out \
9595
test90.out test91.out test92.out test93.out test94.out \
9696
test95.out test96.out test98.out test99.out \
97-
test100.out test101.out test103.out test104.out \
97+
test101.out test103.out test104.out \
9898
test105.out test106.out test107.out \
9999
test_argument_0count.out \
100100
test_argument_count.out \

src/testdir/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
3131
test84.out test85.out test86.out test87.out test88.out \
3232
test89.out test90.out test91.out test92.out test93.out \
3333
test94.out test95.out test96.out test97.out test98.out \
34-
test99.out test100.out test101.out test102.out test103.out \
34+
test99.out test101.out test102.out test103.out \
3535
test104.out test105.out test106.out test107.out \
3636
test_argument_0count.out \
3737
test_argument_count.out \
@@ -69,7 +69,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
6969
test_writefile.out
7070

7171
NEW_TESTS = test_assert.res \
72-
test_undolevels.res
72+
test_alot.res
7373

7474
SCRIPTS_GUI = test16.out
7575

0 commit comments

Comments
 (0)