Edgewall Software

Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#12773 closed defect (fixed)

Wrong diff text is shown after switching to "Unified" — at Version 6

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.3.2
Component: wiki system Version: 1.3dev
Severity: normal Keywords: diff
Cc: Branch:
Release Notes:

Fixed extra spaces in each title of diff block.

API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

This issue is able to confirm at comment:description:ticket:12768.

@@ -810,11 +810,12 @@ and class Chrome(Component): should be shown in the same line but not. Also, the unified diff text is corrupted.

Change History (8)

by Jun Omae, 7 years ago

Attachment: diff-tabluar.png added

by Jun Omae, 7 years ago

Attachment: diff-unified.png added

comment:1 by Jun Omae, 7 years ago

Description: modified (diff)

comment:2 by Ryan J Ollos, 7 years ago

Description: modified (diff)

comment:3 by Jun Omae, 7 years ago

I encountered this issue again. Notes that trunk only has the issue but 1.2-stable works fine.

comment:4 by Jun Omae, 7 years ago

Keywords: diff added
Milestone: next-dev-1.3.x1.3.2
Owner: set to Jun Omae
Status: newassigned

It is caused by that item.diffs_title are rendered with extra spaces in Jinja2 template at source:/trunk/trac/templates/diff_div.html@15484:182-187,310-315#L182.

But item.diffs_title are rendered without extra spaces within an em element. We could easily retrieve text from the em element rather than the cell.

diff --git a/trac/htdocs/js/diff.js b/trac/htdocs/js/diff.js
index a54d72ee5..c27f0c95d 100644
--- a/trac/htdocs/js/diff.js
+++ b/trac/htdocs/js/diff.js
@@ -25,7 +25,7 @@
     var oldOffset = 0, oldLength = 0, newOffset = 0, newLength = 0;
     var title = "";
     if (inline)
-      title = $(ths[2]).text();
+      title = $('em', ths[2]).text();

     for (var i = 0; i < table.tBodies.length; i++) {
       var tBody = table.tBodies[i];
@@ -43,7 +43,7 @@
         oldOffset = 0, oldLength = 0, newOffset = 0, newLength = 0;
         if (tBody.className == "skipped") {
           if (inline)
-            title = $(tBody.rows[0].cells[2]).text();
+            title = $('em', tBody.rows[0].cells[2]).text();
           continue;
         }
       }

comment:5 by Jun Omae, 7 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Fixed in [16158].

comment:6 by Ryan J Ollos, 4 years ago

Release Notes: modified (diff)
Note: See TracTickets for help on using tickets.