Skip to content

Conversation

janlazo
Copy link
Contributor

@janlazo janlazo commented Dec 9, 2018

closes #6035

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

vim-patch:8.1.0571: non-silent execute() resets display column to zero

Problem: Non-silent execute() resets display column to zero.
Solution: Keep the display column as-is.
vim/vim@446e7a3

@marvim marvim added the vim-patch See https://neovim.io/doc/user/dev_vimpatch.html label Dec 10, 2018
@liushapku
Copy link
Contributor

Thanks. But could you please also add those lua tests from the previous PR

@janlazo janlazo changed the title vim-patch:8.1.{569,571} [WIP] vim-patch:8.1.{569,571} Dec 15, 2018
@marvim marvim added the WIP label Dec 15, 2018
@janlazo
Copy link
Contributor Author

janlazo commented Jan 26, 2019

From test_alot.vim:
Found errors in Test_execute_does_not_change_col():
function RunTheTest[35]..Test_execute_does_not_change_col line 9: Expected 'abcdxyz' but got '       '
Found errors in Test_execute_not_silent():
function RunTheTest[35]..Test_execute_not_silent line 9: Expected 'abcd234 ' but got '[No Name'
function RunTheTest[35]..Test_execute_not_silent line 14: Expected 'xyz ' but got '    '

@justinmk
Copy link
Member

justinmk commented Jan 26, 2019

Those failures are most likely a result of unexpected defaults in the Vim tests. E.g. Vim doesn't show a statusbar by default, so that's where [No Name] comes from.

Should be OK to :set laststatus=1 in testdir/setup.vim . We didn't run into this until now because Vim has few screen tests.

@erw7
Copy link
Contributor

erw7 commented Apr 18, 2019

@janlazo The cause of #9338 (comment) seems to be that msg_use_printf() returns true in headless mode. In my environment, applying the following patch will pass that test. However, other tests have not been verified, so there may be something wrong.

diff --git a/src/nvim/message.c b/src/nvim/message.c
index b4aa333a4..93c2675fd 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -2289,7 +2289,7 @@ static void t_puts(int *t_col, const char_u *t_s, const char_u *s, int attr)
 //    - no UI and not embedded
 int msg_use_printf(void)
 {
-  return !embedded_mode && !ui_active();
+  return !embedded_mode && !headless_mode && !ui_active();
 }

 /// Print a message when there is no valid screen.

@erw7
Copy link
Contributor

erw7 commented Apr 20, 2019

I read :h --headless, the #9338 (comment) change is not desirable. Therefore, do not use headless mode with oldtest, or in the case of the headless mode, the :echo output needs to be changed to the screen and stderr.

@justinmk
Copy link
Member

justinmk commented Apr 27, 2019

Therefore, do not use headless mode with oldtest, or in the case of the headless mode, the :echo output needs to be changed to the screen and stderr.

@erw7 what do you mean by "changed to the screen and stderr"?

--headless outputs to stderr:

$ 2>/dev/null nvim --headless +'echo "foo"' +q
$ 1>/dev/null nvim --headless +'echo "foo"' +q
foo

@erw7
Copy link
Contributor

erw7 commented Apr 28, 2019

what do you mean by "changed to the screen and stderr"?

@justinmk It is to change it like the following patch.

diff --git a/src/nvim/message.c b/src/nvim/message.c
index a83c9cf05..20d0807f4 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -1810,8 +1810,13 @@ void msg_puts_attr_len(const char *const str, const ptrdiff_t len, int attr)
   // different, e.g. for Win32 console) or we just don't know where the
   // cursor is.
   if (msg_use_printf()) {
+    int saved_msg_col = msg_col;
     msg_puts_printf(str, len);
-  } else {
+    if (headless_mode) {
+      msg_col = saved_msg_col;
+    }
+  }
+  if (!msg_use_printf() || headless_mode) {
     msg_puts_display((const char_u *)str, len, attr, false);
   }
 }

@justinmk
Copy link
Member

Ah, I think I understand: in order to make screenchar() work, headless-mode must call msg_puts_display() so that the internal screen is updated.

We could try that...

@justinmk justinmk added this to the 0.4 milestone Jun 2, 2019
janlazo and others added 6 commits June 3, 2019 00:12
bfredl added 3 commits June 3, 2019 12:10
Fix multiple <C-D> showing statusline on previous completion list
Otherwise vim will think that ml_append() needs to "enter" the buffer,
which emits unexpected autocommands.

ref vim-airline/vim-airline#1930
api/buffer: avoid spurios Buf[Win]Enter in nvim_buf_set_lines
erw7 and others added 4 commits June 3, 2019 22:41
In the case of the headless mode, screenchar() does not operate normally
because it is not output to the internal screen. Change output to stderr
and internal screen to fix it.
Nvim might call `msg_puts_attr_len` before the screen buffers are allocated.
@justinmk
Copy link
Member

justinmk commented Jun 3, 2019

Updated after #10109 . Hoping to merge after CI.

@justinmk justinmk changed the title [WIP] vim-patch:8.1.{569,571} vim-patch:8.1.{569,571} Jun 3, 2019
@justinmk justinmk merged commit 16b1e8f into neovim:master Jun 3, 2019
@janlazo janlazo deleted the vim-8.1.0569 branch September 14, 2019 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vim-patch See https://neovim.io/doc/user/dev_vimpatch.html
Projects
None yet
Development

Successfully merging this pull request may close these issues.

execute() resets cmdline column to 0 execute() should clear cmdline
7 participants