Mercurial > vim
annotate src/proto/screen.pro @ 33399:95db67c7b754 v9.0.1958
patch 9.0.1958: cannot complete option values
Commit: https://github.com/vim/vim/commit/900894b09a95398dfc75599e9f0aa2ea25723384
Author: Yee Cheng Chin <ychin.git@gmail.com>
Date: Fri Sep 29 20:42:32 2023 +0200
patch 9.0.1958: cannot complete option values
Problem: cannot complete option values
Solution: Add completion functions for several options
Add cmdline tab-completion for setting string options
Add tab-completion for setting string options on the cmdline using
`:set=` (along with `:set+=` and `:set-=`).
The existing tab completion for setting options currently only works
when nothing is typed yet, and it only fills in with the existing value,
e.g. when the user does `:set diffopt=<Tab>` it will be completed to
`set diffopt=internal,filler,closeoff` and nothing else. This isn't too
useful as a user usually wants auto-complete to suggest all the possible
values, such as 'iblank', or 'algorithm:patience'.
For set= and set+=, this adds a new optional callback function for each
option that can be invoked when doing completion. This allows for each
option to have control over how completion works. For example, in
'diffopt', it will suggest the default enumeration, but if `algorithm:`
is selected, it will further suggest different algorithm types like
'meyers' and 'patience'. When using set=, the existing option value will
be filled in as the first choice to preserve the existing behavior. When
using set+= this won't happen as it doesn't make sense.
For flag list options (e.g. 'mouse' and 'guioptions'), completion will
take into account existing typed values (and in the case of set+=, the
existing option value) to make sure it doesn't suggest duplicates.
For set-=, there is a new `ExpandSettingSubtract` function which will
handle flag list and comma-separated options smartly, by only suggesting
values that currently exist in the option.
Note that Vim has some existing code that adds special handling for
'filetype', 'syntax', and misc dir options like 'backupdir'. This change
preserves them as they already work, instead of converting to the new
callback API for each option.
closes: #13182
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 29 Sep 2023 20:45:04 +0200 |
parents | 32acf287a9ae |
children | 19cdfe768104 |
rev | line source |
---|---|
7 | 1 /* screen.c */ |
7668
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
2 int conceal_cursor_line(win_T *wp); |
25074
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24043
diff
changeset
|
3 void conceal_check_cursor_line(int was_concealed); |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17034
diff
changeset
|
4 int get_wcr_attr(win_T *wp); |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
5 void win_draw_end(win_T *wp, int c1, int c2, int draw_margin, int row, int endrow, hlf_T hl); |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
6 int compute_foldcolumn(win_T *wp, int col); |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
7 size_t fill_foldcolumn(char_u *p, win_T *wp, int closed, linenr_T lnum); |
11670
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11416
diff
changeset
|
8 int screen_get_current_line_off(void); |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
9 void reset_screen_attr(void); |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29310
diff
changeset
|
10 void screen_line(win_T *wp, int row, int coloff, int endcol, int clear_width, int flags); |
7668
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
11 void rl_mirror(char_u *str); |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
12 void draw_vsep_win(win_T *wp, int row); |
7668
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
13 int stl_connected(win_T *wp); |
9645
123d3c102035
commit https://github.com/vim/vim/commit/73ac0c4281a3606651604a3cbcc334bfb3859a87
Christian Brabandt <cb@256bit.org>
parents:
8817
diff
changeset
|
14 int get_keymap_str(win_T *wp, char_u *fmt, char_u *buf, int len); |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
15 void win_redr_custom(win_T *wp, int draw_ruler); |
7668
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
16 void screen_putchar(int c, int row, int col, int attr); |
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
17 void screen_getbytes(int row, int col, char_u *bytes, int *attrp); |
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
18 void screen_puts(char_u *text, int row, int col, int attr); |
29310
f103da6ba95f
patch 8.2.5171: dependencies and proto files are outdated
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
19 void screen_puts_len(char_u *text, int textlen, int row, int col, int attr_arg); |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
20 void start_search_hl(void); |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
21 void end_search_hl(void); |
7668
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
22 void screen_stop_highlight(void); |
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
23 void reset_cterm_colors(void); |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
24 void screen_char(unsigned off, int row, int col); |
7668
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
25 void screen_draw_rectangle(int row, int col, int height, int width, int invert); |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
26 void space_to_screenline(int off, int attr); |
7668
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
27 void screen_fill(int start_row, int end_row, int start_col, int end_col, int c1, int c2, int attr); |
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
28 void check_for_delay(int check_msg_scroll); |
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
29 int screen_valid(int doclear); |
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
30 void screenalloc(int doclear); |
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
31 void free_screenlines(void); |
30513
ea15dfc9c155
patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents:
29958
diff
changeset
|
32 int screenclear(void); |
29958
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29672
diff
changeset
|
33 void redraw_as_cleared(void); |
21226
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
18124
diff
changeset
|
34 void line_was_clobbered(int screen_lnum); |
7668
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
35 int can_clear(char_u *p); |
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
36 void screen_start(void); |
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
37 void windgoto(int row, int col); |
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
38 void setcursor(void); |
13400
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
39 void setcursor_mayforce(int force); |
7668
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
40 int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear); |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
11670
diff
changeset
|
41 int win_del_lines(win_T *wp, int row, int line_count, int invalid, int mayclear, int clear_attr); |
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
11670
diff
changeset
|
42 int screen_ins_lines(int off, int row, int line_count, int end, int clear_attr, win_T *wp); |
12244
d0b039e2ed56
patch 8.0.1002: unnecessarily updating screen after timer callback
Christian Brabandt <cb@256bit.org>
parents:
12152
diff
changeset
|
43 int screen_del_lines(int off, int row, int line_count, int end, int force, int clear_attr, win_T *wp); |
15629
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15436
diff
changeset
|
44 int skip_showmode(void); |
7668
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
45 int showmode(void); |
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
46 void unshowmode(int force); |
8817
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8577
diff
changeset
|
47 void clearmode(void); |
15396
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
14720
diff
changeset
|
48 void draw_tabline(void); |
7668
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
49 void get_trans_bufname(buf_T *buf); |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
50 int fillchar_status(int *attr, win_T *wp); |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29310
diff
changeset
|
51 int fillchar_vsep(int *attr, win_T *wp); |
7668
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
52 int redrawing(void); |
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
53 int messaging(void); |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17055
diff
changeset
|
54 void comp_col(void); |
7668
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
55 int number_width(win_T *wp); |
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
56 int screen_screencol(void); |
21b0a39d13ed
commit https://github.com/vim/vim/commit/ef26954a35207c3f17d6ed35d9a40c918d974892
Christian Brabandt <cb@256bit.org>
parents:
6448
diff
changeset
|
57 int screen_screenrow(void); |
32076
32acf287a9ae
patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents:
31065
diff
changeset
|
58 char *set_fillchars_option(win_T *wp, char_u *val, int apply); |
32acf287a9ae
patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents:
31065
diff
changeset
|
59 char *set_listchars_option(win_T *wp, char_u *val, int apply); |
33399
95db67c7b754
patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents:
32076
diff
changeset
|
60 char_u * get_fillchars_name(expand_T *xp, int idx); |
95db67c7b754
patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents:
32076
diff
changeset
|
61 char_u * get_listchars_name(expand_T *xp, int idx); |
29672
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
62 char *check_chars_options(void); |
7 | 63 /* vim: set ft=c : */ |