mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-07 17:15:26 +00:00
HackStudio: Indicate git changes in the editor's gutter
"+" for added lines, "!" for changed, "-" for removed.
This commit is contained in:
committed by
Linus Groh
parent
8501617fcb
commit
d5828dbecb
@@ -92,6 +92,7 @@ void EditorWrapper::set_filename(const String& filename)
|
||||
{
|
||||
m_filename = filename;
|
||||
update_title();
|
||||
update_diff();
|
||||
}
|
||||
|
||||
void EditorWrapper::save()
|
||||
@@ -99,6 +100,32 @@ void EditorWrapper::save()
|
||||
editor().write_to_file(filename());
|
||||
m_document_dirty = false;
|
||||
update_title();
|
||||
update_diff();
|
||||
editor().update();
|
||||
}
|
||||
|
||||
void EditorWrapper::update_diff()
|
||||
{
|
||||
if (m_git_repo)
|
||||
m_hunks = Diff::parse_hunks(m_git_repo->unstaged_diff(LexicalPath(filename())).value());
|
||||
}
|
||||
|
||||
void EditorWrapper::set_project_root(LexicalPath const& project_root)
|
||||
{
|
||||
m_project_root = project_root;
|
||||
|
||||
auto result = GitRepo::try_to_create(m_project_root);
|
||||
switch (result.type) {
|
||||
case GitRepo::CreateResult::Type::Success:
|
||||
m_git_repo = result.repo;
|
||||
break;
|
||||
case GitRepo::CreateResult::Type::GitProgramNotFound:
|
||||
break;
|
||||
case GitRepo::CreateResult::Type::NoGitRepo:
|
||||
break;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
void EditorWrapper::update_title()
|
||||
|
||||
Reference in New Issue
Block a user