From dfe509222271a66d8852d3f16542e6b1420fb0eb Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Wed, 19 Apr 2017 15:40:59 +0200 Subject: Identify user provided notes in plain text in replan This is another attept at the problem if identifying a potentially user supplied text in the dive notes upon replannig a dive. It gets rid of the user visable position markers (*!* and ***) and cirumvents problems with mark-up by first converting the old notes to plan text (assuming that user only enters plain text in the notes field as we do in other places as well). Then the automatically added part is identified by locating the disclaimer in the text (if the user edited/delted the disclaimer or changed langue in between it is her problem to manually delete the old plan). Everything from the disclaimer on is deleted and replaced by the new plan. If the disclaimer is not found, the new plan is appended to the old notes. This way we make sure no information gets automatically deleted. Signed-off-by: Robert C. Helling --- core/planner.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/planner.c') diff --git a/core/planner.c b/core/planner.c index 27c179508..f9acc155d 100644 --- a/core/planner.c +++ b/core/planner.c @@ -588,10 +588,10 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool return; } - len = show_disclaimer ? snprintf(buffer, sz_buffer, "
*!* %s
", disclaimer) : 0; + len = show_disclaimer ? snprintf(buffer, sz_buffer, "
%s
", disclaimer) : 0; if (diveplan->surface_interval > 60) { - len += snprintf(buffer + len, sz_buffer - len, "
*** %s (%s) %s %d:%02d) %s %s
", + len += snprintf(buffer + len, sz_buffer - len, "
%s (%s) %s %d:%02d) %s %s
", translate("gettextFromC", "Subsurface"), subsurface_canonical_version(), translate("gettextFromC", "dive plan
(surface interval "), @@ -599,7 +599,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool translate("gettextFromC", "created on"), get_current_date()); } else { - len += snprintf(buffer + len, sz_buffer - len, "
*** %s (%s) %s %s
", + len += snprintf(buffer + len, sz_buffer - len, "
%s (%s) %s %s
", translate("gettextFromC", "Subsurface"), subsurface_canonical_version(), translate("gettextFromC", "dive plan
created on"), -- cgit v1.2.3-70-g09d2