Skip to content

Commit

Permalink
String|libcore: Added missing += operator
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent a515e1c commit 9c78bef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doomsday/libs/core/include/de/data/string.h
Expand Up @@ -94,6 +94,8 @@ struct StronglyTypedPosition
Pos &operator+=(long sub) { if (index != npos) { index += sub; } return *this; }
Pos &operator-=(long sub) { if (index != npos) { index -= sub; } return *this; }

Pos &operator+=(const Pos &p) { if (index != npos && p.index != npos) { index += p.index; } return *this; }

Pos operator+(const Pos &p) const { return Pos{index != npos ? index + p.index : npos}; }
Pos operator-(Pos p) const { return Pos(index != npos ? index - p.index : npos); }
Pos operator++(int) { Pos p = *this; if (index != npos) index++; return p; }
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libs/core/src/widgets/abstractlineeditor.cpp
Expand Up @@ -173,7 +173,7 @@ DE_PIMPL(AbstractLineEditor)
{
acceptCompletion();
text.insert(cursor, str);
cursor += str.size();
cursor += str.sizeb();
rewrapNow();
}

Expand Down

0 comments on commit 9c78bef

Please sign in to comment.