From 4227afce5b8d605b305c4e970c767f261f703194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Thu, 28 Jul 2022 01:51:38 -0300 Subject: [PATCH] Fixed "clear" command now clears scrollback history. Improved font bold rendering (minor tweak). Added click step for terminal scroll. --- src/eepp/graphics/fonttruetype.cpp | 2 +- .../include/eterm/terminal/terminaldisplay.hpp | 5 +++++ .../eterm/src/eterm/terminal/terminaldisplay.cpp | 16 ++++++++++++---- .../src/eterm/terminal/terminalemulator.cpp | 3 +++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/eepp/graphics/fonttruetype.cpp b/src/eepp/graphics/fonttruetype.cpp index 811f05b6b..c445641be 100644 --- a/src/eepp/graphics/fonttruetype.cpp +++ b/src/eepp/graphics/fonttruetype.cpp @@ -693,7 +693,7 @@ Glyph FontTrueType::loadGlyph( Uint32 index, unsigned int characterSize, bool bo if ( outline ) { if ( bold ) { FT_OutlineGlyph outlineGlyph = (FT_OutlineGlyph)glyphDesc; - FT_Outline_Embolden( &outlineGlyph->outline, weight ); + FT_Outline_EmboldenXY( &outlineGlyph->outline, 1 << 5, weight ); } if ( outlineThickness != 0 && !mIsColorEmojiFont ) { diff --git a/src/modules/eterm/include/eterm/terminal/terminaldisplay.hpp b/src/modules/eterm/include/eterm/terminal/terminaldisplay.hpp index 346e1a115..5faa39c19 100644 --- a/src/modules/eterm/include/eterm/terminal/terminaldisplay.hpp +++ b/src/modules/eterm/include/eterm/terminal/terminaldisplay.hpp @@ -237,6 +237,10 @@ class TerminalDisplay : public ITerminalDisplay { bool isAltScr() const; + const Uint32& getClickStep() const; + + void setClickStep( const Uint32& clickStep ); + protected: EE::Window::Window* mWindow; std::vector mBuffer; @@ -268,6 +272,7 @@ class TerminalDisplay : public ITerminalDisplay { Clock mLastDoubleClick; int mColumns{ 0 }; int mRows{ 0 }; + Uint32 mClickStep{ 5 }; FrameBuffer* mFrameBuffer{ nullptr }; TerminalColorScheme mColorScheme; diff --git a/src/modules/eterm/src/eterm/terminal/terminaldisplay.cpp b/src/modules/eterm/src/eterm/terminal/terminaldisplay.cpp index 0d13e333a..6f1c33260 100644 --- a/src/modules/eterm/src/eterm/terminal/terminaldisplay.cpp +++ b/src/modules/eterm/src/eterm/terminal/terminaldisplay.cpp @@ -562,6 +562,14 @@ bool TerminalDisplay::isAltScr() const { return mEmulator && mEmulator->tisaltscr(); } +const Uint32& TerminalDisplay::getClickStep() const { + return mClickStep; +} + +void TerminalDisplay::setClickStep( const Uint32& clickStep ) { + mClickStep = clickStep; +} + void TerminalDisplay::update() { if ( mFocus && isBlinkingCursor() && mClock.getElapsedTime().asSeconds() > 0.7 ) { mMode ^= MODE_BLINK; @@ -591,25 +599,25 @@ void TerminalDisplay::action( TerminalShortcutAction action ) { break; } case TerminalShortcutAction::SCROLLUP_SCREEN: { - TerminalArg arg( (int)-1 ); + TerminalArg arg( (int)-mClickStep ); mTerminal->kscrollup( &arg ); sendEvent( { EventType::SCROLL_HISTORY } ); break; } case TerminalShortcutAction::SCROLLDOWN_SCREEN: { - TerminalArg arg( (int)-1 ); + TerminalArg arg( (int)-mClickStep ); mTerminal->kscrolldown( &arg ); sendEvent( { EventType::SCROLL_HISTORY } ); break; } case TerminalShortcutAction::SCROLLUP_ROW: { - TerminalArg arg( (int)1 ); + TerminalArg arg( (int)mClickStep ); mTerminal->kscrollup( &arg ); sendEvent( { EventType::SCROLL_HISTORY } ); break; } case TerminalShortcutAction::SCROLLDOWN_ROW: { - TerminalArg arg( (int)1 ); + TerminalArg arg( (int)mClickStep ); mTerminal->kscrolldown( &arg ); sendEvent( { EventType::SCROLL_HISTORY } ); break; diff --git a/src/modules/eterm/src/eterm/terminal/terminalemulator.cpp b/src/modules/eterm/src/eterm/terminal/terminalemulator.cpp index 31b3c94f1..9050b1de8 100644 --- a/src/modules/eterm/src/eterm/terminal/terminalemulator.cpp +++ b/src/modules/eterm/src/eterm/terminal/terminalemulator.cpp @@ -1503,6 +1503,9 @@ void TerminalEmulator::csihandle( void ) { tclearregion( 0, 0, mTerm.col - 1, mTerm.c.y - 1 ); tclearregion( 0, mTerm.c.y, mTerm.c.x, mTerm.c.y ); break; + case 3: + clearHistory(); + // fallthrough case 2: /* all */ tclearregion( 0, 0, mTerm.col - 1, mTerm.row - 1 ); break;