Skip to content

Commit 41d097c

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 7151602 + 5c6dbcb commit 41d097c

33 files changed

Lines changed: 852 additions & 600 deletions

runtime/doc/eval.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,6 +1902,26 @@ v:termresponse The escape sequence returned by the terminal for the |t_RV|
19021902
always 95 or bigger). Pc is always zero.
19031903
{only when compiled with |+termresponse| feature}
19041904

1905+
*v:termblinkresp*
1906+
v:termblinkresp The escape sequence returned by the terminal for the |t_RC|
1907+
termcap entry. This is used to find out whether the terminal
1908+
cursor is blinking. This is used by |term_getcursor()|.
1909+
1910+
*v:termstyleresp*
1911+
v:termstyleresp The escape sequence returned by the terminal for the |t_RS|
1912+
termcap entry. This is used to find out what the shape of the
1913+
cursor is. This is used by |term_getcursor()|.
1914+
1915+
*v:termrgbresp*
1916+
v:termrgbresp The escape sequence returned by the terminal for the |t_RB|
1917+
termcap entry. This is used to find out what the terminal
1918+
background color is, see 'background'.
1919+
1920+
*v:termu7resp*
1921+
v:termu7resp The escape sequence returned by the terminal for the |t_u7|
1922+
termcap entry. This is used to find out what the terminal
1923+
does with ambiguous width characters, see 'ambiwidth'.
1924+
19051925
*v:testing* *testing-variable*
19061926
v:testing Must be set before using `test_garbagecollect_now()`.
19071927
Also, when set certain error messages won't be shown for 2
@@ -4612,6 +4632,9 @@ getqflist([{what}]) *getqflist()*
46124632
returns only the items listed in {what} as a dictionary. The
46134633
following string items are supported in {what}:
46144634
context get the context stored with |setqflist()|
4635+
id get information for the quickfix list with
4636+
|quickfix-ID|; zero means the id for the
4637+
current list or the list specifed by 'nr'
46154638
items quickfix list entries
46164639
nr get information for this quickfix list; zero
46174640
means the current quickfix list and '$' means
@@ -4626,6 +4649,8 @@ getqflist([{what}]) *getqflist()*
46264649
all all of the above quickfix properties
46274650
Non-string items in {what} are ignored.
46284651
If "nr" is not present then the current quickfix list is used.
4652+
If both "nr" and a non-zero "id" are specified, then the list
4653+
specified by "id" is used.
46294654
To get the number of lists in the quickfix stack, set 'nr' to
46304655
'$' in {what}. The 'nr' value in the returned dictionary
46314656
contains the quickfix stack size.
@@ -4637,6 +4662,7 @@ getqflist([{what}]) *getqflist()*
46374662

46384663
The returned dictionary contains the following entries:
46394664
context context information stored with |setqflist()|
4665+
id quickfix list ID |quickfix-ID|
46404666
items quickfix list entries
46414667
nr quickfix list number
46424668
title quickfix list title text
@@ -7049,6 +7075,7 @@ setqflist({list} [, {action}[, {what}]]) *setqflist()*
70497075
text and add the resulting entries to the
70507076
quickfix list {nr}. The value can be a string
70517077
with one line or a list with multiple lines.
7078+
id quickfix list identifier |quickfix-ID|
70527079
items list of quickfix entries. Same as the {list}
70537080
argument.
70547081
nr list number in the quickfix stack; zero
@@ -7059,6 +7086,9 @@ setqflist({list} [, {action}[, {what}]]) *setqflist()*
70597086
If the "nr" item is not present, then the current quickfix list
70607087
is modified. When creating a new quickfix list, "nr" can be
70617088
set to a value one greater than the quickfix stack size.
7089+
When modifying a quickfix list, to guarantee that the correct
7090+
list is modified, 'id' should be used instead of 'nr' to
7091+
specify the list.
70627092

70637093
Examples: >
70647094
:call setqflist([], 'r', {'title': 'My search'})

runtime/doc/mbyte.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,9 @@ Use the RPM or port for your system.
832832

833833
Currently, GUI Vim supports three styles, |OverTheSpot|, |OffTheSpot| and
834834
|Root|.
835+
When compiled with |+GUI_GTK| feature, GUI Vim supports two styles,
836+
|OnTheSpot| and |OverTheSpot|. You can select the style with the 'imstyle'
837+
option.
835838

836839
*. on-the-spot *OnTheSpot*
837840
Preedit Area and Status Area are performed by the client application in

runtime/doc/options.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4480,6 +4480,23 @@ A jump table for the options with a short description can be found at |Q_op|.
44804480
<
44814481
NOTE: This function is invoked very often. Keep it fast.
44824482

4483+
*'imstyle'* *'imst'*
4484+
'imstyle' 'imst' number (default 1)
4485+
global
4486+
{not in Vi}
4487+
{only available when compiled with |+xim| and
4488+
|+GUI_GTK|}
4489+
This option specifies the input style of Input Method.
4490+
Set to zero if you want to use on-the-spot style.
4491+
Set to one if you want to use over-the-spot style.
4492+
See: |xim-input-style|
4493+
4494+
For a long time on-the-spot sytle had been used in GTK version of vim,
4495+
however, it is known that it causes troubles when using mappings,
4496+
|single-repeat|, etc. Therefore over-the-spot style becomes the
4497+
default now. This should work fine for most people, however if you
4498+
have any problem with it, try using on-the-spot style.
4499+
44834500
*'include'* *'inc'*
44844501
'include' 'inc' string (default "^\s*#\s*include")
44854502
global or local to buffer |global-local|

src/Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,17 +2117,17 @@ test1 \
21172117
test_listchars \
21182118
test_search_mbyte \
21192119
test_wordcount \
2120-
test3 test4 test5 test6 test7 test8 test9 \
2121-
test11 test12 test14 test15 test17 test18 test19 \
2122-
test20 test21 test22 test25 test27 test28 test29 \
2120+
test3 test4 test5 test7 test8 \
2121+
test11 test12 test14 test15 test17 test19 \
2122+
test20 test25 test28 test29 \
21232123
test30 test31 test32 test33 test34 test36 test37 test38 test39 \
21242124
test40 test41 test42 test43 test44 test45 test48 test49 \
2125-
test50 test51 test52 test53 test54 test55 test56 test57 test59 \
2125+
test50 test52 test53 test54 test55 test56 test57 test59 \
21262126
test60 test64 test66 test68 test69 \
2127-
test70 test72 test73 test74 test77 test78 test79 \
2128-
test80 test83 test84 test85 test86 test87 test88 \
2129-
test91 test94 test95 test98 test99 \
2130-
test100 test101 test103 test104 test107 test108:
2127+
test70 test72 test73 test77 test78 test79 \
2128+
test83 test85 test86 test87 test88 \
2129+
test94 test95 test99 \
2130+
test108:
21312131
cd testdir; rm -f [email protected]; $(MAKE) -f Makefile [email protected] VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
21322132

21332133
# Run individual NEW style test, assuming that Vim was already compiled.

src/edit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9716,7 +9716,7 @@ ins_left(
97169716
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
97179717
/* Only call start_arrow() when not busy with preediting, it will
97189718
* break undo. K_LEFT is inserted in im_correct_cursor(). */
9719-
if (!im_is_preediting())
9719+
if (p_imst == IM_OVER_THE_SPOT || !im_is_preediting())
97209720
#endif
97219721
{
97229722
start_arrow_with_change(&tpos, end_change);

src/eval.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ static struct vimvar
187187
{VV_NAME("t_none", VAR_NUMBER), VV_RO},
188188
{VV_NAME("t_job", VAR_NUMBER), VV_RO},
189189
{VV_NAME("t_channel", VAR_NUMBER), VV_RO},
190+
{VV_NAME("termrgbresp", VAR_STRING), VV_RO},
191+
{VV_NAME("termu7resp", VAR_STRING), VV_RO},
192+
{VV_NAME("termstyleresp", VAR_STRING), VV_RO},
193+
{VV_NAME("termblinkresp", VAR_STRING), VV_RO},
190194
};
191195

192196
/* shorthand */

src/ex_docmd.c

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11126,7 +11126,7 @@ static int ses_do_frame(frame_T *fr);
1112611126
static int ses_do_win(win_T *wp);
1112711127
static int ses_arglist(FILE *fd, char *cmd, garray_T *gap, int fullname, unsigned *flagp);
1112811128
static int ses_put_fname(FILE *fd, char_u *name, unsigned *flagp);
11129-
static int ses_fname(FILE *fd, buf_T *buf, unsigned *flagp);
11129+
static int ses_fname(FILE *fd, buf_T *buf, unsigned *flagp, int add_eol);
1113011130

1113111131
/*
1113211132
* Write openfile commands for the current buffers to an .exrc file.
@@ -11222,7 +11222,7 @@ makeopens(
1122211222
{
1122311223
if (fprintf(fd, "badd +%ld ", buf->b_wininfo == NULL ? 1L
1122411224
: buf->b_wininfo->wi_fpos.lnum) < 0
11225-
|| ses_fname(fd, buf, &ssop_flags) == FAIL)
11225+
|| ses_fname(fd, buf, &ssop_flags, TRUE) == FAIL)
1122611226
return FAIL;
1122711227
}
1122811228
}
@@ -11324,7 +11324,8 @@ makeopens(
1132411324
)
1132511325
{
1132611326
if (fputs(need_tabnew ? "tabedit " : "edit ", fd) < 0
11327-
|| ses_fname(fd, wp->w_buffer, &ssop_flags) == FAIL)
11327+
|| ses_fname(fd, wp->w_buffer, &ssop_flags, TRUE)
11328+
== FAIL)
1132811329
return FAIL;
1132911330
need_tabnew = FALSE;
1133011331
if (!wp->w_arg_idx_invalid)
@@ -11671,9 +11672,20 @@ put_view(
1167111672
/*
1167211673
* Editing a file in this buffer: use ":edit file".
1167311674
* This may have side effects! (e.g., compressed or network file).
11675+
*
11676+
* Note, if a buffer for that file already exists, use :badd to
11677+
* edit that buffer, to not lose folding information (:edit resets
11678+
* folds in other buffers)
1167411679
*/
11675-
if (fputs("edit ", fd) < 0
11676-
|| ses_fname(fd, wp->w_buffer, flagp) == FAIL)
11680+
if (fputs("if bufexists('", fd) < 0
11681+
|| ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL
11682+
|| fputs("') | buffer ", fd) < 0
11683+
|| ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL
11684+
|| fputs(" | else | edit ", fd) < 0
11685+
|| ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL
11686+
|| fputs(" | endif", fd) < 0
11687+
||
11688+
put_eol(fd) == FAIL)
1167711689
return FAIL;
1167811690
}
1167911691
else
@@ -11686,7 +11698,7 @@ put_view(
1168611698
{
1168711699
/* The buffer does have a name, but it's not a file name. */
1168811700
if (fputs("file ", fd) < 0
11689-
|| ses_fname(fd, wp->w_buffer, flagp) == FAIL)
11701+
|| ses_fname(fd, wp->w_buffer, flagp, TRUE) == FAIL)
1169011702
return FAIL;
1169111703
}
1169211704
#endif
@@ -11858,11 +11870,11 @@ ses_arglist(
1185811870

1185911871
/*
1186011872
* Write a buffer name to the session file.
11861-
* Also ends the line.
11873+
* Also ends the line, if "add_eol" is TRUE.
1186211874
* Returns FAIL if writing fails.
1186311875
*/
1186411876
static int
11865-
ses_fname(FILE *fd, buf_T *buf, unsigned *flagp)
11877+
ses_fname(FILE *fd, buf_T *buf, unsigned *flagp, int add_eol)
1186611878
{
1186711879
char_u *name;
1186811880

@@ -11881,7 +11893,8 @@ ses_fname(FILE *fd, buf_T *buf, unsigned *flagp)
1188111893
name = buf->b_sfname;
1188211894
else
1188311895
name = buf->b_ffname;
11884-
if (ses_put_fname(fd, name, flagp) == FAIL || put_eol(fd) == FAIL)
11896+
if (ses_put_fname(fd, name, flagp) == FAIL
11897+
|| (add_eol && put_eol(fd) == FAIL))
1188511898
return FAIL;
1188611899
return OK;
1188711900
}

src/ex_getln.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3479,7 +3479,8 @@ cursorcmd(void)
34793479

34803480
windgoto(msg_row, msg_col);
34813481
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
3482-
redrawcmd_preedit();
3482+
if (p_imst == IM_ON_THE_SPOT)
3483+
redrawcmd_preedit();
34833484
#endif
34843485
#ifdef MCH_CURSOR_SHAPE
34853486
mch_update_cursor();

src/getchar.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static int vgetorpeek(int);
125125
static void map_free(mapblock_T **);
126126
static void validate_maphash(void);
127127
static void showmap(mapblock_T *mp, int local);
128-
static int inchar(char_u *buf, int maxlen, long wait_time, int tb_change_cnt);
128+
static int inchar(char_u *buf, int maxlen, long wait_time);
129129
#ifdef FEAT_EVAL
130130
static char_u *eval_map_expr(char_u *str, int c);
131131
#endif
@@ -462,8 +462,7 @@ flush_buffers(int flush_typeahead)
462462
* of an escape sequence.
463463
* In an xterm we get one char at a time and we have to get them all.
464464
*/
465-
while (inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 10L,
466-
typebuf.tb_change_cnt) != 0)
465+
while (inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 10L) != 0)
467466
;
468467
typebuf.tb_off = MAXMAPLEN;
469468
typebuf.tb_len = 0;
@@ -2046,8 +2045,7 @@ vgetorpeek(int advance)
20462045
if (got_int)
20472046
{
20482047
/* flush all input */
2049-
c = inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 0L,
2050-
typebuf.tb_change_cnt);
2048+
c = inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 0L);
20512049
/*
20522050
* If inchar() returns TRUE (script file was active) or we
20532051
* are inside a mapping, get out of insert mode.
@@ -2610,8 +2608,7 @@ vgetorpeek(int advance)
26102608
&& (p_timeout
26112609
|| (keylen == KEYLEN_PART_KEY && p_ttimeout))
26122610
&& (c = inchar(typebuf.tb_buf + typebuf.tb_off
2613-
+ typebuf.tb_len, 3, 25L,
2614-
typebuf.tb_change_cnt)) == 0)
2611+
+ typebuf.tb_len, 3, 25L)) == 0)
26152612
{
26162613
colnr_T col = 0, vcol;
26172614
char_u *ptr;
@@ -2848,7 +2845,7 @@ vgetorpeek(int advance)
28482845
? -1L
28492846
: ((keylen == KEYLEN_PART_KEY && p_ttm >= 0)
28502847
? p_ttm
2851-
: p_tm)), typebuf.tb_change_cnt);
2848+
: p_tm)));
28522849

28532850
#ifdef FEAT_CMDL_INFO
28542851
if (i != 0)
@@ -2954,12 +2951,12 @@ vgetorpeek(int advance)
29542951
inchar(
29552952
char_u *buf,
29562953
int maxlen,
2957-
long wait_time, /* milli seconds */
2958-
int tb_change_cnt)
2954+
long wait_time) /* milli seconds */
29592955
{
29602956
int len = 0; /* init for GCC */
29612957
int retesc = FALSE; /* return ESC with gotint */
29622958
int script_char;
2959+
int tb_change_cnt = typebuf.tb_change_cnt;
29632960

29642961
if (wait_time == -1L || wait_time > 100L) /* flush output before waiting */
29652962
{
@@ -3065,9 +3062,17 @@ inchar(
30653062
len = ui_inchar(buf, maxlen / 3, wait_time, tb_change_cnt);
30663063
}
30673064

3065+
/* If the typebuf was changed further down, it is like nothing was added by
3066+
* this call. */
30683067
if (typebuf_changed(tb_change_cnt))
30693068
return 0;
30703069

3070+
/* Note the change in the typeahead buffer, this matters for when
3071+
* vgetorpeek() is called recursively, e.g. using getchar(1) in a timer
3072+
* function. */
3073+
if (len > 0 && ++typebuf.tb_change_cnt == 0)
3074+
typebuf.tb_change_cnt = 1;
3075+
30713076
return fix_input_buffer(buf, len);
30723077
}
30733078

0 commit comments

Comments
 (0)