From 2c4d43082cb7c1147302f559ad623f5deb22afd0 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 3 Jul 2017 10:22:15 +0000 Subject: win32.c: cursor relative to screen * win32/win32.c (constat_apply): move relative to visible screen, not the entire buffer. [ruby-core:81883] [Bug #13707] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- win32/win32.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'win32') diff --git a/win32/win32.c b/win32/win32.c index a997cb39e4..d5b2fd792c 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -6737,9 +6737,11 @@ constat_apply(HANDLE handle, struct constat *s, WCHAR w) break; case L'H': case L'f': - pos.Y = (arg1 > csbi.dwSize.Y ? csbi.dwSize.Y : arg1) - 1; + pos.Y = arg1 + csbi.srWindow.Top - 1; + if (pos.Y > csbi.srWindow.Bottom) pos.Y = csbi.srWindow.Bottom; if (count < 2 || (arg1 = seq[1]) <= 0) arg1 = 1; - pos.X = (arg1 > csbi.dwSize.X ? csbi.dwSize.X : arg1) - 1; + pos.X = arg1 + csbi.srWindow.Left - 1; + if (pos.X > csbi.srWindow.Right) pos.X = csbi.srWindow.Right; SetConsoleCursorPosition(handle, pos); break; case L'J': -- cgit v1.2.3