New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

execute() resets cmdline column to 0 #3669

Closed
liushapku opened this Issue Dec 6, 2018 · 7 comments

Comments

Projects
None yet
3 participants
@liushapku

liushapku commented Dec 6, 2018

This follows a discussion in neovim issue 6035. There they found neovim does not reset the column after calling execute(). For vim, it always reset the column to 0, so that echon will continue after the new line character.

For example

function! Test1a()
  echo 12345678
  let x = execute('echo 1234567890')
  echon '1234'
endfunction

will show

12345678
1234

instead of

123456781234

A patch has been created to address this issue. (Do I create an PR directly?)

Moreover a test script can be found here. Each call Testxa() should generate exactly the same result as call Testxb() where x=1,2,3,4.

@liushapku liushapku changed the title from execute() resets cmdline column to one to execute() resets cmdline column to 0 Dec 6, 2018

@tonymec

This comment has been minimized.

tonymec commented Dec 6, 2018

With the following commands:

:exe 'echon 1234' | exe 'echon 5678'

I see 12345678 below the command-line. So I don't think that the :execute command adds a linefeed. But IIUC :echo does.

Best regards,
Tony.

@tonymec

This comment has been minimized.

tonymec commented Dec 6, 2018

oops, I confused :execute and execute()

@chrisbra

This comment has been minimized.

Member

chrisbra commented Dec 7, 2018

sure please go ahead and create a PR. Please also come up with a test, so that this behaviour won't regress.

@liushapku

This comment has been minimized.

liushapku commented Dec 7, 2018

@chrisbra I don't know how to create test to check UI behavior

@chrisbra

This comment has been minimized.

Member

chrisbra commented Dec 7, 2018

You can run vim recursively in a terminal and verify the behavior using the screendump feature. Have a look at the VerifyScreenDump() calls inside the src/testdir/*.vim testsuite, e.g. Test_folds_with_rnu() looks like a straight to follow test. (there are several other examples, like the new diff feature, the incsearch feature, etc).

@liushapku

This comment has been minimized.

liushapku commented Dec 7, 2018

Actually you also need to teach me how to set up the testing environment. Never get the experience to do vim test. Thank you.

@chrisbra

This comment has been minimized.

Member

chrisbra commented Dec 7, 2018

it is not that hard. Have a look at src/testdir/README.txt.

Basically run vim without customizations and add a new function called Test_...()

You might need to source view_util.vim and screendump.vim, have a look at the test_fold.vim. That is all. Then do you test (you can use the function provided in your issue and just add a call VerifyScreenDump(). You might want to add the test to e.g. test_eval_stuff.vim. Then simply run make test_eval_stuff.res and check the output in messages. Once the test works, run make and verify that the test runs successfully. Once that is done, disable your change in the source code and run make again in the testdir to make sure the test now fails.

@brammool brammool closed this in 10ccaa1 Dec 7, 2018

janlazo added a commit to janlazo/neovim that referenced this issue Dec 9, 2018

vim-patch:8.1.0569: execute() always resets display column to zero
Problem:    Execute() always resets display column to zero. (Sha Liu)
Solution:   Don't reset it to zero, restore the previous value. (closes vim/vim#3669)
vim/vim@10ccaa1

janlazo added a commit to janlazo/neovim that referenced this issue Dec 9, 2018

vim-patch:8.1.0569: execute() always resets display column to zero
Problem:    Execute() always resets display column to zero. (Sha Liu)
Solution:   Don't reset it to zero, restore the previous value. (closes vim/vim#3669)
vim/vim@10ccaa1

janlazo added a commit to janlazo/neovim that referenced this issue Dec 12, 2018

vim-patch:8.1.0569: execute() always resets display column to zero
Problem:    Execute() always resets display column to zero. (Sha Liu)
Solution:   Don't reset it to zero, restore the previous value. (closes vim/vim#3669)
vim/vim@10ccaa1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment