Problem/Motivation
The Unified fields got line numbers.
The Split fields still doesn't have.
Proposed resolution
Add line numbers to the Split fields for Raw filter, and hide them for Strip tags filter similar to #2802835: Hide line numbers when stripping markup?.
User interface changes
"Split fields" before changes (both Raw/Strip tags filter modes):

Line numbers added for "Split fields" "Raw" filter:

Line numbers hidden for "Split fields" "Strip tags" filter:

| Comment | File | Size | Author |
|---|---|---|---|
| #54 | split_striptags_after.png | 42.15 KB | tduong |
| #54 | split_raw_after.png | 41.43 KB | tduong |
| #54 | split_raw_striptags_before.png | 40.1 KB | tduong |
| #53 | Screenshot from 2016-09-29 09-27-19.png | 37.99 KB | drobnjak |
| #53 | interdiff-2802829-48-53.txt | 579 bytes | drobnjak |
Comments
Comment #2
drobnjak commentedComment #3
drobnjak commentedComment #4
drobnjak commentedComment #6
toncic commentedYou should add comma after last element in array. https://www.drupal.org/docs/develop/standards/coding-standards#array
Here the same.
You have one extra line here.
Comment #7
drobnjak commentedProviding screenshot for patch-3
Comment #8
johnchquePlease remove this.
Besides that is better to test manually too.
Comment #9
miro_dietikerYou are counting up in parallel, unconditionally for left and right?
We need a test that is following a more real multiline example, such as:
- Have a text field with 5 lines
- Remove the 1st and 4rth lines, plus replace the 3rd row with some new line, possibly even add multiple lines there.
And then assert the line numbers.
Comment #10
drobnjak commentedThere are conditional statements and I tested it as it is suggested in comment #9.
I also removed custom code comments as suggested in comment #8.
There is a screenshot provided.
Comment #12
miro_dietikerHm, that's interesting. I was expecting a different output, but i kinda can see that this one isn't necessarily wrong...
But the example is polluted with the
<p>and the</p>tag that makes every line changed.I really wanted to have these lines unchanged.
To solve the p problem, please add an empty / placeholder line first and at the end.
Also what is confusing though is, why the line after the +/- has no line number.
Comment #13
drobnjak commentedI have provided another example which can pull maybe potential issues.
This example is created with using "enter" instead of "shift+enter" and creating whitelines between the rows. When the whiteline is removed, layout considers it as a change. Now all of the lines that have data have line numbers, like in Unified fields layout.
Comment #14
drobnjak commentedComment #16
toncic commentedSpace between "if" and "(".
Here the same.
Comment #17
miro_dietikerYeah the diff now looks much more like expected.
Lots of tests failing. :-)
Comment #18
miro_dietikerUnrelated revert of some other recently committed issue. Please always pull / merge / rebase your branch.
Comment #19
drobnjak commentedRebased
Comment #20
drobnjak commentedComment #22
drobnjak commentedTest changes that should follow the changes of the Split fields layout. Together with changes from the patch https://www.drupal.org/node/2800155#comment-11659699 to remove additional errors "Illegal string offset".
Comment #24
drobnjak commentedReversed changes from https://www.drupal.org/node/2800155#comment-11659699 issue that were applied by mistake.
Changes made to the Split fields to evade "Illegal string offset errors"
Comment #25
drobnjak commentedComment #27
drobnjak commentedFixed "Illegal string offset errors" completely
Comment #29
drobnjak commentedComment #31
drobnjak commentedComment #32
johnchqueunrelated change. :)
Comment #33
drobnjak commentedComment #34
miro_dietikerPlease also consider similarly to only display the line numbers in raw mode like #2802835: Hide line numbers when stripping markup?
Comment #35
drobnjak commentedFeature added, numbers are removed together with columns on "strip_tags".
I am working on test fixes.
Comment #36
drobnjak commentedComment #38
johnchqueWe need these lines. :)
Comment #39
johnchqueunrelated change. :)
Comment #40
johnchqueThis lines should remain the same. :)
Comment #41
tduong commentedI was taking over this, forgot to assign the issue to myself and have seen later that a patch has been already uploaded...
Then I'll post some feedback/considerations:
I suggest you to change the settings in phpStorm to avoid this
if(.Compared with the code in UnifiedFieldsDiffLayout, is this kind of check (and more in this code) really needed, or is the code in the other file not safe and need to be improved?
To make it more similar to the other code, you might need to add
$raw_active = $active_filter == 'raw';before the $fields foreach loop and replace$active_filter == 'strip_tags'with!$raw_active.Format this better, like:
Add a new line here to separate the code (readability).
Is it allowed to set this (as 3) differently than the second colspan or must they have the same value ?
Otherwise UI looks good!
Comment #42
johnchqueAbout 41.2 yes, those checks are needed otherwise we will get some php warnings.
Comment #43
drobnjak commentedApplied changes from comments 38-41. Check in the 41. 2) is to avoid the class offset errors in tests.
Comment #44
johnchqueAlmost! We don't want to remove this. :)
Comment #45
drobnjak commentedComment #46
johnchqueLooks really nice now. :)
Comment #47
tduong commentedSome last nitpicks:
This should be defined outside
foreach ($fields as $field).The code in the other file needs improvement as well, need a followup to improve/cleanup that code.
New line (readability).
Add a come after the last element and
];in a new line (coding standard).Then is fine :)
Comment #48
drobnjak commentedComment #49
johnchqueEven better now.
Comment #50
tduong commentedAgree
Comment #51
tduong commentedOh wait, missed 41.6)

Mind the difference between the following (
REV2header):Just a small thing, otherwise is ok.
Comment #52
johnchqueTrue, the colspan should be 3 and not 4. We also need new screenshots after that change.
Comment #53
drobnjak commentedHeader changes
Comment #54
tduong commentedNow it's alright! :)
Updated IS with screenshots as well.
Comment #56
miro_dietikerYeah commmitted, great.
Again, let me point to the issue about using named columns:
#2785857: Introduce header / row table keys
The cols have numerical references now and they change depending on conditions... That's really bad in case someone wants to alter stuff - there is no clear reference. Also with named references, an unset($row['number_left']) would be enough to delete the left column with number and no crazy number juggling would be needed.