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.

drh 2013-07-11 02:39 UTC sbsreloaded
Commit 6b59760e23f5c0ef0b5f0f458a2189e4434375a3
1 file changed +1 -19
+1 -19
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -672,26 +672,17 @@
672672
@ $c insert end \n fn
673673
@ }
674674
@ $c insert end \n -
675675
@
676676
@ 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" : ""}]
686677
@ set str {}
687678
@ while {[set line [gets $in]] ne "</pre>"} {
688679
@ set len [string length [dehtml $line]]
689680
@ if {$len > $widths($type)} {
690681
@ set widths($type) $len
691682
@ }
692
-@ append str $line$tab\n
683
+@ append str $line\n
693684
@ }
694685
@
695686
@ set re {<span class="diff([a-z]+)">([^<]*)</span>}
696687
@ # Use \r as separator since it can't appear in the diff output (it gets
697688
@ # converted to a space).
@@ -753,17 +744,10 @@
753744
@ $sb set $first $last
754745
@ }
755746
@ }
756747
@ }
757748
@
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
-@
765749
@ wm withdraw .
766750
@ wm title . $CFG(TITLE)
767751
@ wm iconname . $CFG(TITLE)
768752
@ bind . <q> exit
769753
@ bind . <Tab> {cycleDiffs; break}
@@ -802,12 +786,10 @@
802786
@ $txt tag config $tag -background $CFG([string toupper $tag]_BG)
803787
@ $txt tag lower $tag
804788
@ }
805789
@ $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \
806790
@ -justify center
807
-@ bind $txt <<Copy>> {copyText %W; break}
808
-@ bind $txt <<Cut>> {copyText %W; break}
809791
@ }
810792
@ text .mkr
811793
@
812794
@ font create mono -family courier -size $CFG(FONT_SIZE)
813795
@ foreach font $CFG(FONTS) {
814796
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button