Eskil

Ticket Change Details
Login
Overview

Artifact ID: d6327224db5e93787cfb4774c5fa90a0bbf56e3f
Ticket: 288be8f321da6e812974e9cd6311fa33d2388656
wrong right-side numbering when viewing diff
User & Date: anonymous 2016-07-11 05:11:51
Changes

  1. foundin changed to: "head"
  2. icomment:
    right hand side has line numbers from left hand side.  For example:
    <pre>
    ----------------------------
    $ echo 1 > foo.txt;
    $ echo 0 > bar.txt; cat foo.txt >> bar.txt
    $ diff -u foo.txt bar.txt
    --- foo.txt	2016-07-10 21:53:36.671932638 -0700
    +++ bar.txt	2016-07-10 21:53:54.739860205 -0700
    @@ -1 +1,2 @@
    +0
     1
    $ diff -u foo.txt bar.txt | ./main.tcl -
    ----------------------------
    </pre>
    
    Expected:
    right hand side has line numbers 1 and 2
    
    Actual: right hand side has line numbers 1 and 1
    
    Apparently, this caused by simple typo.  Patch to fix the problem:
    <pre>
    $ fossil diff src/eskil.tcl
    ----------------------------
    Index: src/eskil.tcl
    ==================================================================
    --- src/eskil.tcl
    +++ src/eskil.tcl
    @@ -1239,18 +1239,18 @@
                 if {![regexp {^[\s+-]} $line]} continue
                 set sig [string trim [string index $line 0]]
                 set str [string range $line 1 end]
                 if {$sig eq ""} {
                     lappend leftLines [list $leftLine "" $str]
    -                lappend rightLines [list $leftLine "" $str]
    +                lappend rightLines [list $rightLine "" $str]
                     incr leftLine
                     incr rightLine
                 } elseif {$sig eq "-"} {
                     lappend leftLines [list $leftLine "-" $str]
                     incr leftLine
                 } else {
    -                lappend rightLines [list $leftLine "+" $str]
    +                lappend rightLines [list $rightLine "+" $str]
                     incr rightLine
                 }
                 continue
             }
         }
    
    ----------------------------
    <pre>
    
  3. login: "anonymous"
  4. mimetype: "text/x-fossil-wiki"
  5. private_contact changed to: "d444f6313690a4a7800ac3f865cf78402edd8167"
  6. severity changed to: "Important"
  7. status changed to: "Open"
  8. title changed to: "wrong right-side numbering when viewing diff"
  9. type changed to: "Code_Defect"