Fixed a rendering bug in the terminal emulator when updated line only updated spaces.

Added an optimization for scene loading.
Do not allow the spell checker renderer to try to render on too long lines.
This commit is contained in:
Martín Lucas Golini
2026-05-04 19:30:56 -03:00
parent 19c0f15196
commit 336afe90d7
7 changed files with 38 additions and 11 deletions

View File

@@ -476,7 +476,7 @@
"eepp-linux-ninja": {
"build": [
{
"args": "--disable-static-build --with-debug-symbols --with-backend=SDL3 ninja",
"args": "--disable-static-build --with-debug-symbols --with-backend=SDL3 ninja",
"command": "premake5",
"working_dir": "${project_root}"
},

View File

@@ -748,6 +748,7 @@ class EE_API UISceneNode : public SceneNode {
CSS::StyleSheet mStyleSheet;
bool mIsLoading{ false };
bool mUpdatingLayouts{ false };
bool mStyleDuringLoad{ false };
UIThemeManager* mUIThemeManager{ nullptr };
UIIconThemeManager* mUIIconThemeManager{ nullptr };
std::vector<Font*> mFontFaces;
@@ -984,6 +985,8 @@ class EE_API UISceneNode : public SceneNode {
/** @return The document / scene URI used to resolve paths from a complete URI (with
* path+query+fragment+etc) */
URI getURIFromURL( const URI& url ) const;
void updateStyleSheet( bool forceReloadStyle = true );
};
}} // namespace EE::UI

View File

@@ -371,6 +371,11 @@ UIWidget* UISceneNode::loadLayoutNodes( pugi::xml_node node, Node* parent, const
innerClock.getElapsedTimeAndReset().asMilliseconds() );
}
if ( mStyleDuringLoad ) {
updateStyleSheet( false );
mStyleDuringLoad = false;
}
for ( auto& widget : widgets )
widget->reloadStyle( true, true, true );
@@ -380,6 +385,7 @@ UIWidget* UISceneNode::loadLayoutNodes( pugi::xml_node node, Node* parent, const
}
mIsLoading = false;
SceneManager::instance()->setCurrentUISceneNode( prevUISceneNode );
if ( mVerbose ) {
@@ -406,18 +412,13 @@ void UISceneNode::setStyleSheet( const std::string& inlineStyleSheet ) {
setStyleSheet( parser.getStyleSheet() );
}
void UISceneNode::combineStyleSheet( const CSS::StyleSheet& styleSheet, bool forceReloadStyle,
URI baseURI ) {
mStyleSheet.combineStyleSheet( styleSheet );
void UISceneNode::updateStyleSheet( bool forceReloadStyle ) {
bool mediaChanged = false;
if ( !mStyleSheet.isMediaQueryListEmpty() &&
mStyleSheet.updateMediaLists( getMediaFeatures() ) ) {
mediaChanged = true;
}
processStyleSheetAtRules( styleSheet, baseURI );
if ( mRoot && mRoot->getUIStyle() )
mRoot->getUIStyle()->resetGlobalDefinition();
@@ -428,6 +429,20 @@ void UISceneNode::combineStyleSheet( const CSS::StyleSheet& styleSheet, bool for
reloadStyle();
}
void UISceneNode::combineStyleSheet( const CSS::StyleSheet& styleSheet, bool forceReloadStyle,
URI baseURI ) {
mStyleSheet.combineStyleSheet( styleSheet );
processStyleSheetAtRules( styleSheet, baseURI );
if ( mIsLoading ) {
mStyleDuringLoad = true;
return;
}
updateStyleSheet( forceReloadStyle );
}
void UISceneNode::combineStyleSheet( const std::string& inlineStyleSheet, bool forceReloadStyle,
const Uint32& marker, URI baseURI ) {
CSS::StyleSheetParser parser;

View File

@@ -149,6 +149,7 @@ void UIWidgetCreator::createBaseWidgetList() {
registeredWidget["del"] = UITextSpan::NewStrikethrough;
registeredWidget["font"] = UITextSpan::NewFont;
registeredWidget["code"] = UITextSpan::NewCode;
registeredWidget["tt"] = [] { return UITextSpan::NewWithTag( "tt" ); };
registeredWidget["mark"] = UITextSpan::NewMark;
registeredWidget["div"] = UIRichText::NewDiv;
registeredWidget["p"] = UIRichText::NewParagraph;

View File

@@ -1359,23 +1359,29 @@ void TerminalDisplay::drawGrid( const Vector2f& pos ) {
auto advanceX = spaceCharAdvanceX * ( isWide ? 2.0f : 1.0f );
if ( glyph.mode & ATTR_WDUMMY ) {
if ( mVBForeground )
if ( mVBForeground ) {
mVBForeground->setQuadColor( mCurGridPos, Color::Transparent );
dirtyFG = true;
}
continue;
}
if ( glyph.u == 32 && !( glyph.mode & ( ATTR_UNDERLINE | ATTR_STRUCK ) ) ) {
x += advanceX;
if ( mVBForeground )
if ( mVBForeground ) {
mVBForeground->setQuadColor( mCurGridPos, Color::Transparent );
dirtyFG = true;
}
continue;
}
if ( glyph.mode & ATTR_BOXDRAW ) {
auto bd = TerminalEmulator::boxdrawindex( &glyph );
drawbox( x, y, advanceX, lineHeight, fg, bg, bd );
if ( mVBForeground )
if ( mVBForeground ) {
mVBForeground->setQuadColor( mCurGridPos, Color::Transparent );
dirtyFG = true;
}
} else {
auto* gd = mFont->getGlyphDrawable( glyph.u, mFontSize, glyph.mode & ATTR_BOLD,
glyph.mode & ATTR_ITALIC, 0 );

View File

@@ -2740,6 +2740,7 @@ int TerminalEmulator::twrite( const char* buf, int buflen, int show_ctrl ) {
u = buf[n] & 0xFF;
charsize = 1;
}
if ( show_ctrl && ISCONTROL( u ) ) {
if ( u & 0x80 ) {
u &= 0x7f;

View File

@@ -424,7 +424,8 @@ void SpellCheckerPlugin::drawAfterLineText( UICodeEditor* editor, const Int64& i
for ( size_t i = 0; i < matches.size(); ++i ) {
auto& match = matches[i];
if ( match.lineHash != doc->getLineHash( index ) )
if ( match.lineHash != doc->getLineHash( index ) ||
doc->getLineLength( index ) > ( EE_1KB * 10 ) )
return;
Text line( "", editor->getFont(), editor->getFontSize() );