rgburke/grv

Problem in diff for lines starting with ```%```

PierreRust opened this issue · 4 comments

When displaying a diff (in status view), the output is wrong if the line starts with % .
This happens quite lot when editing latex files, whose comments start with %

For example, when adding a line like this :

% Simple Comment in a .tex file

grv displays this as a diff

%!S(MISSING)imple Comment in a .tex file

This seems to be an issue with go:fmt which tries to interpret % as a formatting command.

I forgot to mention : this happens both with fancy and git diff-display modes

It doesn't have to be at the beginning of a line. I have two mid-line examples of this:

  • "cut:x%" is displayed as "cut:x%!"(MISSING)
  • /^\s*cut:\s*([0-9.,]+)\s*(%)\s*$/; is displayed as /^\s*cut:\s*([0-9.,]+)\s*(%!)(MISSING)\s*$/;

My theory is the same as @PierreRust's.

Thanks for reporting this issue. You're correct that it's due to a Sprintf interpreting anything starting with a % as a format specifier. This should now be fixed on master.

Thanks @rgburke for looking into this. Is there any chance this fixed version could be released? I don't have a Go compilation environment.