Added side by side view in the diff viewer, allow to change view mode with a switch. Performance improvements and more.

This commit is contained in:
Martín Lucas Golini
2026-03-24 13:34:56 -03:00
parent 21013a69aa
commit 534c052722
8 changed files with 256 additions and 74 deletions

View File

@@ -1115,20 +1115,8 @@ void GitPlugin::diff( const std::string& file, bool isStaged ) {
if ( res.fail() )
return;
getUISceneNode()->runOnMainThread( [this, file, res] {
auto* diffView = Tools::UIDiffView::New();
auto [tab, iv] = getPluginContext()->getSplitter()->createWidget(
diffView, i18n( "diff_viewer", "Diff Viewer" ) );
std::string fileName = FileSystem::fileNameFromPath( file );
tab->setText( fileName )->setTooltipText( file );
UIIcon* icon = getUISceneNode()->findIcon(
UIIconThemeManager::getIconNameFromFileName( fileName ) );
if ( !icon )
icon = getUISceneNode()->findIcon( "file" );
if ( icon )
tab->setIcon( icon->getSize( getPluginContext()->getMenuIconSize() ) );
diffView->loadFromPatch( res.result );
} );
getUISceneNode()->runOnMainThread(
[this, file, res] { getPluginContext()->loadDiffFromMemory( res.result, file ); } );
} );
}