From a2f9abaee76c854e7d549c2e0bd009d9cc82007b Mon Sep 17 00:00:00 2001 From: Mirek Fidler Date: Wed, 18 Dec 2024 17:01:04 +0100 Subject: [PATCH] ide: Git history of file Copy Hash button --- uppsrc/ide/Diff.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/uppsrc/ide/Diff.cpp b/uppsrc/ide/Diff.cpp index 6d1b0516d..d2720faa4 100644 --- a/uppsrc/ide/Diff.cpp +++ b/uppsrc/ide/Diff.cpp @@ -3,6 +3,7 @@ struct RepoDiff : DiffDlg { FrameTop pane; DropList r, branch; + Button copy_hash; String repo_dir; int kind; @@ -65,7 +66,16 @@ void RepoDiff::Set(const String& f) if(kind == GIT_DIR) { pane << branch.LeftPos(0, Zx(100)).VSizePos() - << r.HSizePos(Zx(100) + DPI(2), 0).VSizePos(); + << r.HSizePos(Zx(100) + DPI(2), Zx(80) + DPI(2)).VSizePos() + << copy_hash.RightPos(0, Zx(80)).VSizePos(); + copy_hash.SetLabel("Copy Hash"); + + copy_hash << [=] { + String h = ~~r; + String commit, path; + SplitTo(h, ':', commit, path); + WriteClipboardText(commit); + }; LoadBranches(branch, GetFileFolder(f)); LoadGit();