[FarGroup/FarManager] master: microsoft/terminal#10337 again (99e4af40d)

1 view
Skip to first unread message

farg...@farmanager.com

unread,
Jul 15, 2024, 3:30:43 PM (2 days ago) Jul 15
to farco...@googlegroups.com
Repository : https://github.com/FarGroup/FarManager
On branch : master
Link : https://github.com/FarGroup/FarManager/commit/99e4af40d1179a82216fd7b1238959fc4f4705b2

>---------------------------------------------------------------

commit 99e4af40d1179a82216fd7b1238959fc4f4705b2
Author: Alex Alabuzhev <alab...@gmail.com>
Date: Mon Jul 15 20:25:41 2024 +0100

microsoft/terminal#10337 again


>---------------------------------------------------------------

99e4af40d1179a82216fd7b1238959fc4f4705b2
far/changelog | 5 +++++
far/console.cpp | 18 ++++++++++++++++--
far/vbuild.m4 | 2 +-
3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/far/changelog b/far/changelog
index a712c4169..f17d704c4 100644
--- a/far/changelog
+++ b/far/changelog
@@ -1,3 +1,8 @@
+--------------------------------------------------------------------------------
+drkns 2024-07-15 20:17:50+01:00 - build 6346
+
+1. microsoft/terminal#10337 again.
+
--------------------------------------------------------------------------------
drkns 2024-07-08 22:55:36+01:00 - build 6345

diff --git a/far/console.cpp b/far/console.cpp
index 51d9e83ed..05c3f87b4 100644
--- a/far/console.cpp
+++ b/far/console.cpp
@@ -2157,8 +2157,8 @@ protected:
{
// https://github.com/microsoft/terminal/issues/10337

- // As of 7 Oct 2022 GetLargestConsoleWindowSize is broken in WT.
- // It takes the current screen resolution and divides it by an inadequate font size, e.g. 1x16.
+ // As of 15 Jul 2024 GetLargestConsoleWindowSize is broken in WT.
+ // It takes the current screen size in pixels and divides it by an inadequate font size, e.g. 1x16 or 1x1.

// It is unlikely that it is ever gonna be fixed, so we do a few very basic checks here to filter out obvious rubbish.

@@ -2176,6 +2176,20 @@ protected:
if (Size.x >= std::numeric_limits<SHORT>::max() || Size.y >= std::numeric_limits<SHORT>::max())
return false;

+ // If we got here, it is either legit or they used some fallback 1x1 font and the proportions are not screwed enough to fail the checks above.
+ if (const auto Monitor = MonitorFromWindow(::console.GetWindow(), MONITOR_DEFAULTTONEAREST))
+ {
+ if (MONITORINFO Info{ sizeof(Info) }; GetMonitorInfo(Monitor, &Info))
+ {
+ // The smallest selectable in the UI font is 5x2. Anything smaller than that is likely rubbish and unreadable anyway.
+ if (const auto AssumedFontHeight = (Info.rcWork.bottom - Info.rcWork.top) / Size.y; AssumedFontHeight < 5)
+ return false;
+
+ if (const auto AssumedFontWidth = (Info.rcWork.right - Info.rcWork.left) / Size.x; AssumedFontWidth < 2)
+ return false;
+ }
+ }
+
return true;
}

diff --git a/far/vbuild.m4 b/far/vbuild.m4
index d100d6aa3..3107b0c7c 100644
--- a/far/vbuild.m4
+++ b/far/vbuild.m4
@@ -1 +1 @@
-6345
+6346


Reply all
Reply to author
Forward
0 new messages