**NAME** ''dgw::txmixins'' - functionality extensions for the tk::[text] widget such as folding, auto-indenting and abbreviations. **DESCRIPTION** ''dgw::txmixins'' - The package ''dgw::txmixins'' implements several ''snit::widgetadaptor''s which extend the standard *tk::text* widget with different functionalities. Different adaptors can be chained together to add the required functionalities. Please note that most of the functionalities are not coded mainly by the author of the package [DDG] but just wrappers of the functionalities into ''snit::widgetadaptor''s for easy usage and combining the different properties and functionalities. The following adaptors are currently available: * https://htmlpreview.github.io/?https://raw.githubusercontent.com/mittelmark/DGTcl/master/lib/dgw/txmixins.html#txfold%|%dgw::txfold%|% - provide fold marks to hiode and show certain parts of the text, for instance to navigate fast a large markdown file by just showing the section headers * https://htmlpreview.github.io/?https://raw.githubusercontent.com/mittelmark/DGTcl/master/lib/dgw/txmixins.html#txautorep%|%dgw::txautorep%|% - short abbreviations snippets invoked after closing parenthesis * https://htmlpreview.github.io/?https://raw.githubusercontent.com/mittelmark/DGTcl/master/lib/dgw/txmixins.html#txindent%|%dgw::txindent%|% - keep indentation of previous line * https://htmlpreview.github.io/?https://raw.githubusercontent.com/mittelmark/DGTcl/master/lib/dgw/txmixins.html#txrotext%|%dgw::txrotext%|% - read only text widget There is further a convenience function which simplifies addition of adaptors without a lot of nesting calls: * ''dgw::txmixin'' - add widgets adaptors to existing widgets after widget creation **LINKS** * Author: [Detlef Groth] * Homepage: https://github.com/mittelmark/DGTcl - part of the dgw package * Download: https://github.com/mittelmark/DGTcl/archive/master.zip * Manual: http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/dgw/txmixins.html * Source code: https://raw.githubusercontent.com/mittelmark/DGTcl/master/lib/dgw/tvmixins.tcl * Version: 0.1 * License: MIT **EXAMPLE** Let's create a folding text editor for Markdown files: ====== # demo: txfold dgw::txfold [tk::text .txt] foreach col [list A B C] { .txt insert end "# Header $col\n\nSome text\n\n" } .txt insert end "Place the cursor on the header lines and press F2\n" .txt insert end "or press F3 to fold or unfold the complete text.\n" .txt tag configure fold -background #cceeff .txt configure -borderwidth 10 -relief flat pack .txt -side top -fill both -expand yes # next line would fold by double click (although I like F2 more ...) # .txt configure -foldkey Double-1 bind .txt { focus -force .txt } ====== [txfold-image-01] Walking to the second section and pressing F2: [txfold-image-02] Global overview after two times pressing F3 (first unfold, then fold all): [txfold-image-03] **CHANGES** * 2021-08-19: 0.1 first release **SEE ALSO** * [dgw::tvmixins] - widgetadaptors for the [ttk::treeview] widget. **DISCUSSION** Please discuss here. <> GUI | Object Orientation | Snit Widgets | Snit | Design | Discussion