Changeset View
Changeset View
Standalone View
Standalone View
src/export/exporter.cpp
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Line(s) | 70 | { | |||
---|---|---|---|---|---|
82 | 82 | | |||
83 | exporter.reset(new HTMLExporter(m_view, output, !useSelection)); | 83 | exporter.reset(new HTMLExporter(m_view, output, !useSelection)); | ||
84 | 84 | | |||
85 | const KTextEditor::Attribute::Ptr noAttrib(nullptr); | 85 | const KTextEditor::Attribute::Ptr noAttrib(nullptr); | ||
86 | 86 | | |||
87 | for (int i = range.start().line(); (i <= range.end().line()) && (i < m_view->document()->lines()); ++i) { | 87 | for (int i = range.start().line(); (i <= range.end().line()) && (i < m_view->document()->lines()); ++i) { | ||
88 | const QString &line = m_view->document()->line(i); | 88 | const QString &line = m_view->document()->line(i); | ||
89 | 89 | | |||
90 | QList<KTextEditor::AttributeBlock> attribs = m_view->lineAttributes(i); | 90 | const QList<KTextEditor::AttributeBlock> attribs = m_view->lineAttributes(i); | ||
91 | 91 | | |||
92 | int lineStart = 0; | 92 | int lineStart = 0; | ||
93 | int remainingChars = line.length(); | 93 | int remainingChars = line.length(); | ||
94 | if (blockwise || range.onSingleLine()) { | 94 | if (blockwise || range.onSingleLine()) { | ||
95 | lineStart = range.start().column(); | 95 | lineStart = range.start().column(); | ||
96 | remainingChars = range.columnWidth(); | 96 | remainingChars = range.columnWidth(); | ||
97 | } else if (i == range.start().line()) { | 97 | } else if (i == range.start().line()) { | ||
98 | lineStart = range.start().column(); | 98 | lineStart = range.start().column(); | ||
99 | } else if (i == range.end().line()) { | 99 | } else if (i == range.end().line()) { | ||
100 | remainingChars = range.end().column(); | 100 | remainingChars = range.end().column(); | ||
101 | } | 101 | } | ||
102 | 102 | | |||
103 | int handledUntil = lineStart; | 103 | int handledUntil = lineStart; | ||
104 | 104 | | |||
105 | foreach (const KTextEditor::AttributeBlock & block, attribs) { | 105 | for (const KTextEditor::AttributeBlock &block : attribs) { | ||
106 | // honor (block-) selections | 106 | // honor (block-) selections | ||
107 | if (block.start + block.length <= lineStart) { | 107 | if (block.start + block.length <= lineStart) { | ||
108 | continue; | 108 | continue; | ||
109 | } else if (block.start >= lineStart + remainingChars) { | 109 | } else if (block.start >= lineStart + remainingChars) { | ||
110 | break; | 110 | break; | ||
111 | } | 111 | } | ||
112 | int start = qMax(block.start, lineStart); | 112 | int start = qMax(block.start, lineStart); | ||
113 | if (start > handledUntil) { | 113 | if (start > handledUntil) { | ||
Show All 16 Lines |