Testing tangled. Original: https://github.com/j6t/gitk

gitk: add text wrapping preferences

Add a new preference "wrapdefault" which allows enabling char/word wrap.
Impacts all text in the ctext widget for which no other preference exists.

Also make the (existing) preference "wrapcomment" configurable graphically.
Its setting impacts only the "comment" part of the ctext widget.

Signed-off-by: Christoph Sommer <sommer@cms-labs.org>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>

authored by

Christoph Sommer and committed by
Johannes Sixt
904b36b8 b2490ae4

+27 -8
+27 -8
gitk
··· 2089 2089 global diffcontextstring diffcontext 2090 2090 global ignorespace 2091 2091 global maincursor textcursor curtextcursor 2092 - global rowctxmenu fakerowmenu mergemax wrapcomment 2092 + global rowctxmenu fakerowmenu mergemax wrapcomment wrapdefault 2093 2093 global highlight_files gdttype 2094 2094 global searchstring sstring 2095 2095 global bgcolor fgcolor bglist fglist diffcolors diffbgcolors selectbgcolor ··· 2431 2431 set ctext .bleft.bottom.ctext 2432 2432 text $ctext -background $bgcolor -foreground $fgcolor \ 2433 2433 -state disabled -undo 0 -font textfont \ 2434 - -yscrollcommand scrolltext -wrap none \ 2434 + -yscrollcommand scrolltext -wrap $wrapdefault \ 2435 2435 -xscrollcommand ".bleft.bottom.sbhorizontal set" 2436 2436 if {$have_tk85} { 2437 2437 $ctext conf -tabstyle wordprocessor ··· 11576 11576 11577 11577 proc prefspage_general {notebook} { 11578 11578 global NS maxwidth maxgraphpct showneartags showlocalchanges 11579 - global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs 11579 + global tabstop wrapcomment wrapdefault limitdiffs autoselect autosellen extdifftool perfile_attrs 11580 11580 global hideremotes want_ttk have_ttk maxrefs web_browser 11581 11581 11582 11582 set page [create_prefs_page $notebook.general] ··· 11607 11607 ${NS}::label $page.tabstopl -text [mc "Tab spacing"] 11608 11608 spinbox $page.tabstop -from 1 -to 20 -width 4 -textvariable tabstop 11609 11609 grid x $page.tabstopl $page.tabstop -sticky w 11610 + 11611 + ${NS}::label $page.wrapcommentl -text [mc "Wrap comment text"] 11612 + ${NS}::combobox $page.wrapcomment -values {none char word} -state readonly \ 11613 + -textvariable wrapcomment 11614 + grid x $page.wrapcommentl $page.wrapcomment -sticky w 11615 + 11616 + ${NS}::label $page.wrapdefaultl -text [mc "Wrap other text"] 11617 + ${NS}::combobox $page.wrapdefault -values {none char word} -state readonly \ 11618 + -textvariable wrapdefault 11619 + grid x $page.wrapdefaultl $page.wrapdefault -sticky w 11620 + 11610 11621 ${NS}::checkbutton $page.ntag -text [mc "Display nearby tags/heads"] \ 11611 11622 -variable showneartags 11612 11623 grid x $page.ntag -sticky w ··· 11725 11736 global oldprefs prefstop showneartags showlocalchanges 11726 11737 global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor 11727 11738 global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs 11728 - global hideremotes want_ttk have_ttk 11739 + global hideremotes want_ttk have_ttk wrapcomment wrapdefault 11729 11740 11730 11741 set top .gitkprefs 11731 11742 set prefstop $top ··· 11734 11745 return 11735 11746 } 11736 11747 foreach v {maxwidth maxgraphpct showneartags showlocalchanges \ 11737 - limitdiffs tabstop perfile_attrs hideremotes want_ttk} { 11748 + limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault} { 11738 11749 set oldprefs($v) [set $v] 11739 11750 } 11740 11751 ttk_toplevel $top ··· 11860 11871 global oldprefs prefstop 11861 11872 11862 11873 foreach v {maxwidth maxgraphpct showneartags showlocalchanges \ 11863 - limitdiffs tabstop perfile_attrs hideremotes want_ttk} { 11874 + limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault} { 11864 11875 global $v 11865 11876 set $v $oldprefs($v) 11866 11877 } ··· 11874 11885 global oldprefs prefstop showneartags showlocalchanges 11875 11886 global fontpref mainfont textfont uifont 11876 11887 global limitdiffs treediffs perfile_attrs 11877 - global hideremotes 11888 + global hideremotes wrapcomment wrapdefault 11889 + global ctext 11878 11890 11879 11891 catch {destroy $prefstop} 11880 11892 unset prefstop ··· 11922 11934 } 11923 11935 if {$hideremotes != $oldprefs(hideremotes)} { 11924 11936 rereadrefs 11937 + } 11938 + if {$wrapcomment != $oldprefs(wrapcomment)} { 11939 + $ctext tag conf comment -wrap $wrapcomment 11940 + } 11941 + if {$wrapdefault != $oldprefs(wrapdefault)} { 11942 + $ctext configure -wrap $wrapdefault 11925 11943 } 11926 11944 } 11927 11945 ··· 12392 12410 set mingaplen 100 12393 12411 set cmitmode "patch" 12394 12412 set wrapcomment "none" 12413 + set wrapdefault "none" 12395 12414 set showneartags 1 12396 12415 set hideremotes 0 12397 12416 set maxrefs 20 ··· 12497 12516 12498 12517 set config_variables { 12499 12518 mainfont textfont uifont tabstop findmergefiles maxgraphpct maxwidth 12500 - cmitmode wrapcomment autoselect autosellen showneartags maxrefs visiblerefs 12519 + cmitmode wrapcomment wrapdefault autoselect autosellen showneartags maxrefs visiblerefs 12501 12520 hideremotes showlocalchanges datetimeformat limitdiffs uicolor want_ttk 12502 12521 bgcolor fgcolor uifgcolor uifgdisabledcolor colors diffcolors mergecolors 12503 12522 markbgcolor diffcontext selectbgcolor foundbgcolor currentsearchhitbgcolor