View Issue Details

IDProjectCategoryView StatusLast Update
0001809Far Manager_Commonpublic2011-06-28 20:52
ReporterMaximus Assigned ToDrKnS  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version3.0 
Fixed in Version3.0 
Summary0001809: Некорректная прогрутка консоли при выходе
DescriptionС некоторых пор фар восстанавливает размер экранного буфера при выходе.
Плохо то, что:
1. экранный буфер _прокручивается_, но без учета позиции курсора.
2. не восстанавливается видимость и высота курсора.
Steps To ReproduceПример для консоли по умолчанию 80x25 с высотой буфера 300

фар в качестве редактора, запуск через батник:
==== begin
dir %WINDIR%
"%~dp0far.exe" /p /m /e "%~dp0FarEng.hlf"
cmd
==== end

или как "панели":
==== begin
dir %WINDIR%
"%~dp0far.exe" /p /m
cmd
==== end

В обоих случаях курсор оказывается либо в позиции 0x0 либо 23x0 а видимая область прокручивается в низ консоли, в результате курсор и вывод cmd оказывается не виден.
TagsNo tags attached.
Build2079

Activities

Maximus

2011-06-24 21:52

reporter  

Info110624.diff (1,254 bytes)   
Index: interf.cpp
===================================================================
--- interf.cpp	(revision 6352)
+++ interf.cpp	(working copy)
@@ -85,8 +85,7 @@
 	Console.GetTitle(strInitTitle);
 	Console.GetWindowRect(InitWindowRect);
 	Console.GetSize(InitialSize);
-	CONSOLE_CURSOR_INFO InitCursorInfo;
-	Console.GetCursorInfo(InitCursorInfo);
+	Console.GetCursorInfo(InitialCursorInfo);
 
 	GeneralCfg->GetValue(L"Interface",L"Mouse",&Opt.Mouse,1);
 
@@ -161,6 +160,15 @@
 
 	Console.SetTitle(strInitTitle);
 	Console.SetSize(InitialSize);
+	COORD CursorPos = {};
+	Console.GetCursorPosition(CursorPos);
+	SHORT Height = InitWindowRect.Bottom-InitWindowRect.Top, Width = InitWindowRect.Right-InitWindowRect.Left;
+	if (CursorPos.Y > InitWindowRect.Bottom || CursorPos.Y < InitWindowRect.Top)
+		InitWindowRect.Top = (CursorPos.Y <= Height) ? 0 : max(CursorPos.Y-Height,0);
+	if (CursorPos.X > InitWindowRect.Right || CursorPos.X < InitWindowRect.Left)
+		InitWindowRect.Left = (CursorPos.X <= Width) ? 0 : max(CursorPos.X-Width,0);
+	InitWindowRect.Bottom = InitWindowRect.Top + Height;
+	InitWindowRect.Right = InitWindowRect.Left + Width;
 	Console.SetWindowRect(InitWindowRect);
 	Console.SetSize(InitialSize);
 
Info110624.diff (1,254 bytes)   

DrKnS

2011-06-25 16:36

administrator   bugnote:0007211

> InitWindowRect.Top = (CursorPos.Y <= Height) ? 0 : max(CursorPos.Y-Height,0);

зачем во второй ветке max, если там CursorPos.Y > Height и разность априори больше нуля?

Maximus

2011-06-25 17:00

reporter   bugnote:0007212

да, max похоже не нужен

Maximus

2011-06-28 20:50

reporter   bugnote:0007221

некрасивый код получился. случайно?

Maximus

2011-06-28 20:50

reporter  

interf110628.diff (608 bytes)   
Index: interf.cpp
===================================================================
--- interf.cpp	(revision 6377)
+++ interf.cpp	(working copy)
@@ -168,7 +168,8 @@
 	if (CursorPos.X > InitWindowRect.Right || CursorPos.X < InitWindowRect.Left)
 		InitWindowRect.Left = Max(0, CursorPos.X-Width);
 	InitWindowRect.Bottom = InitWindowRect.Top + Height;
-	InitWindowRect.Right = InitWindowRect.Left + Width;	Console.SetWindowRect(InitWindowRect);
+	InitWindowRect.Right = InitWindowRect.Left + Width;
+	Console.SetWindowRect(InitWindowRect);
 	Console.SetSize(InitialSize);
 
 	delete KeyQueue;
interf110628.diff (608 bytes)   

DrKnS

2011-06-28 20:52

administrator   bugnote:0007222

Ага.

Issue History

Date Modified Username Field Change
2011-06-24 21:52 Maximus New Issue
2011-06-24 21:52 Maximus File Added: Info110624.diff
2011-06-25 16:36 DrKnS Note Added: 0007211
2011-06-25 17:00 Maximus Note Added: 0007212
2011-06-27 10:09 DrKnS Build => 2079
2011-06-27 10:09 DrKnS Status new => closed
2011-06-27 10:09 DrKnS Assigned To => DrKnS
2011-06-27 10:09 DrKnS Resolution open => fixed
2011-06-27 10:09 DrKnS Fixed in Version => 3.0
2011-06-28 20:50 Maximus Note Added: 0007221
2011-06-28 20:50 Maximus Status closed => feedback
2011-06-28 20:50 Maximus Resolution fixed => reopened
2011-06-28 20:50 Maximus File Added: interf110628.diff
2011-06-28 20:52 DrKnS Note Added: 0007222
2011-06-28 20:52 DrKnS Status feedback => closed
2011-06-28 20:52 DrKnS Resolution reopened => fixed