Edgewall Software
Modify

Opened 8 years ago

Closed 7 years ago

Last modified 5 years ago

#12773 closed defect (fixed)

Wrong diff text is shown after switching to "Unified"

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:
API Changes:
Internal Changes:

Fixed extra spaces in each title of diff block.

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.

Attachments (2)

diff-tabluar.png (19.0 KB ) - added by Jun Omae 8 years ago.
diff-unified.png (17.7 KB ) - added by Jun Omae 8 years ago.

Download all attachments as: .zip

Change History (9)

by Jun Omae, 8 years ago

Attachment: diff-tabluar.png added

by Jun Omae, 8 years ago

Attachment: diff-unified.png added

comment:1 by Jun Omae, 8 years ago

Description: modified (diff)

comment:2 by Ryan J Ollos, 8 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, 5 years ago

Release Notes: modified (diff)

in reply to:  3 comment:7 by Ryan J Ollos, 5 years ago

Internal Changes: modified (diff)
Release Notes: modified (diff)

Replying to Jun Omae:

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

Moving Release Notes to Internal Changes since this didn't affect stable releases.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.