Skip to content

Commit

Permalink
fix time links ending with a comma, some refactoring #12 fix #14931
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Jun 15, 2024
1 parent 239bd2e commit f778750
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/utils/gui/div/GUIMessageWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ GUIMessageWindow::getActiveStringObject(const FXString& text, const FXint pos, c
}

SUMOTime
GUIMessageWindow::getTimeString(const FXString& text, const FXint pos, const FXint /*lineS*/, const FXint /*lineE*/) const {
const FXint end = text.find(" ", pos + 1);
GUIMessageWindow::getTimeString(const FXString& text, const FXint pos) const {
const FXint end = text.find_first_of(" ,", pos + 1);
std::string time;
if (end >= 0) {
time = text.mid(pos, end - pos).text();
Expand Down Expand Up @@ -173,7 +173,7 @@ GUIMessageWindow::setCursorPos(FXint pos, FXbool notify) {
timePos += (int)std::string(TL(" time")).size() + 1;
SUMOTime t = -1;
if (pos >= 0 && pos > start + timePos) {
t = getTimeString(candidate, timePos, 0, (int)candidate.length());
t = getTimeString(candidate, timePos);
if (t >= 0) {
t += myBreakPointOffset;
std::vector<SUMOTime> breakpoints = myMainWindow->retrieveBreakpoints();
Expand Down Expand Up @@ -244,7 +244,7 @@ GUIMessageWindow::appendMsg(GUIEventType eType, const std::string& msg) {
const int timeTerm = (int)std::string(TL(" time")).size() + 1;
SUMOTime t = -1;
if (pos >= 0) {
t = getTimeString(text, pos + timeTerm, 0, text.length());
t = getTimeString(text, pos + timeTerm);
}
if (t >= 0) {
FXString insText = text.left(pos + timeTerm);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/gui/div/GUIMessageWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class GUIMessageWindow : public FXText {
const GUIGlObject* getActiveStringObject(const FXString& text, const FXint pos, const FXint lineS, const FXint lineE) const;

/// @brief get time string object
SUMOTime getTimeString(const FXString& text, const FXint pos, const FXint lineS, const FXint lineE) const;
SUMOTime getTimeString(const FXString& text, const FXint pos) const;

/// @brief fill styles
void fillStyles();
Expand Down

0 comments on commit f778750

Please sign in to comment.