ide: repo diff fixes

This commit is contained in:
Mirek Fidler 2023-10-18 11:25:15 +02:00
parent bf9b09b8af
commit 4e28164ebf
5 changed files with 12 additions and 11 deletions

View file

@ -217,16 +217,15 @@ bool HasCrs(const String& path)
void DiffDlg::Write()
{
revert.Enable();
if(diff.right.IsSelection()) {
SaveFile(editfile, diff.Merge(true, HasCrs(editfile)));
Refresh();
revert.Enable();
return;
}
if(PromptYesNo("Do you want to overwrite&[* " + DeQtf(editfile) + "] ?")) {
SaveFile(editfile, extfile);
Break(IDOK);
revert.Enable();
Close();
}
}

View file

@ -125,8 +125,13 @@ void LoadGitRevisions(DropList& r, const String& dir, const String& branch, cons
break;
msg << l;
}
if(commit.GetCount())
r.Add(commit, "\1[g [@b \1" + date + "\1] [@r \1" + author + "\1]: [* \1" + Join(Split(msg, CharFilterWhitespace), " "));
if(commit.GetCount()) {
String h = commit;
if(h.GetCount() > 4)
h.Trim(4);
r.Add(commit, "\1[g [@b \1" + date + "\1] [@g \1" + h + "\1] [@r \1" + author + "\1]: "
"[* \1" + Join(Split(msg, CharFilterWhitespace), " "));
}
date = commit = author = Null;
}
else

View file

@ -173,8 +173,4 @@ void DirRepoDiffDlg::Compare()
};
if(Clone(0, dir1, lmid) && Clone(1, dir2, rmid))
DirDiffDlg::Compare();
if(IsGit(0))
dir1 <<= Null;
if(IsGit(1))
dir2 <<= Null;
}

View file

@ -868,7 +868,9 @@ void Ide::CheckFileUpdate()
if(!editor.IsView() && !editor.IsReadOnly() && editor.GetUndoCount() &&
max((int64)editor.GetLength(), ff.GetLength()) < 30*1024*1024) {
ApplyChanges(editor, LoadFile(editfile));
int c = editor.GetCursor();
ApplyChanges(editor, LoadFile(editfile));
editor.SetCursor(c);
editor.ClearDirty(); // as it is "loaded"
}
else

View file

@ -490,7 +490,6 @@ void Ide::DoDirDiff()
dlg.Dir1(dir[1]);
dlg.SetFont(veditorfont);
dlg.Maximize();
dlg.Title("Compare directories");
dlg.OpenMain();
}