Commit Graph

15815 Commits

Author SHA1 Message Date
Lewis Russell
8f2d3537b4 refactor(option.c): add do_set_option_value 2023-01-26 10:42:26 +00:00
Lewis Russell
0170219e92 refactor(option.c): move bool prefix check 2023-01-26 10:26:07 +00:00
Lewis Russell
c6907ea895 refactor(option.c): de-nest code in do_set_option 2023-01-26 10:02:01 +00:00
Lewis Russell
e49ae04caf refactor(option.c): factor out opt_idx validation 2023-01-26 10:02:00 +00:00
Lewis Russell
2c601787ab refactor(option.c): factor out option name parsing 2023-01-26 10:02:00 +00:00
Lewis Russell
9a9129c60b refactor(option.c): factor out option prefix parsing 2023-01-26 10:02:00 +00:00
Lewis Russell
0f3fa5a30a refactor(option.c): factor out set op parsing 2023-01-26 10:02:00 +00:00
Lewis Russell
25310af060 refactor(option.c): use skiptowhite_esc 2023-01-26 10:02:00 +00:00
Lewis Russell
334f538267 refactor(option.c): change nextchar to uint8_t 2023-01-26 10:02:00 +00:00
Lewis Russell
ef85238fde refactor(option.c): remove goto 2023-01-26 10:02:00 +00:00
Lewis Russell
a13e97ece5 refactor(option.c): int -> bool 2023-01-26 10:01:59 +00:00
Lewis Russell
bb1efa85aa refactor(option.c): reduce scope or startarg 2023-01-26 09:53:15 +00:00
Lewis Russell
b93bec68bc refactor(option.c): reduce scope or errbuf 2023-01-26 09:53:15 +00:00
Lewis Russell
3ae3e47d54 refactor(option.c): reduce scope or errmsg 2023-01-26 09:53:14 +00:00
Lewis Russell
e368560c80 refactor(option.c): factor out loop code from do_set() 2023-01-26 09:53:13 +00:00
Lewis Russell
18c37c616e refactor(option.c): factor out common skip check 2023-01-26 09:52:22 +00:00
Lewis Russell
9679d058d4 refactor(option.c): simplify do_set_string 2023-01-26 09:51:45 +00:00
Lewis Russell
ca1ad8977c refactor(option.c): add do_set_bool 2023-01-26 09:51:45 +00:00
Lewis Russell
37b44d1772 refactor(option.c): add do_set_num 2023-01-26 09:51:43 +00:00
zeertzjq
ebc80dcded vim-patch:9.0.1242: code for :runtime completion is not consistent
Problem:    Code for :runtime completion is not consistent.
Solution:   Make code for cmdline expansion more consistent. (closes vim/vim#11875)

b0d45ec67f
2023-01-26 11:55:34 +08:00
zeertzjq
f03f6263bb vim-patch:9.0.1238: :runtime completion can be further improved
Problem:    :runtime completion can be further improved.
Solution:   Also complete the {where} argument values and adjust the
            completion for that. (closes vim/vim#11874)

5c8771bc5a
2023-01-26 11:55:34 +08:00
zeertzjq
6320c91c50 vim-patch:9.0.1231: completion of :runtime does not handle {where} argument
Problem:    Completion of :runtime does not handle {where} argument.
Solution:   Parse the {where} argument. (closes vim/vim#11863)

3770f4c9cd
2023-01-26 11:55:34 +08:00
zeertzjq
6644786db0 vim-patch:9.0.1227: no cmdline completion for :runtime
Problem:    No cmdline completion for :runtime.
Solution:   Add completion for :runtime. (closes vim/vim#11853, closes vim/vim#11447)
            Improve the resulting matches.

a6759381a5
2023-01-26 11:55:32 +08:00
zeertzjq
5ac34cf55d refactor(intro): avoid Coverity warning (#22000)
refactor(intro): avoid coverity warning

Problem:    Coverity warns about overwriting "mesg" leaking memory.
Solution:   Make it clear that "mesg" will not be overwritten.
2023-01-26 09:30:26 +08:00
zeertzjq
116766f243 refactor(options): don't pass negative number to illegal_char() (#21999)
This only changes the error messages for an unexpected Unicode char in
an option to show its first byte instead of some special keycode.

The second argument of vim_strchr() usually doesn't matter, but it may
be better to consistently cast to uint8_t.
2023-01-26 09:12:33 +08:00
zeertzjq
88e906d165 vim-patch:9.0.1245: code is indented more than necessary (#21998)
Problem:    Code is indented more than necessary.
Solution:   Use an early return where it makes sense. (Yegappan Lakshmanan,
            closes vim/vim#11879)

032713f829

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-01-26 08:52:21 +08:00
zeertzjq
f15947866c vim-patch:9.0.1243: :setglobal cannot use script-local function for "expr" option (#21997)
Problem:    :setglobal cannot use script-local function for "expr" option.
Solution:   Use the pointer to the option value properly. (closes vim/vim#11883)

01d4efe2e8
2023-01-26 07:46:51 +08:00
zeertzjq
c94d8e7f13 vim-patch:9.0.1244: cursor displayed in wrong position when leaving Insert mode (#21996)
Problem:    Cursor briefly displayed in a wrong position when pressing Esc in
            Insert mode after autoindent was used.
Solution:   Do not adjust the cursor position for assumed deleted white space
            if text is following.  (closes vim/vim#11877)

0f843ef091

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-01-26 07:31:32 +08:00
Lewis Russell
e2a9d71521 Merge pull request #21885 from lewis6991/refactor/options
Problems:
    - Scope of local variables in options code is too large.
    - did_set_string_option() is too large (>1000LOC).
    - Setting options for a particular window or buffer requires a changing context (assigning curwin/curbuf).

Solutions:
    - Reduce the scope of local variables.
    - Break up did_set_string_option so it doesn't contain specific logic about each individual option (1038 LOC -> 310 LOC).
    - Begin work on making functions not depend on curbuf or curwin and pass window or buffer handles explicitly.
2023-01-25 13:46:23 +00:00
Lewis Russell
7bee622fdc refactor(optionstr.c): move handling of formatlistpat 2023-01-25 12:17:38 +00:00
Lewis Russell
15499fa856 refactor(optionstr.c): break up did_set_expropt 2023-01-25 12:13:06 +00:00
Lewis Russell
f37ec6026f refactor(optionstr.c): remove some redundant parens 2023-01-25 11:48:55 +00:00
Lewis Russell
b278e0740e refactor(optionstr.c): break up did_option_listflags 2023-01-25 11:48:55 +00:00
Lewis Russell
38ed432164 refactor(optionstr.c): add did_set_string_option_for 2023-01-25 11:48:55 +00:00
Lewis Russell
414e71fa4f refactor(optionstr.c): break up did_set_string_option 52 2023-01-25 11:48:53 +00:00
Lewis Russell
0012ed2bc7 refactor(optionstr.c): break up did_set_string_option 51 2023-01-25 11:48:53 +00:00
Lewis Russell
2654a9e9d8 refactor(optionstr.c): remove some simple did_set_* functions 2 2023-01-25 11:48:53 +00:00
Lewis Russell
e5234d48ed refactor(optionstr.c): remove some simple did_set_* functions 2023-01-25 11:48:53 +00:00
Lewis Russell
c6e7abb583 refactor(optionstr.c): break up did_set_string_option 50 2023-01-25 11:48:53 +00:00
Lewis Russell
6dac70bbfe refactor(optionstr.c): break up did_set_string_option 49 2023-01-25 11:48:53 +00:00
Lewis Russell
01e51d3bd1 refactor(optionstr.c): break up did_set_string_option 48 2023-01-25 11:48:53 +00:00
Lewis Russell
f1ac5aec23 refactor(optionstr.c): break up did_set_string_option 47 2023-01-25 11:48:53 +00:00
Lewis Russell
cb1e5ddbfb refactor(optionstr.c): break up did_set_string_option 46 2023-01-25 11:48:52 +00:00
Lewis Russell
e0954f676a refactor(optionstr.c): break up did_set_string_option 45 2023-01-25 11:48:52 +00:00
Lewis Russell
a026cf0d94 refactor(optionstr.c): break up did_set_string_option 44 2023-01-25 11:48:52 +00:00
Lewis Russell
d59349de7b refactor(optionstr.c): break up did_set_string_option 43 2023-01-25 11:48:52 +00:00
Lewis Russell
99910c7382 refactor(optionstr.c): break up did_set_string_option 42 2023-01-25 11:48:52 +00:00
Lewis Russell
2a83a5077d refactor(optionstr.c): break up did_set_string_option 41 2023-01-25 11:48:52 +00:00
Lewis Russell
a84bc3817a refactor(optionstr.c): break up did_set_string_option 40 2023-01-25 11:48:52 +00:00
Lewis Russell
902b89ad4b refactor(optionstr.c): break up did_set_string_option 39 2023-01-25 11:48:52 +00:00