Fossil Forum

`fossil diff --by' may treat CR+LF as two lines
Login

`fossil diff --by' may treat CR+LF as two lines

`fossil diff --by' may treat CR+LF as two lines

(1) By Florian Balmer (florian.balmer) on 2022-10-06 04:20:41 [source]

I've noticed a minor glitch with the fossil diff --by command in conjunction with CR+LF line endings, i.e. it looks like CR+LF may "inject" additional lines in some cases:

Left snippet (must be saved with CR+LF line endings):

set "__CLEAN=0"
set "__CLEANRC=0"
set "__BUILD=1"

:parse_args
if /I "%~1" == "clean" (
  set "__CLEAN=1"
  if not "%__BUILD%" == "2" set "__BUILD=0"
  shift /1
  goto :parse_args
)
if /I "%~1" == "cleanrc" (
  set "__CLEANRC=1"
  if not "%__BUILD%" == "2" set "__BUILD=0"
  shift /1
  goto :parse_args
)
if /I "%~1" == "build" (
  set "__BUILD=2"
  shift /1
  goto :parse_args
)

Right snippet (must be saved with CR+LF line endings):

set "__BUILD=1"
set "__CLEAN=0"

:parse_args
if /I "%~1" == "build" (
  set "__BUILD=2"
  shift /1
  goto :parse_args
)
if /I "%~1" == "clean" (
  set "__CLEAN=2"
  if not "%__BUILD%" == "2" set "__BUILD=0"
  shift /1
  goto :parse_args
)
if /I "%~1" == "cleanrc" (
  if not "%__CLEAN%" == "2" set "__CLEAN=1"
  if not "%__BUILD%" == "2" set "__BUILD=0"
  shift /1
  goto :parse_args
)

(2) By Richard Hipp (drh) on 2022-10-06 14:35:10 in reply to 1 [link] [source]

Please try the latest trunk check-in and let me know whether or not this clears your problem without causing any new issues.

(3) By Florian Balmer (florian.balmer) on 2022-10-07 04:36:20 in reply to 2 [link] [source]

Thank you very much for taking care of this so quickly!

The web UI diffs seem to work as before. (At least I think so, but I'll send feedback if I'm wrong.)

For fossil diff --by, I've noticed the "injection" of extra lines is fixed, but the red/green/blue background color now extends beyond the end of the line, with the additional highlight region selectable as a space character, and also added to the lines if copied to clipboard.

This is only a minor problem, and less irritating from a visual point of view. However, I've got the habit to copy snippets from diffs to clipboard, and now also get the extra trailing spaces on pasting.

(Anything else output by Fossil is "ready to copy-and-paste", in particular the diffs output on the command line, and also on the /vpatch page, which is really handy.)