mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
9b5d3b60ab
commit
1e6f0231e6
1 changed files with 5 additions and 4 deletions
|
@ -894,11 +894,12 @@ void DivePlannerPointsModel::createPlan(bool replanCopy)
|
||||||
notesDocument.setHtml(current_dive->notes);
|
notesDocument.setHtml(current_dive->notes);
|
||||||
QString oldnotes(notesDocument.toPlainText());
|
QString oldnotes(notesDocument.toPlainText());
|
||||||
int disclaimerPosition = oldnotes.indexOf(disclaimer);
|
int disclaimerPosition = oldnotes.indexOf(disclaimer);
|
||||||
if (disclaimerPosition >= 0)
|
if (disclaimerPosition == 0)
|
||||||
oldnotes.truncate(disclaimerPosition);
|
oldnotes.clear();
|
||||||
|
else if (disclaimerPosition >= 1)
|
||||||
|
oldnotes.truncate(disclaimerPosition-1);
|
||||||
// Deal with line breaks
|
// Deal with line breaks
|
||||||
notesDocument.setPlainText(oldnotes);
|
oldnotes.replace("\n", "<br>");
|
||||||
oldnotes = notesDocument.toHtml();
|
|
||||||
oldnotes.append(displayed_dive.notes);
|
oldnotes.append(displayed_dive.notes);
|
||||||
displayed_dive.notes = strdup(oldnotes.toUtf8().data());
|
displayed_dive.notes = strdup(oldnotes.toUtf8().data());
|
||||||
// If we save as new create a copy of the dive here
|
// If we save as new create a copy of the dive here
|
||||||
|
|
Loading…
Reference in a new issue