Changeset View
Changeset View
Standalone View
Standalone View
src/buffer/katetextline.cpp
Show First 20 Lines • Show All 199 Lines • ▼ Show 20 Line(s) | 198 | if ((attribute.foldingValue == 0) && !m_attributesList.isEmpty() && (m_attributesList.back().foldingValue == 0) | |||
---|---|---|---|---|---|
200 | && ((m_attributesList.back().offset + m_attributesList.back().length) == attribute.offset)) { | 200 | && ((m_attributesList.back().offset + m_attributesList.back().length) == attribute.offset)) { | ||
201 | m_attributesList.back().length += attribute.length; | 201 | m_attributesList.back().length += attribute.length; | ||
202 | return; | 202 | return; | ||
203 | } | 203 | } | ||
204 | 204 | | |||
205 | m_attributesList.append(attribute); | 205 | m_attributesList.append(attribute); | ||
206 | } | 206 | } | ||
207 | 207 | | |||
208 | short TextLineData::attribute(int pos) const | ||||
209 | { | ||||
210 | auto found = std::upper_bound(m_attributesList.cbegin(), m_attributesList.cend(), pos, | ||||
211 | [](const int &p, const Attribute &x) { | ||||
212 | return p < x.offset + x.length; | ||||
213 | }); | ||||
214 | if (found != m_attributesList.cend() && found->offset <= pos && pos < (found->offset + found->length)) { | ||||
215 | return found->attributeValue; | ||||
216 | } | ||||
anthonyfieroni: Use operator->, it's faster than operator* and operator.
```
first->offset
``` | |||||
sorry, but that's simply not true at all. Stylistic wise I agree, but an optimizing compiler will generate the same code for both. mwolff: sorry, but that's simply not true at all.
Stylistic wise I agree, but an optimizing compiler… | |||||
217 | return 0; | ||||
218 | } | ||||
219 | | ||||
208 | } | 220 | } |
Use operator->, it's faster than operator* and operator.