Eskil

View Ticket
Login
2016-07-29
10:59 Closed ticket [288be8f321]: wrong right-side numbering when viewing diff plus 6 other changes artifact: 5b58c10188 user: peter
10:56
Corrected right side numbering when parsing patch. [288be8f321] check-in: ee752fcf8e user: peter tags: trunk
2016-07-11
05:11 New ticket [288be8f321] wrong right-side numbering when viewing diff. artifact: d6327224db user: anonymous

Ticket Hash: 288be8f321da6e812974e9cd6311fa33d2388656
Title: wrong right-side numbering when viewing diff
Status: Closed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Diff_Display Resolution: Fixed
Last Modified: 2016-07-29 10:59:17
8.80 years ago
Created: 2016-07-11 05:11:51
8.85 years ago
Version Found In: head
User Comments:
anonymous added on 2016-07-11 05:11:51:

right hand side has line numbers from left hand side. For example:

----------------------------
$ 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 -
----------------------------

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:

$ 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
         }
     }

----------------------------


peter added on 2016-07-29 10:59:17:
Fixed in [ee752fcf8eb]