Changeset View
Changeset View
Standalone View
Standalone View
src/editor.cpp
Show First 20 Lines • Show All 131 Lines • ▼ Show 20 Line(s) | |||||
132 | 132 | | |||
133 | void Editor::textChanged(int pos, int removed, int added) | 133 | void Editor::textChanged(int pos, int removed, int added) | ||
134 | { | 134 | { | ||
135 | Q_UNUSED(pos); | 135 | Q_UNUSED(pos); | ||
136 | if (removed == 0 && added == 0) return; // save some cpu cycles | 136 | if (removed == 0 && added == 0) return; // save some cpu cycles | ||
137 | removeMarkings(); // removes the character markings if there are any | 137 | removeMarkings(); // removes the character markings if there are any | ||
138 | int lineCount = 1; | 138 | int lineCount = 1; | ||
139 | for (QTextBlock block = editor->document()->begin(); block.isValid(); block = block.next()) lineCount++; | 139 | for (QTextBlock block = editor->document()->begin(); block.isValid(); block = block.next()) lineCount++; | ||
140 | numbers->setWidth(qMax(1, 1 + (int)std::floor(std::log10((double)lineCount - 1)))); | 140 | numbers->setWidth(qMax(1, 1 + static_cast<int>(std::floor(std::log10(static_cast<double>(lineCount) - 1))))); | ||
141 | 141 | | |||
142 | emit contentChanged(); | 142 | emit contentChanged(); | ||
143 | } | 143 | } | ||
144 | 144 | | |||
145 | 145 | | |||
146 | bool Editor::newFile() | 146 | bool Editor::newFile() | ||
147 | { | 147 | { | ||
148 | if (maybeSave()) { | 148 | if (maybeSave()) { | ||
▲ Show 20 Lines • Show All 317 Lines • Show Last 20 Lines |