Minor fixes in terminal.

This commit is contained in:
Martín Lucas Golini
2025-11-09 00:03:25 -03:00
parent 9d8878a60b
commit 066425d63b
6 changed files with 29 additions and 5 deletions

View File

@@ -87,6 +87,8 @@ class ITerminalDisplay {
TerminalEmulator* mEmulator;
virtual void onProcessExit( int exitCode );
virtual void onScrollPositionChange();
};
}} // namespace eterm::Terminal

View File

@@ -326,6 +326,8 @@ class TerminalDisplay : public ITerminalDisplay {
virtual void onProcessExit( int exitCode );
virtual void onScrollPositionChange();
void sendEvent( const TerminalDisplay::Event& event );
Sizei getFrameBufferSize();

View File

@@ -254,7 +254,6 @@ class TerminalEmulator final {
PtyPtr mPty;
ProcPtr mProcess;
bool mColorsLoaded;
bool mDirty{ true };
bool mAllowMemoryTrimnming{ false };
int mExitCode;
@@ -289,6 +288,8 @@ class TerminalEmulator final {
void onProcessExit( int exitCode );
void onScrollPositionChange();
void csidump();
void csihandle();
void csiparse();

View File

@@ -76,4 +76,6 @@ const char* ITerminalDisplay::getClipboard() const {
void ITerminalDisplay::onProcessExit( int /*exitCode*/ ) {}
void ITerminalDisplay::onScrollPositionChange() {}
}}

View File

@@ -1530,6 +1530,10 @@ void TerminalDisplay::onProcessExit( int exitCode ) {
eeSAFE_DELETE( processFactory );
}
void TerminalDisplay::onScrollPositionChange() {
sendEvent( { EventType::SCROLL_HISTORY } );
}
void TerminalDisplay::onTextInput( const Uint32& chr ) {
if ( !mTerminal )
return;

View File

@@ -669,6 +669,7 @@ void TerminalEmulator::kscrolldown( const TerminalArg* a ) {
mTerm.scr -= n;
selmove( -n );
tfulldirt();
onScrollPositionChange();
}
}
@@ -691,6 +692,7 @@ void TerminalEmulator::kscrollup( const TerminalArg* a ) {
mTerm.scr += n;
selmove( n );
tfulldirt();
onScrollPositionChange();
}
}
@@ -701,6 +703,7 @@ void TerminalEmulator::kscrollto( const TerminalArg* a ) {
mTerm.scr = n;
selscroll( 0, n );
tfulldirt();
onScrollPositionChange();
}
}
@@ -970,6 +973,8 @@ void TerminalEmulator::tscrollup( int top, int n, int copyhist ) {
if ( mTerm.scr == 0 )
selscroll( top, -n );
onScrollPositionChange();
}
void TerminalEmulator::selmove( int n ) {
@@ -1835,10 +1840,13 @@ void TerminalEmulator::strhandle( void ) {
}
}
break;
case 'k': /* old title set compatibility */
dpy->setTitle( mStrescseq.args[0] );
mTerm.title = mStrescseq.args[0];
case 'k': /* old title set compatibility */ {
if ( mStrescseq.args[0] ) {
dpy->setTitle( mStrescseq.args[0] );
mTerm.title = mStrescseq.args[0];
}
return;
}
case 'P': /* DCS -- Device Control String */
case '_': /* APC -- Application Program Command */
case '^': /* PM -- Privacy Message */
@@ -2708,7 +2716,6 @@ TerminalEmulator::TerminalEmulator( PtyPtr&& pty, ProcPtr&& process,
mDpy( display ),
mPty( std::move( pty ) ),
mProcess( std::move( process ) ),
mColorsLoaded( false ),
mExitCode( 1 ),
mStatus( STARTING ),
mBuflen( 0 ),
@@ -2773,6 +2780,12 @@ void TerminalEmulator::onProcessExit( int exitCode ) {
dpy->onProcessExit( exitCode );
}
void TerminalEmulator::onScrollPositionChange() {
auto dpy = mDpy.lock();
if ( dpy )
dpy->onScrollPositionChange();
}
void TerminalEmulator::setClipboard( const char* str ) {
auto dpy = mDpy.lock();
if ( dpy )