Fossil User Forum

Fix pikchrshow for pikchrs with brackets
Login

Fix pikchrshow for pikchrs with brackets

Fix pikchrshow for pikchrs with brackets

(1) By anonymous on 2021-10-05 20:53:14 [source]

When doing a minimal pikchr with an error like

/*    1 */  box
/*    2 */  arrow from 1/2<last.ne, last.se> inv
                                             ^^^
ERROR: syntax error

the syntax error arrows point at the wrong spot because line is not fully printed. This is because the brackets in 1/2<last.ne, last.se> are passed through directly to the browser which thinks this is an HTML tag. Formatting error messages with %h seems to fix the problem.

Index: src/pikchrshow.c
==================================================================
--- src/pikchrshow.c
+++ src/pikchrshow.c
@@ -214,11 +214,11 @@
       }else{
         isErr = 2;
         if(PIKCHR_PROCESS_ERR_PRE & pikFlags){
           blob_append(pOut, "<pre class='error'>\n", 20);
         }
-        blob_append(pOut, zOut, -1);
+        blob_appendf(pOut, "%h", zOut);
         if(PIKCHR_PROCESS_ERR_PRE & pikFlags){
           blob_append(pOut, "\n</pre>\n", 8);
         }
       }
       fossil_free(zOut);

(2) By sean (jungleboogie) on 2021-10-05 22:25:18 in reply to 1 [link] [source]