Fossil SCM
Remove (again) the hack of adding tabs to the end of every line in the --tk display in order to make the horizontal scrollbars prettier. The extra tab is removed when copying the text from the selection into the clipboard, but many applications (ex: xterm and the editor that I use daily) paste out of the PRIMARY selection (when available) rather than the CLIPBOARD and thus retain the tabs, which is unacceptable. Better to have jumpy horizontal scrollbars than extra end-of-line whitespace accidently inserted into files due to a paste that bypassed the tab removal.
Commit
6b59760e23f5c0ef0b5f0f458a2189e4434375a3
Parent
90fa060178f4ca2…
1 file changed
+1
-19
+1
-19
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -672,26 +672,17 @@ | ||
| 672 | 672 | @ $c insert end \n fn |
| 673 | 673 | @ } |
| 674 | 674 | @ $c insert end \n - |
| 675 | 675 | @ |
| 676 | 676 | @ set type [colType $c] |
| 677 | -@ # A tab character is appended to each line in a txt column. This, | |
| 678 | -@ # along with the -tabs text widget option, allows us to equalize line | |
| 679 | -@ # lengths in order to: | |
| 680 | -@ # (a) scroll to the same horizontal position on both sides and | |
| 681 | -@ # (b) keep the horizontal scrollbars from changing position/size as | |
| 682 | -@ # you scroll vertically. | |
| 683 | -@ # To test, try "fossil diff --tk --from d7afa8f153 --to abe1030ca8" | |
| 684 | -@ # as well as its inverse. | |
| 685 | -@ set tab [expr {$type eq "txt" ? "\t" : ""}] | |
| 686 | 677 | @ set str {} |
| 687 | 678 | @ while {[set line [gets $in]] ne "</pre>"} { |
| 688 | 679 | @ set len [string length [dehtml $line]] |
| 689 | 680 | @ if {$len > $widths($type)} { |
| 690 | 681 | @ set widths($type) $len |
| 691 | 682 | @ } |
| 692 | -@ append str $line$tab\n | |
| 683 | +@ append str $line\n | |
| 693 | 684 | @ } |
| 694 | 685 | @ |
| 695 | 686 | @ set re {<span class="diff([a-z]+)">([^<]*)</span>} |
| 696 | 687 | @ # Use \r as separator since it can't appear in the diff output (it gets |
| 697 | 688 | @ # converted to a space). |
| @@ -753,17 +744,10 @@ | ||
| 753 | 744 | @ $sb set $first $last |
| 754 | 745 | @ } |
| 755 | 746 | @ } |
| 756 | 747 | @ } |
| 757 | 748 | @ |
| 758 | -@ proc copyText {c} { | |
| 759 | -@ set txt "" | |
| 760 | -@ catch {set txt [string map {\t\n \n} [selection get]]} | |
| 761 | -@ clipboard clear | |
| 762 | -@ clipboard append $txt | |
| 763 | -@ } | |
| 764 | -@ | |
| 765 | 749 | @ wm withdraw . |
| 766 | 750 | @ wm title . $CFG(TITLE) |
| 767 | 751 | @ wm iconname . $CFG(TITLE) |
| 768 | 752 | @ bind . <q> exit |
| 769 | 753 | @ bind . <Tab> {cycleDiffs; break} |
| @@ -802,12 +786,10 @@ | ||
| 802 | 786 | @ $txt tag config $tag -background $CFG([string toupper $tag]_BG) |
| 803 | 787 | @ $txt tag lower $tag |
| 804 | 788 | @ } |
| 805 | 789 | @ $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \ |
| 806 | 790 | @ -justify center |
| 807 | -@ bind $txt <<Copy>> {copyText %W; break} | |
| 808 | -@ bind $txt <<Cut>> {copyText %W; break} | |
| 809 | 791 | @ } |
| 810 | 792 | @ text .mkr |
| 811 | 793 | @ |
| 812 | 794 | @ font create mono -family courier -size $CFG(FONT_SIZE) |
| 813 | 795 | @ foreach font $CFG(FONTS) { |
| 814 | 796 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -672,26 +672,17 @@ | |
| 672 | @ $c insert end \n fn |
| 673 | @ } |
| 674 | @ $c insert end \n - |
| 675 | @ |
| 676 | @ set type [colType $c] |
| 677 | @ # A tab character is appended to each line in a txt column. This, |
| 678 | @ # along with the -tabs text widget option, allows us to equalize line |
| 679 | @ # lengths in order to: |
| 680 | @ # (a) scroll to the same horizontal position on both sides and |
| 681 | @ # (b) keep the horizontal scrollbars from changing position/size as |
| 682 | @ # you scroll vertically. |
| 683 | @ # To test, try "fossil diff --tk --from d7afa8f153 --to abe1030ca8" |
| 684 | @ # as well as its inverse. |
| 685 | @ set tab [expr {$type eq "txt" ? "\t" : ""}] |
| 686 | @ set str {} |
| 687 | @ while {[set line [gets $in]] ne "</pre>"} { |
| 688 | @ set len [string length [dehtml $line]] |
| 689 | @ if {$len > $widths($type)} { |
| 690 | @ set widths($type) $len |
| 691 | @ } |
| 692 | @ append str $line$tab\n |
| 693 | @ } |
| 694 | @ |
| 695 | @ set re {<span class="diff([a-z]+)">([^<]*)</span>} |
| 696 | @ # Use \r as separator since it can't appear in the diff output (it gets |
| 697 | @ # converted to a space). |
| @@ -753,17 +744,10 @@ | |
| 753 | @ $sb set $first $last |
| 754 | @ } |
| 755 | @ } |
| 756 | @ } |
| 757 | @ |
| 758 | @ proc copyText {c} { |
| 759 | @ set txt "" |
| 760 | @ catch {set txt [string map {\t\n \n} [selection get]]} |
| 761 | @ clipboard clear |
| 762 | @ clipboard append $txt |
| 763 | @ } |
| 764 | @ |
| 765 | @ wm withdraw . |
| 766 | @ wm title . $CFG(TITLE) |
| 767 | @ wm iconname . $CFG(TITLE) |
| 768 | @ bind . <q> exit |
| 769 | @ bind . <Tab> {cycleDiffs; break} |
| @@ -802,12 +786,10 @@ | |
| 802 | @ $txt tag config $tag -background $CFG([string toupper $tag]_BG) |
| 803 | @ $txt tag lower $tag |
| 804 | @ } |
| 805 | @ $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \ |
| 806 | @ -justify center |
| 807 | @ bind $txt <<Copy>> {copyText %W; break} |
| 808 | @ bind $txt <<Cut>> {copyText %W; break} |
| 809 | @ } |
| 810 | @ text .mkr |
| 811 | @ |
| 812 | @ font create mono -family courier -size $CFG(FONT_SIZE) |
| 813 | @ foreach font $CFG(FONTS) { |
| 814 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -672,26 +672,17 @@ | |
| 672 | @ $c insert end \n fn |
| 673 | @ } |
| 674 | @ $c insert end \n - |
| 675 | @ |
| 676 | @ set type [colType $c] |
| 677 | @ set str {} |
| 678 | @ while {[set line [gets $in]] ne "</pre>"} { |
| 679 | @ set len [string length [dehtml $line]] |
| 680 | @ if {$len > $widths($type)} { |
| 681 | @ set widths($type) $len |
| 682 | @ } |
| 683 | @ append str $line\n |
| 684 | @ } |
| 685 | @ |
| 686 | @ set re {<span class="diff([a-z]+)">([^<]*)</span>} |
| 687 | @ # Use \r as separator since it can't appear in the diff output (it gets |
| 688 | @ # converted to a space). |
| @@ -753,17 +744,10 @@ | |
| 744 | @ $sb set $first $last |
| 745 | @ } |
| 746 | @ } |
| 747 | @ } |
| 748 | @ |
| 749 | @ wm withdraw . |
| 750 | @ wm title . $CFG(TITLE) |
| 751 | @ wm iconname . $CFG(TITLE) |
| 752 | @ bind . <q> exit |
| 753 | @ bind . <Tab> {cycleDiffs; break} |
| @@ -802,12 +786,10 @@ | |
| 786 | @ $txt tag config $tag -background $CFG([string toupper $tag]_BG) |
| 787 | @ $txt tag lower $tag |
| 788 | @ } |
| 789 | @ $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \ |
| 790 | @ -justify center |
| 791 | @ } |
| 792 | @ text .mkr |
| 793 | @ |
| 794 | @ font create mono -family courier -size $CFG(FONT_SIZE) |
| 795 | @ foreach font $CFG(FONTS) { |
| 796 |