mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-13 13:54:11 +02:00
Console fixes
This commit is contained in:
parent
fa015e314d
commit
d32c8212a9
3 changed files with 24 additions and 14 deletions
|
@ -126,7 +126,8 @@ namespace Beefy.widgets
|
||||||
.RWin,
|
.RWin,
|
||||||
.Alt,
|
.Alt,
|
||||||
.Control,
|
.Control,
|
||||||
.Command:
|
.Command,
|
||||||
|
.Shift:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -739,6 +739,8 @@ class ConsolePanel : Panel
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SysKeyDown(KeyDownEvent keyEvent)
|
public void SysKeyDown(KeyDownEvent keyEvent)
|
||||||
|
{
|
||||||
|
if (!keyEvent.mKeyCode.IsModifier)
|
||||||
{
|
{
|
||||||
if (Paused)
|
if (Paused)
|
||||||
{
|
{
|
||||||
|
@ -746,6 +748,7 @@ class ConsolePanel : Panel
|
||||||
Paused = false;
|
Paused = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mView.mHasFocus)
|
if (mView.mHasFocus)
|
||||||
{
|
{
|
||||||
|
|
|
@ -340,13 +340,16 @@ class WinNativeConsoleProvider : ConsoleProvider
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
#if BF_PLATFORM_WINDOWS
|
||||||
var outHandle = Console.[Friend]GetStdHandle(Console.STD_OUTPUT_HANDLE);
|
var outHandle = Console.[Friend]GetStdHandle(Console.STD_OUTPUT_HANDLE);
|
||||||
CONSOLE_SCREEN_BUFFER_INFOEX info = default;
|
CONSOLE_SCREEN_BUFFER_INFOEX info = default;
|
||||||
info.mSize = sizeof(CONSOLE_SCREEN_BUFFER_INFOEX);
|
info.mSize = sizeof(CONSOLE_SCREEN_BUFFER_INFOEX);
|
||||||
#if BF_PLATFORM_WINDOWS
|
if (GetConsoleScreenBufferInfoEx(outHandle, ref info))
|
||||||
GetConsoleScreenBufferInfoEx(outHandle, ref info);
|
|
||||||
#endif
|
|
||||||
return info.mHeight;
|
return info.mHeight;
|
||||||
|
#endif
|
||||||
|
if (mScreenInfo != null)
|
||||||
|
return mScreenInfo.mInfo.mHeight;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override bool Attached => mHasConsole;
|
public override bool Attached => mHasConsole;
|
||||||
|
@ -386,16 +389,19 @@ class WinNativeConsoleProvider : ConsoleProvider
|
||||||
if (mScreenInfo.mFullCharInfo != null)
|
if (mScreenInfo.mFullCharInfo != null)
|
||||||
{
|
{
|
||||||
int bufRow = row + mScreenInfo.mScrollTop;
|
int bufRow = row + mScreenInfo.mScrollTop;
|
||||||
if (col >= mScreenInfo.mInfo.mWidth)
|
int idx = bufRow * mScreenInfo.mInfo.mWidth + col;
|
||||||
|
int maxIdx = (int)mScreenInfo.mInfo.mWidth * mScreenInfo.mInfo.mHeight;
|
||||||
|
if ((idx < 0) || (idx >= maxIdx))
|
||||||
return default;
|
return default;
|
||||||
if (bufRow >= mScreenInfo.mInfo.mHeight)
|
var info = mScreenInfo.mFullCharInfo[idx];
|
||||||
return default;
|
|
||||||
|
|
||||||
var info = mScreenInfo.mFullCharInfo[bufRow * mScreenInfo.mInfo.mWidth + col];
|
|
||||||
return .() { mChar = info.mChar, mAttributes = info.mAttributes };
|
return .() { mChar = info.mChar, mAttributes = info.mAttributes };
|
||||||
}
|
}
|
||||||
|
|
||||||
var info = mScreenInfo.mCharInfo[row * mScreenInfo.mInfo.mWindowRect.Width + col];
|
int idx = row * mScreenInfo.mInfo.mWindowRect.Width + col;
|
||||||
|
int maxIdx = (int)mScreenInfo.mInfo.mWindowRect.Width * mScreenInfo.mInfo.mWindowRect.Height;
|
||||||
|
if ((idx < 0) || (idx >= maxIdx))
|
||||||
|
return default;
|
||||||
|
var info = mScreenInfo.mCharInfo[idx];
|
||||||
return .() { mChar = info.mChar, mAttributes = info.mAttributes };
|
return .() { mChar = info.mChar, mAttributes = info.mAttributes };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue