Fixes #16225
https://github.com/vim/vim/pull/16886
(6 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
@zeertzjq commented on this pull request.
> @@ -1149,6 +1149,11 @@ inside of strings can change! Also see 'softtabstop' option. > :[line]pu[t]! [x] Put the text [from register x] before [line] (default current line). + *:ipu* *:iput* +:[line]ipu[t] [x] like |:put|, but adjust indent to the current line⬇️ Suggested change
-:[line]ipu[t] [x] like |:put|, but adjust indent to the current line +:[line]ip[ut] [x] like |:put|, but adjust indent to the current line
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
> @@ -1149,6 +1149,11 @@ inside of strings can change! Also see 'softtabstop' option. > :[line]pu[t]! [x] Put the text [from register x] before [line] (default current line). + *:ipu* *:iput* +:[line]ipu[t] [x] like |:put|, but adjust indent to the current line + +:[line]ipu[t]! [x] like |:put!|, but adjust indent to the current line⬇️ Suggested change
-:[line]ipu[t]! [x] like |:put!|, but adjust indent to the current line +:[line]ip[ut]! [x] like |:put!|, but adjust indent to the current line
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@zeertzjq commented on this pull request.
> @@ -1559,6 +1559,8 @@ tag command action ~ |:ptselect| :pts[elect] |:tselect| and show tag in preview window |:public| :public prefix for a class or object member |:put| :pu[t] insert contents of register in the text +|:iput| :ipu[t] like |:put|, but adjust the indent to the⬇️ Suggested change
-|:iput| :ipu[t] like |:put|, but adjust the indent to the +|:iput| :ip[ut] like |:put|, but adjust the indent to the
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@zeertzjq commented on this pull request.
> @@ -1149,6 +1149,11 @@ inside of strings can change! Also see 'softtabstop' option. > :[line]pu[t]! [x] Put the text [from register x] before [line] (default current line). + *:ipu* *:iput*
- *:ipu* *:iput* + *:ip* *:iput*
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@zeertzjq commented on this pull request.
In src/ex_cmds.h:
> +EXCMD(CMD_iput, "iput", ex_iput, + EX_RANGE|EX_WHOLEFOLD|EX_BANG|EX_REGSTR|EX_TRLBAR|EX_ZEROR|EX_CMDWIN|EX_LOCK_OK|EX_MODIFY, + ADDR_LINES),
This should appear near other Ex commands that start with 'i'.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@yegappan commented on this pull request.
> @@ -75,6 +75,8 @@ func Test_put_fails_when_nomodifiable() normal! yy call assert_fails(':put', 'E21:') call assert_fails(':put!', 'E21:') + call assert_fails(':iput', 'E21:') + call assert_fails(':iput!', 'E21:') call assert_fails(':normal! p', 'E21:')
The new command needs a lot more tests.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@zeertzjq commented on this pull request.
> @@ -1559,6 +1559,8 @@ tag command action ~ |:ptselect| :pts[elect] |:tselect| and show tag in preview window |:public| :public prefix for a class or object member |:put| :pu[t] insert contents of register in the text +|:iput| :ipu[t] like |:put|, but adjust the indent to the
This one should also be moved between :interface
and :isearch
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 2 commits.
You are receiving this because you are subscribed to this thread.
@64-bitman commented on this pull request.
> @@ -75,6 +75,8 @@ func Test_put_fails_when_nomodifiable() normal! yy call assert_fails(':put', 'E21:') call assert_fails(':put!', 'E21:') + call assert_fails(':iput', 'E21:') + call assert_fails(':iput!', 'E21:') call assert_fails(':normal! p', 'E21:')
The new command needs a lot more tests.
Could you describe some?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@yegappan commented on this pull request.
> @@ -75,6 +75,8 @@ func Test_put_fails_when_nomodifiable() normal! yy call assert_fails(':put', 'E21:') call assert_fails(':put!', 'E21:') + call assert_fails(':iput', 'E21:') + call assert_fails(':iput!', 'E21:') call assert_fails(':normal! p', 'E21:')
The following is a list of possible tests:
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@yegappan commented on this pull request.
> @@ -75,6 +75,8 @@ func Test_put_fails_when_nomodifiable() normal! yy call assert_fails(':put', 'E21:') call assert_fails(':put!', 'E21:') + call assert_fails(':iput', 'E21:') + call assert_fails(':iput!', 'E21:') call assert_fails(':normal! p', 'E21:')
iput
command, you need to a Vim9 script test where a def function calls the iput command.—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
I think everything is ready
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
thanks
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
There are a few errors here, which I unfortunately did not notice. So I'll revert this for now. Can you please check CI logs?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Reopened #16886.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Thank you!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
There are a few errors here, which I unfortunately did not notice. So I'll revert this for now. Can you please check CI logs?
Sure.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@yegappan commented on this pull request.
In src/vim9.h:
> @@ -200,6 +200,7 @@ typedef enum { ISN_USEDICT, // use or clear dict saved by ISN_MEMBER/ISN_STRINGMEMBER ISN_PUT, // ":put", uses isn_arg.put + ISN_IPUT, // ":iput", uses isn_arg.put
Can you add a new test to the test_vim9_disassemble.vim file for this new instruction?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@yegappan requested changes on this pull request.
> @@ -328,4 +330,63 @@ func Test_put_list() bw! endfunc +func Test_iput_multiline() + new + setlocal noexpandtab + call feedkeys("i\<Tab>foo", 'x')
You can use setline() or append() instead of feedkeys() here.
> + call feedkeys("i\<Tab>foo", 'x') + call setreg('0', "bar\n\<Tab>bar2\nbar3", 'l') + exe "iput" + call assert_equal(["\<Tab>bar", "\<Tab>\<Tab>bar2", "\<Tab>bar3"], getline(2, 4)) + setlocal expandtab tabstop=8 shiftwidth=8 noshiftround + exe "iput" + call assert_equal([repeat(' ', 8) . "bar", + \ repeat(' ', 16) . "bar2", + \ repeat(' ', 8) . "bar3"], getline(5, 7)) + bw! +endfunc + +func Test_iput_beforeafter_tab() + new + setlocal noexpandtab + call feedkeys("i\<Tab>foo", 'x')
You can use setline() or append() here.
> @@ -328,4 +330,63 @@ func Test_put_list() bw! endfunc +func Test_iput_multiline() + new + setlocal noexpandtab + call feedkeys("i\<Tab>foo", 'x') + call setreg('0', "bar\n\<Tab>bar2\nbar3", 'l') + exe "iput"
No need to use "exe" here. You can use the command "iput" by itself.
> +endfunc + +func Test_iput_invalidrange() + new + call setreg('0', "bar", 'l') + call assert_fails(':10iput', 'E16:') + bw! +endfunc + +func Test_iput_not_put() + new + call feedkeys("i\<Tab>foo", 'x') + call setreg('0', "bar", 'l') + exe "iput" + call assert_equal("\<Tab>bar", getline(2)) + exe "put"
You can remove "exe" from all of these tests for "iput" and "put".
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
> @@ -328,4 +330,63 @@ func Test_put_list() bw! endfunc +func Test_iput_multiline() + new + setlocal noexpandtab + call setline(1, "\<Tab>foo") + call setreg('0', "bar\n\<Tab>bar2\nbar3", 'l') + iput + call assert_equal(["\<Tab>bar", "\<Tab>\<Tab>bar2", "\<Tab>bar3"], getline(2, 4)) + setlocal expandtab tabstop=8 shiftwidth=8 noshiftround + exe "iput"
Can you remove "exe" from here?
> + iput + call assert_equal(["\<Tab>bar", "\<Tab>\<Tab>bar2", "\<Tab>bar3"], getline(2, 4)) + setlocal expandtab tabstop=8 shiftwidth=8 noshiftround + exe "iput" + call assert_equal([repeat(' ', 8) . "bar", + \ repeat(' ', 16) . "bar2", + \ repeat(' ', 8) . "bar3"], getline(5, 7)) + bw! +endfunc + +func Test_iput_beforeafter_tab() + new + setlocal noexpandtab + call setline(1, "\<Tab>foo") + call setreg('0', "bar", 'l') + exe "iput"
Can you remove "exe" from here?
> + exe "iput" + call assert_equal([repeat(' ', 8) . "bar", + \ repeat(' ', 16) . "bar2", + \ repeat(' ', 8) . "bar3"], getline(5, 7)) + bw! +endfunc + +func Test_iput_beforeafter_tab() + new + setlocal noexpandtab + call setline(1, "\<Tab>foo") + call setreg('0', "bar", 'l') + exe "iput" + call assert_equal(["\<Tab>bar"], getline(2, '$')) + call feedkeys("k", 'x') + exe "iput!"
Can you remove "exe" from here?
> + call setreg('0', "bar", 'l') + exe "iput" + call assert_equal(["\<Tab>bar"], getline(2, '$')) + call feedkeys("k", 'x') + exe "iput!" + call assert_equal("\<Tab>bar", getline(1)) + call assert_equal("\<Tab>bar", getline(3)) + bw! +endfunc + +func Test_iput_beforeafter_expandtab() + new + setlocal expandtab tabstop=8 shiftwidth=8 noshiftround + call feedkeys("i\<Tab>foo", 'x') + call setreg('0', "bar", 'l') + exe "iput"
Can you remove "exe" from here?
> + call assert_equal(["\<Tab>bar"], getline(2, '$')) + call feedkeys("k", 'x') + exe "iput!" + call assert_equal("\<Tab>bar", getline(1)) + call assert_equal("\<Tab>bar", getline(3)) + bw! +endfunc + +func Test_iput_beforeafter_expandtab() + new + setlocal expandtab tabstop=8 shiftwidth=8 noshiftround + call feedkeys("i\<Tab>foo", 'x') + call setreg('0', "bar", 'l') + exe "iput" + call assert_equal([repeat(' ', 8) . "bar"], getline(2, '$')) + exe "1iput!"
Can you remove "exe" from here?
> @@ -7619,7 +7635,18 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc) iptr->isn_arg.put.put_regname, (long)iptr->isn_arg.put.put_lnum); break; - + case ISN_IPUT: + if (iptr->isn_arg.put.put_lnum == LNUM_VARIABLE_RANGE_ABOVE) + smsg("%s%4d PUT %c above range",
To differentiate this instruction from "ISN_PUT", can you use "IPUT" instead "PUT" here?
> @@ -7619,7 +7635,18 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc) iptr->isn_arg.put.put_regname, (long)iptr->isn_arg.put.put_lnum); break; - + case ISN_IPUT: + if (iptr->isn_arg.put.put_lnum == LNUM_VARIABLE_RANGE_ABOVE) + smsg("%s%4d PUT %c above range", + pfx, current, iptr->isn_arg.put.put_regname); + else if (iptr->isn_arg.put.put_lnum == LNUM_VARIABLE_RANGE) + smsg("%s%4d PUT %c range",
To differentiate this instruction from "ISN_PUT", can you use "IPUT" instead "PUT" here?
> @@ -7619,7 +7635,18 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc) iptr->isn_arg.put.put_regname, (long)iptr->isn_arg.put.put_lnum); break; - + case ISN_IPUT: + if (iptr->isn_arg.put.put_lnum == LNUM_VARIABLE_RANGE_ABOVE) + smsg("%s%4d PUT %c above range", + pfx, current, iptr->isn_arg.put.put_regname); + else if (iptr->isn_arg.put.put_lnum == LNUM_VARIABLE_RANGE) + smsg("%s%4d PUT %c range", + pfx, current, iptr->isn_arg.put.put_regname); + else + smsg("%s%4d PUT %c %ld", pfx, current,
To differentiate this instruction from "ISN_PUT", can you use "IPUT" instead "PUT" here?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@h-east commented on this pull request.
In src/ex_docmd.c:
> + if (valid_yank_reg(*ea.arg, ((ea.cmdidx != CMD_put && ea.cmdidx != CMD_iput) && !IS_USER_CMDIDX(ea.cmdidx))))
- if (valid_yank_reg(*ea.arg, ((ea.cmdidx != CMD_put && ea.cmdidx != CMD_iput) - && !IS_USER_CMDIDX(ea.cmdidx)))) + if (valid_yank_reg(*ea.arg, (!IS_USER_CMDIDX(ea.cmdidx) + && ea.cmdidx != CMD_put && ea.cmdidx != CMD_iput)))
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
There are some incorrect test changes after the merge from master branch. I pushed a commit to fix them.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@zeertzjq commented on this pull request.
> @@ -3252,6 +3252,58 @@ var_any_get_oc_member(class_T *current_class, isn_T *iptr, typval_T *tv) return OK; } +/* + * do ISN_PUT or ISN_IPUT instruction depending on fixindent parameter + */ + static void +isn_put_do (ectx_T *ectx, isn_T *iptr, typval_T *tv, int fixindent)⬇️ Suggested change
-isn_put_do (ectx_T *ectx, isn_T *iptr, typval_T *tv, int fixindent) +isn_put_do(ectx_T *ectx, isn_T *iptr, typval_T *tv, int fixindent)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
I think this is ready
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Thanks. It was a bit complicated to get all changes merged into a single commit, but I think I made it :)
I also added another test for :0iput
. Thanks all.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Thanks to everyone for adding this.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.