Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

#1985 closed defect (fixed)

diff processor displays wrong line number (+1)

Reported by: Shunichi Goto <gotoh@…> Owned by: Christopher Lenz
Priority: normal Milestone: 0.9
Component: wiki system Version: devel
Severity: minor Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

The diff processor (in wiki/ticket, not in browser) displays wrong line number added by 1.

For example, I put a raw diff text and a processed one to compare. both has same content.

--- templates/changeset.cs      (revision 2143)
+++ templates/changeset.cs      (working copy)
@@ -106,7 +106,8 @@
  <dt class="author">Author:</dt>
  <dd class="author"><?cs var:changeset.author ?></dd>
  <dt class="message">Message:</dt>
- <dd class="message" id="searchable"><?cs var:changeset.message ?></dd>
+ <dd class="message" id="searchable"><?cs
+  alt:changeset.message ?>&nbsp;<?cs /alt ?></dd>
  <dt class="files">Files:</dt>
  <dd class="files">
   <ul><?cs each:item = changeset.changes ?>
  • templates/changeset.cs

     
    106106 <dt class="author">Author:</dt>
    107107 <dd class="author"><?cs var:changeset.author ?></dd>
    108108 <dt class="message">Message:</dt>
    109  <dd class="message" id="searchable"><?cs var:changeset.message ?></dd>
     109 <dd class="message" id="searchable"><?cs
     110  alt:changeset.message ?>&nbsp;<?cs /alt ?></dd>
    110111 <dt class="files">Files:</dt>
    111112 <dd class="files">
    112113  <ul><?cs each:item = changeset.changes ?>

Attachments (0)

Change History (6)

comment:1 by Shunichi Goto <gotoh@…>, 19 years ago

This is due to bug of PatchRenderer._diff_to_hdf() caused by the difference of 'line number' (1 base) and 'offset number' (0 base). Here is a patch:

  • patch.py

     
    151151            if (command == ' ') != last_type:
    152152                last_type = command == ' '
    153153                blocks.append({'type': last_type and 'unmod' or 'mod',
    154                                'base.offset': fromline, 'base.lines': [],
    155                                'changed.offset': toline,'changed.lines': []})
     154                               'base.offset': fromline-1, 'base.lines': [],
     155                               'changed.offset': toline-1,'changed.lines': []})
    156156            if command == ' ':
    157157                blocks[-1]['changed.lines'].append(line)
    158158                blocks[-1]['base.lines'].append(line)

comment:2 by Christian Boos, 19 years ago

Owner: changed from Jonas Borgström to Christian Boos
Severity: normalminor
Status: newassigned

comment:3 by Christian Boos, 19 years ago

Milestone: 0.9

I'll try to add a unit test for that, too.

comment:4 by Christopher Lenz, 19 years ago

Owner: changed from Christian Boos to Christopher Lenz
Status: assignednew

I'll take this (sorry cboos). If you have a unit test ready, that'd be cool of course ;-)

comment:5 by Christopher Lenz, 19 years ago

Status: newassigned

comment:6 by Christopher Lenz, 19 years ago

Resolution: fixed
Status: assignedclosed

Fixed in [2264].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz 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.