Warning "-Wmaybe-uninitialized" in all builds:
gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -fno-strength-reduce -Wall
-Wno-deprecated-declarations -D_REENTRANT -U_FORTIFY_SOURCE
-D_FORTIFY_SOURCE=1 -o objects/ex_docmd.o ex_docmd.c
ex_docmd.c: In function ‘parse_command_modifiers’:
ex_docmd.c:3101:56: warning: ‘cmd_start’ may be used uninitialized in
this function [-Wmaybe-uninitialized]
3101 | mch_memmove(cmd_start - 5, cmd_start, eap->cmd - cmd_start);
| ^
Best regards,
Tony.
On Sun, Mar 27, 2022 at 2:37 PM Bram Moolenaar <[email protected]> wrote:
>
>
> Patch 8.2.4633
> Problem: Visual range does not work before command modifiers.
> Solution: Move Visual range to after command modifiers.
> Files: src/ex_docmd.c, src/testdir/test_source.vim
>
>
> *** ../vim-8.2.4632/src/ex_docmd.c 2022-03-25 14:39:47.539311901 +0000
> --- src/ex_docmd.c 2022-03-27 13:28:55.171560817 +0100
> ***************
> *** 2782,2794 ****
> --- 2782,2806 ----
> cmdmod_T *cmod,
> int skip_only)
> {
> + char_u *cmd_start;
> char_u *p;
> int starts_with_colon = FALSE;
> int vim9script = in_vim9script();
> + int has_visual_range = FALSE;
>
> CLEAR_POINTER(cmod);
> cmod->cmod_flags = sticky_cmdmod_flags;
>
> + if (STRNCMP(eap->cmd, "'<,'>", 5) == 0)
> + {
> + // The automatically inserted Visual area range is skipped, so that
> + // typing ":cmdmod cmd" in Visual mode works without having to move
> the
> + // range to after the modififiers.
> + eap->cmd += 5;
> + cmd_start = eap->cmd;
> + has_visual_range = TRUE;
> + }
> +
> // Repeat until no more command modifiers are found.
> for (;;)
> {
> ***************
> *** 2849,2860 ****
> {
> char_u *s, *n;
>
> ! for (s = p; ASCII_ISALPHA(*s); ++s)
> ;
> n = skipwhite(s);
> ! if (vim_strchr((char_u *)".=", *n) != NULL
> ! || *s == '['
> ! || (*n != NUL && n[1] == '='))
> break;
> }
>
> --- 2861,2871 ----
> {
> char_u *s, *n;
>
> ! for (s = eap->cmd; ASCII_ISALPHA(*s); ++s)
> ;
> n = skipwhite(s);
> ! if (*n == '.' || *n == '=' || (*n != NUL && n[1] == '=')
> ! || *s == '[')
> break;
> }
>
> ***************
> *** 3081,3086 ****
> --- 3092,3108 ----
> break;
> }
>
> + if (has_visual_range && eap->cmd > cmd_start)
> + {
> + // Move the '<,'> range to after the modifiers and insert a colon.
> + // Since the modifiers have been parsed put the colon on top of the
> + // space: "'<,'>mod cmd" -> "mod:'<,'>cmd
> + // Put eap->cmd after the colon.
> + mch_memmove(cmd_start - 5, cmd_start, eap->cmd - cmd_start);
> + eap->cmd -= 5;
> + mch_memmove(eap->cmd - 1, ":'<,'>", 6);
> + }
> +
> return OK;
> }
>
> *** ../vim-8.2.4632/src/testdir/test_source.vim 2022-03-22 12:13:49.151376708
> +0000
> --- src/testdir/test_source.vim 2022-03-27 12:55:59.699837414 +0100
> ***************
> *** 579,584 ****
> --- 579,591 ----
> call assert_equal(#{pi: 3.12, e: 2.71828}, g:Math)
> call assert_equal(['vim', 'nano'], g:Editors)
>
> + " '<,'> range before the cmd modifier works
> + unlet g:Math
> + unlet g:Editors
> + exe "normal 6GV4j:vim9cmd source\<CR>"
> + call assert_equal(['vim', 'nano'], g:Editors)
> + unlet g:Editors
> +
> " test for using try/catch
> %d _
> let lines =<< trim END
> *** ../vim-8.2.4632/src/version.c 2022-03-26 16:42:20.095555459 +0000
> --- src/version.c 2022-03-26 22:15:21.630541105 +0000
> ***************
> *** 752,753 ****
> --- 752,755 ----
> { /* Add new patch number below this line */
> + /**/
> + 4633,
> /**/
>
> --
> Seen on the back of a biker's vest: If you can read this, my wife fell off.
>
> /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
> /// \\\
> \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
> \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
>
> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups
> "vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_dev/20220327123721.210A11C0C1F%40moolenaar.net.
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/CAJkCKXv6KKMoEVU7sL_snvy0U-Ms2icR8qeo6ouOBPnQvJj7MQ%40mail.gmail.com.