Commit 363e4d35 authored by Kåre Särs's avatar Kåre Särs
Browse files

Git-blame: Make longest line clickable

Clicking on the cursor at the end of a line that is longer than the
width of the view-port you can now open the tool-tip.

Improve the inline note painting size calculation.
parent 0fac8512
......@@ -70,7 +70,7 @@ QVector<int> GitBlameInlineNoteProvider::inlineNotes(int line) const
int lineLen = m_doc->line(line).size();
for (const auto view: m_doc->views()) {
if (view->cursorPosition().line() == line) {
return QVector<int>{lineLen + 4};
return QVector<int>{lineLen};
}
}
return QVector<int>();
......@@ -90,10 +90,8 @@ void GitBlameInlineNoteProvider::paintInlineNote(const KTextEditor::InlineNote &
int lineNr = note.position().line();
const KateGitBlameInfo &info = m_plugin->blameInfo(lineNr, m_doc->line(lineNr));
QString text = QStringLiteral(" %1: %2").arg(info.name, m_locale.toString(info.date, QLocale::NarrowFormat));
QRect rectangle = fm.boundingRect(text);
rectangle.setWidth(rectangle.width() * 1.01);
rectangle.moveTo(0,0);
QString text = QStringLiteral(" %1: %2 ").arg(info.name, m_locale.toString(info.date, QLocale::NarrowFormat));
QRect rectangle{30, 0, fm.horizontalAdvance(text), note.lineHeight()};
auto editor = KTextEditor::Editor::instance();
auto color = QColor::fromRgba(editor->theme().textColor(KSyntaxHighlighting::Theme::Normal));
......@@ -101,7 +99,7 @@ void GitBlameInlineNoteProvider::paintInlineNote(const KTextEditor::InlineNote &
painter.setPen(color);
color.setAlpha(10);
painter.setBrush(color);
painter.drawRect(0,0, rectangle.width(), note.lineHeight());
painter.drawRect(rectangle);
color.setAlpha(note.underMouse() ? 130 : 90);
painter.setPen(color);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment