[patch] To run an external command, the prompt collapse in Vim.exe

206 views
Skip to first unread message

Nobuhiro Takasaki

unread,
Sep 10, 2015, 7:26:46 AM9/10/15
to vim_dev
Now, it uses "g_coord" to display the cursor.
For prompt it must be given a log of line numbers.
Currently, the console is rewinding, the log is broken.

It was modified to give the correct line number.
Now it will not be broken.

I have always helped in your work.

--------
Thanks.
Nobuhiro Takasaki

diff

Bram Moolenaar

unread,
Sep 10, 2015, 1:41:23 PM9/10/15
to Nobuhiro Takasaki, vim_dev

Nobuhiro Takasaki wrote:

> Now, it uses "g_coord" to display the cursor.
> For prompt it must be given a log of line numbers.
> Currently, the console is rewinding, the log is broken.
>
> It was modified to give the correct line number.
> Now it will not be broken.
>
> I have always helped in your work.

I'm not sure what the problem is that you are fixing.
Perhaps you can make a screenshot of what is broken?


--
Any resemblance between the above views and those of my employer, my terminal,
or the view out my window are purely coincidental. Any resemblance between
the above and my own views is non-deterministic. The question of the
existence of views in the absence of anyone to hold them is left as an
exercise for the reader. The question of the existence of the reader is left
as an exercise for the second god coefficient. (A discussion of
non-orthogonal, non-integral polytheism is beyond the scope of this article.)
(Ralph Jennings)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Nobuhiro Takasaki

unread,
Sep 10, 2015, 11:51:11 PM9/10/15
to vim_dev
> > Now, it uses "g_coord" to display the cursor.
> > For prompt it must be given a log of line numbers.
> > Currently, the console is rewinding, the log is broken.
> >
> > It was modified to give the correct line number.
> > Now it will not be broken.
> >
> > I have always helped in your work.
>
> I'm not sure what the problem is that you are fixing.
> Perhaps you can make a screenshot of what is broken?

I am sorry.
And procedures to reproduce, to send the screen shot.

(1) > dir C:\Windows
(2) > vim -u NONE
(3) :!foo
(4) :q!

1. Make a backlog
2. start up
3. Put out a message of error (There is a rewind here)
4. End (And exit are restored with the contents of winding back)

It served four screenshots.

I will take care in the future.

---------
Thanks.
Nobuhiro Takasaki

1.gif
2.gif
3.gif
4.gif

Bram Moolenaar

unread,
Sep 29, 2015, 12:50:47 PM9/29/15
to Nobuhiro Takasaki, vim_dev

Nobuhiro Takasaki wrote:

> Now, it uses "g_coord" to display the cursor.
> For prompt it must be given a log of line numbers.
> Currently, the console is rewinding, the log is broken.
>
> It was modified to give the correct line number.
> Now it will not be broken.
>
> I have always helped in your work.

Looking at this, in the context of the recent changes of the console buffer
use, I wonder if this is the right solution.

> + static void
> +set_console_cursor_position(void)
> +{
> + CONSOLE_SCREEN_BUFFER_INFO i;
> +
> + GetConsoleScreenBufferInfo(g_cbNonTermcap.handle, &i);
> + SetConsoleCursorPosition(g_hConOut, i.dwCursorPosition);
> +}

Always using the position from g_cbNonTermcap seems strange.
Should we not depend on the value of g_fTermcapMode?

--
If they don't keep on exercising their lips, he thought, their brains
start working.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

Nobuhiro Takasaki

unread,
Sep 29, 2015, 8:25:54 PM9/29/15
to vim_dev
> Always using the position from g_cbNonTermcap seems strange.
> Should we not depend on the value of g_fTermcapMode?

It was too simple. It is a failure.
I think that it is okay with this patch.
This is to check the g_fTermcapMode.

--------
Thanks.
Nobuhiro Takasaki

diff

mattn

unread,
Sep 29, 2015, 8:34:45 PM9/29/15
to vim_dev

It may be compilation error with FEAT_GUI.

diff --git a/src/os_win32.c b/src/os_win32.c
index 5114863..e738619 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -230,6 +230,7 @@ static int win32_set_archive(char_u *name);

#ifndef FEAT_GUI_W32
static int suppress_winsize = 1; /* don't fiddle with console */
+static void set_console_cursor_position(void);
#endif

static char_u *exe_path = NULL;
@@ -1396,7 +1397,7 @@ mch_set_cursor_shape(int thickness)

SetConsoleCursorInfo(g_hConOut, &ConsoleCursorInfo);
if (s_cursor_visible)
- SetConsoleCursorPosition(g_hConOut, g_coord);
+ set_console_cursor_position();
}

void
@@ -6743,3 +6744,17 @@ fix_arg_enc(void)
set_alist_count();
}
#endif
+
+#ifndef FEAT_GUI_W32


+ static void
+set_console_cursor_position(void)
+{
+ CONSOLE_SCREEN_BUFFER_INFO i;
+

+ if (g_fTermcapMode)
+ return;


+
+ GetConsoleScreenBufferInfo(g_cbNonTermcap.handle, &i);
+ SetConsoleCursorPosition(g_hConOut, i.dwCursorPosition);
+}

+#endif

Bram Moolenaar

unread,
Sep 30, 2015, 3:19:01 PM9/30/15
to mattn, vim_dev
Have you tried this out in various situations? Now it skips setting
the cursor position when g_fTermcapMode is set. Maybe it should call
the old SetConsoleCursorPosition(g_hConOut, g_coord) then.

--
I have a drinking problem -- I can't afford it.

mattn

unread,
Oct 1, 2015, 1:50:31 PM10/1/15
to vim_dev, matt...@gmail.com
On Thursday, October 1, 2015 at 4:19:01 AM UTC+9, Bram Moolenaar wrote:
> Have you tried this out in various situations? Now it skips setting
> the cursor position when g_fTermcapMode is set. Maybe it should call
> the old SetConsoleCursorPosition(g_hConOut, g_coord) then.

I'm using windows7. so can't reproduce this problem. prob, this occurs on windows10.

Christian Brabandt

unread,
Oct 1, 2015, 3:19:59 PM10/1/15
to vim_dev
Hi mattn!
I can test it. What do I need to do?


Best
Christian
--
Meine Sprache ist allzeit simpel, enge und plan. Wenn man einen Ochsen
schlachten will, so schlägt man ihm gerade vor den Kopf.
-- Georg Christoph Lichtenberg

mattn

unread,
Oct 2, 2015, 4:49:16 AM10/2/15
to vim_dev
> I can test it. What do I need to do?

1. type return key enough to scroll-up
2. vim.exe
3. :!dir
4. :q

cursor position should be at location(next lien) that started vim.

thanks.
- mattn

Christian Brabandt

unread,
Oct 5, 2015, 9:36:53 AM10/5/15
to vim_dev
Hi mattn!
Using this patch:
diff --git a/src/os_win32.c b/src/os_win32.c
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -230,6 +230,7 @@ static int win32_set_archive(char_u *nam

I don't see a difference:
http://256bit.org/~chrisbra/vim_7.4.889_patched_screenscroll.webm
http://256bit.org/~chrisbra/vim_7.4.889_unpatched.webm


Best,
Christian
--
Zuerst schuf Gott die Idioten; das war die Vorübung. Dann schuf er die
Schule.
-- Mark Twain (eigl. Samuel Langhorne Clemens)

Yukihiro Nakadaira

unread,
Oct 9, 2015, 10:19:56 AM10/9/15
to vim...@googlegroups.com
On Mon, Oct 5, 2015 at 10:36 PM, Christian Brabandt <cbl...@256bit.org> wrote:
Hi mattn!

On Fr, 02 Okt 2015, mattn wrote:

> > I can test it. What do I need to do?
>
> 1. type return key enough to scroll-up
> 2. vim.exe
> 3. :!dir
> 4. :q

(3) is wrong.

1. type return key enough to scroll-up
2. vim.exe
3. :!command_that_is_not_exist_or_return_error
4. :q

Cmd script to reproduce is:

  > for /L %i in (1, 1, 100) do echo "echo to make command prompt scrolled"
  > vim -u NONE --cmd "!command_that_is_not_exist_or_return_error" --cmd "q"



> cursor position should be at location(next lien) that started vim.

[...snip...]


--
Yukihiro Nakadaira - yukihiro....@gmail.com

Christian Brabandt

unread,
Oct 10, 2015, 8:26:04 AM10/10/15
to vim...@googlegroups.com
Hi Yukihiro!

On Fr, 09 Okt 2015, Yukihiro Nakadaira wrote:

> On Mon, Oct 5, 2015 at 10:36 PM, Christian Brabandt <cbl...@256bit.org> wrote:
>
> Hi mattn!
>
> On Fr, 02 Okt 2015, mattn wrote:
>
> > > I can test it. What do I need to do?
> >
> > 1. type return key enough to scroll-up
> > 2. vim.exe
> > 3. :!dir
>
> > 4. :q
>
>
> (3) is wrong.
>
> 1. type return key enough to scroll-up
> 2. vim.exe
> 3. :!command_that_is_not_exist_or_return_error
> 4. :q
>
> Cmd script to reproduce is:
>
>   > for /L %i in (1, 1, 100) do echo "echo to make command prompt scrolled"
>   > vim -u NONE --cmd "!command_that_is_not_exist_or_return_error" --cmd "q"

Slightly better:
https://www.256bit.org/~chrisbra/video_vim_patched.webm

(patched vim is execution of vim2.exe)

While for the unpatched vim, the cursor position is completely off on
the top of the command.com prompt, the patched vim will move the cursor
to the second line. Still hard to see where the cursor actually is after
quitting vim.

Best,
Christian
--
Hallo Fransenjackenträger!
Reply all
Reply to author
Forward
0 new messages