Changeset View
Changeset View
Standalone View
Standalone View
src/render/katerenderer.cpp
Show All 24 Lines | |||||
25 | 25 | | |||
26 | #include "katedocument.h" | 26 | #include "katedocument.h" | ||
27 | #include "kateconfig.h" | 27 | #include "kateconfig.h" | ||
28 | #include "katehighlight.h" | 28 | #include "katehighlight.h" | ||
29 | #include "kateview.h" | 29 | #include "kateview.h" | ||
30 | #include "katerenderrange.h" | 30 | #include "katerenderrange.h" | ||
31 | #include "katetextlayout.h" | 31 | #include "katetextlayout.h" | ||
32 | #include "katebuffer.h" | 32 | #include "katebuffer.h" | ||
33 | #include "inlinenotedata.h" | ||||
33 | 34 | | |||
34 | #include "ktexteditor/inlinenote.h" | 35 | #include "ktexteditor/inlinenote.h" | ||
35 | #include "ktexteditor/inlinenoteprovider.h" | 36 | #include "ktexteditor/inlinenoteprovider.h" | ||
36 | 37 | | |||
37 | #include "katepartdebug.h" | 38 | #include "katepartdebug.h" | ||
38 | 39 | | |||
39 | #include <QFont> | 40 | #include <QFont> | ||
40 | #include <QPainter> | 41 | #include <QPainter> | ||
▲ Show 20 Lines • Show All 717 Lines • ▼ Show 20 Line(s) | 752 | while (i.hasNext()) { | |||
758 | 759 | | |||
759 | paintNonPrintableSpaces(paint, x - xStart, y, text[charIndex]); | 760 | paintNonPrintableSpaces(paint, x - xStart, y, text[charIndex]); | ||
760 | } | 761 | } | ||
761 | } | 762 | } | ||
762 | } | 763 | } | ||
763 | 764 | | |||
764 | // Draw inline notes | 765 | // Draw inline notes | ||
765 | const auto inlineNotes = m_view->inlineNotes(range->line()); | 766 | const auto inlineNotes = m_view->inlineNotes(range->line()); | ||
766 | for (const KTextEditor::InlineNote& inlineNote: inlineNotes) { | 767 | for (const auto& inlineNoteData: inlineNotes) { | ||
767 | int column = inlineNote.column(); | 768 | KTextEditor::InlineNote inlineNote(inlineNoteData); | ||
769 | const int column = inlineNote.position().column(); | ||||
768 | int viewLine = range->viewLineForColumn(column); | 770 | int viewLine = range->viewLineForColumn(column); | ||
769 | 771 | | |||
770 | // Determine the position where to paint the note. | 772 | // Determine the position where to paint the note. | ||
771 | // We start by getting the x coordinate of cursor placed to the column. | 773 | // We start by getting the x coordinate of cursor placed to the column. | ||
772 | qreal x = range->viewLine(viewLine).lineLayout().cursorToX(column) - xStart; | 774 | qreal x = range->viewLine(viewLine).lineLayout().cursorToX(column) - xStart; | ||
773 | int textLength = range->length(); | 775 | int textLength = range->length(); | ||
774 | if (column == 0 || column < textLength) { | 776 | if (column == 0 || column < textLength) { | ||
775 | // If the note is inside text or at the beginning, then there is a hole in the text where the | 777 | // If the note is inside text or at the beginning, then there is a hole in the text where the | ||
▲ Show 20 Lines • Show All 266 Lines • ▼ Show 20 Line(s) | 1004 | { | |||
1042 | 1044 | | |||
1043 | // Syntax highlighting, inbuilt and arbitrary | 1045 | // Syntax highlighting, inbuilt and arbitrary | ||
1044 | QVector<QTextLayout::FormatRange> decorations = decorationsForLine(textLine, lineLayout->line()); | 1046 | QVector<QTextLayout::FormatRange> decorations = decorationsForLine(textLine, lineLayout->line()); | ||
1045 | 1047 | | |||
1046 | int firstLineOffset = 0; | 1048 | int firstLineOffset = 0; | ||
1047 | 1049 | | |||
1048 | const auto inlineNotes = m_view->inlineNotes(lineLayout->line()); | 1050 | const auto inlineNotes = m_view->inlineNotes(lineLayout->line()); | ||
1049 | for (const KTextEditor::InlineNote& inlineNote: inlineNotes) { | 1051 | for (const KTextEditor::InlineNote& inlineNote: inlineNotes) { | ||
1050 | int column = inlineNote.column(); | 1052 | const int column = inlineNote.position().column(); | ||
1051 | int width = inlineNote.width(); | 1053 | int width = inlineNote.width(); | ||
1052 | 1054 | | |||
1053 | // Make space for every inline note. | 1055 | // Make space for every inline note. | ||
1054 | // If it is on column 0 (at the beginning of the line), we must offset the first line. | 1056 | // If it is on column 0 (at the beginning of the line), we must offset the first line. | ||
1055 | // If it is inside the text, we use absolute letter spacing to create space for it between the two letters. | 1057 | // If it is inside the text, we use absolute letter spacing to create space for it between the two letters. | ||
1056 | // If it is outside of the text, we don't have to make space for it. | 1058 | // If it is outside of the text, we don't have to make space for it. | ||
1057 | if (column == 0) { | 1059 | if (column == 0) { | ||
1058 | firstLineOffset = width; | 1060 | firstLineOffset = width; | ||
▲ Show 20 Lines • Show All 149 Lines • Show Last 20 Lines |