GIT_SILENT
Details
- Reviewers
cullmann - Group Reviewers
Kate - Commits
- R39:328adb52d3db: Use QString::count(QChar)+1 over QString::splitRef().length()
Diff Detail
- Repository
- R39 KTextEditor
- Branch
- morecountoversplit
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 16314 Build 16332: arc lint + arc unit
src/vimode/modes/normalvimode.cpp | ||
---|---|---|
3848 ↗ | (On Diff #65228) | oh I see, how about just using splitRef? This way we don't have to allocate all the strings but the code still is more readable. |
Yes, someone missed in their brain to properly turn - (x + 1) into - x - 1, just happened again with me when redoing the code in brain on first try, darn.
As main idea of logic is: "fulllength" - "length of all chars up to last linebreak", so "length" - "lastindex + 1"
So example:
012345 <- pos CCCNCC <- pasted text, C: char, N: newline -> size: 6 last N pos: 3 last line length: 2 const int lastLineLength = 6 - (3 + 1) -> 2,
Adding brackets now, so the original idea is visible
src/vimode/modes/normalvimode.cpp | ||
---|---|---|
3848 ↗ | (On Diff #65228) | Still one allocation done for the vector ;) Not sure about readibility. While the mistake done in formula spoils my point, I find the new code more readable, as the splitref would make me expect more sections are used, while it is just a hack to get the precalculated length of the last section, with info about all other sections discarded. |