pharo-project / pharo

Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk.
http://pharo.org
Other
1.2k stars 355 forks source link

Diff does not show correct position in some situations #12454

Open astares opened 1 year ago

astares commented 1 year ago

The diff shown by the following expression (which is coming from a diff change where a space got removed)

SpDiffPresenter new
        showOptions: false;
        leftText: 'ABC. ';
        rightText: 'ABC.';
        open

looks like:

image

where the red bar is behind the dot - but it is the space which is the difference. So the red bar should be one single position behind the dot and the expected behavior would be the diff would look like:

image

astares commented 1 year ago

If one does not use a dot but a # character it is even more strange as the red bar is not even shown:

SpDiffPresenter new
        showOptions: false;
        leftText: 'ABC# ';
        rightText: 'ABC#';
        open

as if nothing had changed.

image

astares commented 1 year ago

Initially I thought because left input string is longer than the right input string.

But there are other examples where it does not display correctly when the size is same:

SpDiffPresenter new
        showOptions: false;
        leftText: 'ABC.#';
        rightText: 'ABC#.';
        open

which shows a change only for the first four positions - but it has changed on the fourth and fifth character position:

image

when you do not use a dot but an underline you get a different position coloring:

SpDiffPresenter new
        showOptions: false;
        leftText: 'ABC_#';
        rightText: 'ABC#_';
        open

image