diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2017-04-23 13:48:47 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-04-24 08:35:49 -0700 |
commit | 1e6f0231e6b4689c6771e283847734f39e497df6 (patch) | |
tree | 856311dbe9d417c3c22488653da71c098ff94221 /qt-models | |
parent | 9b5d3b60abca206bcbee1def5be04b22f2f89523 (diff) | |
download | subsurface-1e6f0231e6b4689c6771e283847734f39e497df6.tar.gz |
Deal with additional line break in dive notes from planner
With current code when re-planning a dive the planner output in the
dive notes is always moved down by one line.
This fix avoids that this additional line break is added.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/diveplannermodel.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index 5075453d3..474384d63 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -894,11 +894,12 @@ void DivePlannerPointsModel::createPlan(bool replanCopy) notesDocument.setHtml(current_dive->notes); QString oldnotes(notesDocument.toPlainText()); int disclaimerPosition = oldnotes.indexOf(disclaimer); - if (disclaimerPosition >= 0) - oldnotes.truncate(disclaimerPosition); + if (disclaimerPosition == 0) + oldnotes.clear(); + else if (disclaimerPosition >= 1) + oldnotes.truncate(disclaimerPosition-1); // Deal with line breaks - notesDocument.setPlainText(oldnotes); - oldnotes = notesDocument.toHtml(); + oldnotes.replace("\n", "<br>"); oldnotes.append(displayed_dive.notes); displayed_dive.notes = strdup(oldnotes.toUtf8().data()); // If we save as new create a copy of the dive here |