PR-4.3-dev
avatar RickR2H
RickR2H
10 Mar 2023

Steps to reproduce the issue

  1. Create a template override
  2. Go to a file of the override
  3. Edit the file and save
  4. The whole area is now colored and not only the changed lines. Even when no change is made, the area is colored.

Edit:
The issue is that windows uses CRLF line endings. When a file is saved in the template editor the files gets converted to LF. Because of the difference between the line endings, all lines are marked as changed.

diff-colors

System information (as much as possible)

Windows WAMP server

Additional comments

This is an issue create due to a discussion on #38823

avatar RickR2H RickR2H - open - 10 Mar 2023
avatar RickR2H RickR2H - change - 10 Mar 2023
Labels Removed: ?
avatar RickR2H RickR2H - labeled - 10 Mar 2023
avatar joomla-cms-bot joomla-cms-bot - change - 10 Mar 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 10 Mar 2023
avatar RickR2H RickR2H - change - 10 Mar 2023
The description was changed
avatar RickR2H RickR2H - edited - 10 Mar 2023
avatar RickR2H
RickR2H - comment - 10 Mar 2023

@brianteeman issue is created.

avatar RickR2H RickR2H - change - 10 Mar 2023
The description was changed
avatar RickR2H RickR2H - edited - 10 Mar 2023
avatar RickR2H
RickR2H - comment - 10 Mar 2023

@jfcherng Did some testing on Linux and the problem is not there. Is seems to be installation specific...

avatar jfcherng
jfcherng - comment - 10 Mar 2023

I doubt that the original PHP file is \n line ending, which makes sense. And after saving on Windows via PHP, it's converted into \r\n or maybe the browser is smart enough so it uses \r\n in for the textarea and send the content to backend for saving. But I am not sure why Brian can't reproduce that.

avatar RickR2H
RickR2H - comment - 10 Mar 2023

My windows machine saves the files as CRLF and when I convert the file back to LF the diff works.

avatar RickR2H
RickR2H - comment - 10 Mar 2023

I guess there is no simple solution. The only options is to compare the line endings on save and make sure they are the same for the original and the override. Forcing LF could be an option. @jfcherng do you have so an ideas how solve the issue?

avatar jfcherng
jfcherng - comment - 10 Mar 2023

I can add a new option to my diff lib so that it removes line ending chars before doing diff.

avatar RickR2H
RickR2H - comment - 10 Mar 2023

I guess that will fix things.

avatar RickR2H RickR2H - change - 10 Mar 2023
The description was changed
avatar RickR2H RickR2H - edited - 10 Mar 2023
avatar RickR2H
RickR2H - comment - 10 Mar 2023

@jfcherng if you have a fix, please mention @brianteeman so he can update the library. After the update I'll make sure it gets the tests needed to get the changes in the core.

avatar jfcherng
jfcherng - comment - 10 Mar 2023

@brianteeman php-diff has released both v6.14.0 (PHP>=7.4) and v6.10.9 (PHP>=7.1), which add a new differ option ignoreLineEnding. Turn on that differ option should avoid this issue.

avatar RickR2H RickR2H - change - 10 Mar 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-03-10 14:17:24
Closed_By RickR2H
avatar RickR2H RickR2H - close - 10 Mar 2023
avatar RickR2H
RickR2H - comment - 10 Mar 2023

Closed as having a PR #40070


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40065.

avatar RickR2H RickR2H - change - 10 Mar 2023
Labels Removed: No Code Attached Yet
avatar RickR2H RickR2H - unlabeled - 10 Mar 2023

Add a Comment

Login with GitHub to post a comment