From 3be4b5f96a47e34cea65e377434f3acff9480a73 Mon Sep 17 00:00:00 2001 From: Ryan Jensen Date: Fri, 23 Feb 2024 19:31:59 -0600 Subject: [PATCH] Move commit messages closer to commit graph (compact mode) also fix incorrect file name in README.md --- LICENSE.md | 2 +- README.md | 2 +- src/ui/CommitList.cpp | 28 ++++++++++++++-------------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 76c1c167..4722beb8 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,7 @@ MIT License Copyright (c) 2018 Scientific Toolworks, Inc. -Copyright (c) 2021-2023 Gittyup contributors +Copyright (c) 2021-2024 Gittyup contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 27bd67bc..d4a82b46 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,7 @@ branch. Create pull requests against the `master` branch. Follow the [seven guidelines](https://chris.beams.io/posts/git-commit/) to writing a great commit message. -Prior to committing a change, please use `cl-format.sh` to ensure your code +Prior to committing a change, please use `cl-fmt.sh` to ensure your code adheres to the formatting conventions for this project. You can also use the `setup-env.sh` script to install a pre-commit hook which will automatically run `clang-format` against all modified files. diff --git a/src/ui/CommitList.cpp b/src/ui/CommitList.cpp index e018ee32..21a923f5 100644 --- a/src/ui/CommitList.cpp +++ b/src/ui/CommitList.cpp @@ -829,6 +829,20 @@ public: rect.setWidth(rect.width() - timestampWidth - constants.hMargin); } + // Draw Name. + if (showAuthor) { + QString name = commit.author().name() + " "; + painter->save(); + QFont bold = opt.font; + bold.setBold(true); + painter->setFont(bold); + painter->drawText(rect, Qt::AlignRight, name); + painter->restore(); + const QFontMetrics boldFm(bold); + rect.setWidth(rect.width() - boldFm.horizontalAdvance(name) - + constants.hMargin); + } + // Calculate remaining width for the references. QRect ref = rect; int refsWidth = ref.width() - minWidthDesc; @@ -847,20 +861,6 @@ public: badgesWidth = Badge::paint(painter, refs, ref, &opt, Qt::AlignLeft); rect.setX(badgesWidth); // Comes right after the badges - // Draw Name. - if (showAuthor) { - QString name = commit.author().name(); - painter->save(); - QFont bold = opt.font; - bold.setBold(true); - painter->setFont(bold); - painter->drawText(rect, Qt::AlignLeft, name); - painter->restore(); - const QFontMetrics boldFm(bold); - rect.setX(rect.x() + boldFm.horizontalAdvance(name) + - constants.hMargin); - } - // Draw message. painter->save(); painter->setPen(bright);