Optimize bulk editor setup, deferred UI resources and Git plugin fixes

- Lazily compute document line hashes, avoid redundant multiline insertion
walks, and defer longest-line measurement for large or exceptionally long
text changes.

- Cache default code editor keybindings, reserve common command storage, and
create UIDiffView image viewers only when an image diff requires them.

- Keep cached screen positions coherent when descendants are queried before
dirty ancestors, and add regression coverage for ancestor movement.

- Relocate font-rendering golden images into the unit-test asset directory
and resolve image fixtures independently of the current working directory.

- Fix spurious status entries for files moved between directories. Preserve the suffix after Git's abbreviated brace notation when parsing renamed paths from numstat output. This prevents directory moves such as `bin/{ => unit_tests}/assets/...` from producing truncated synthetic untracked entries like `unit_tests`. Add regression coverage for staged files moved into a different directory.

- Git Plugin now remembers between sessions the uncommited commit message.
This commit is contained in:
Martín Lucas Golini
2026-08-30 01:05:24 -03:00
parent caba2d4462
commit 3afcb3f2d2
17 changed files with 439 additions and 89 deletions
+3 -2
View File
@@ -1424,11 +1424,12 @@ Git::Status Git::status( bool recurseSubmodules, const std::string& projectDir )
}
if ( isBinary || ( inserts || deletes ) ) {
std::string rptrn( "(.*)%{.*%s->%s(.*)%}" );
std::string rptrn( "(.*)%{.*%s->%s(.*)%}(.*)" );
LuaPattern pattern( rptrn );
if ( pattern.matches( file.data(), 0, matches, file.size() ) ) {
file = file.substr( matches[1].start, matches[1].end - matches[1].start ) +
file.substr( matches[2].start, matches[2].end - matches[2].start );
file.substr( matches[2].start, matches[2].end - matches[2].start ) +
file.substr( matches[3].start, matches[3].end - matches[3].start );
}
auto filePath = subModulePath + file;
+13
View File
@@ -8,6 +8,7 @@
#include <eepp/graphics/image.hpp>
#include <eepp/graphics/primitives.hpp>
#include <eepp/scene/scenemanager.hpp>
#include <eepp/system/base64.hpp>
#include <eepp/system/filesystem.hpp>
#include <eepp/system/luapattern.hpp>
#include <eepp/system/scopedop.hpp>
@@ -255,6 +256,12 @@ GitPlugin::~GitPlugin() {
Sys::sleep( Milliseconds( 1.f ) );
}
void GitPlugin::onSaveState( IniFile* state ) {
std::string commitMessage;
Base64::encode( mLastCommitMsg.toUtf8(), commitMessage );
state->setValue( "git", "commit_message", commitMessage );
}
void GitPlugin::runAsyncTask( std::function<void()> task ) {
auto runningTasks = mRunningAsyncTasks;
++*runningTasks;
@@ -348,6 +355,12 @@ void GitPlugin::load( PluginManager* pluginManager ) {
}
}
std::string commitMessage;
Base64::decode(
getPluginContext()->getConfig().iniState.getValue( "git", "commit_message", "" ),
commitMessage );
mLastCommitMsg = String::fromUtf8( commitMessage );
if ( mKeyBindings.empty() ) {
mKeyBindings["git-blame"] = "alt+shift+b";
}
@@ -87,6 +87,8 @@ class GitPlugin : public PluginBase {
void registerSettings( SettingsPage& page ) override;
void onSaveState( IniFile* state ) override;
void onFileSystemEvent( const FileEvent& ev, const FileInfo& file ) override;
FileSystemListenerOptions getFileSystemListenerOptions() const override;