NAME

Tk::Text::SuperText - An improved text widget for Perl/Tk

SYNOPSIS

    $super_text = $paren->SuperText(?options?);

STANDARD OPTIONS

-background -highlightbackground -insertontime -selectborderwidth -borderwidth -highlightcolor -insertwidth -selectforeground -cursor -highlightthickness -padx -setgrid -exportselection -insertbackground -pady -takefocus -font -insertborderwidth -relief -xscrollcommand -foreground -insertofftime -selectbackground -yscrollcommand -ansicolor

See Tk::options for details of the standard options.

-height -spacing1 -spacing2 -spacing3 -state -tabs -width -wrap

See Tk::Text for details of theis options.

WIDGET-SPECIFIC OPTIONS

Name: indentMode
Class: IndentMode
Switch: -indentmode

Specifies how to indent when a new line is inserted in the text. The possible modes are none for no indent at all or auto for positioning the insertion cursor right below the first non-white space character of the previous line.

Name: undoDepth
Class: UndoDepth
Switch: -undodepth

Sets the maximum depth for the undo buffer:a number specifies the numbers of insert or delete operations that can be stored in the buffer before the oldest one is poped out and forgotten; 0 stops the undo feature, undef sets unlimited depth.

Name: redoDepth
Class: RedoDepth
Switch: -redodepth

Sets the maximum depth for the redo buffer:a number specifies the numbers of undo operations that can be stored in the buffer before the oldest one is poped out and forgotten; 0 stops the redo feature, undef sets unlimited depth.

Name: showMatching
Class: ShowMatching
Switch: -showmatching

With a value of 1 activates the matching parentheses feature.0 deactivates it.

Name: matchHighlightTime
Class: MatchHighlightTime
Switch: -matchhighlighttime

Sets the number of milliseconds the match highlight stays visible; with a value of 0 the highlight stays on till next match.

Name: matchForeground
Class: MatchForeground
Switch: -matchforeground

Set the foreground color for the char hilighted by the match-parentheses command.

Name: matchBackground
Class: MatchBackground
Switch: -matchbackground

Set the background color for the char hilighted by the match-parentheses command.

Name: matchingCouples
Class: MatchingCouples
Switch: -matchingcouples

Sets the chars that are searched for a matching counterpart. The format is a simple string with matching chars coupled in left-right order; here's an example: {}[]()"" . For double couples ("") the match is done only on the forwarding chars.

Name: insertMode
Class: InsertMode
Switch: -insertmode

Sets the default insert mode: insert or overwrite .

Name: ansiColor
Class: AnsiColor
Switch: -ansicolor

Enables or disables use of Tk::TextANSIColor module. This option was implemented by Jim Turner (THANKS for the support!)

DESCRIPTION

Tk::Text::SuperText implements many new features over the standard Tk::Text widget while supporting all its standard features. It's used simply as the Tk::Text widget. New Features:

  • Unlimited undo/redo.

    So you can undo and redo whatever you deleted/inserted whenever you want. To reset the undo and redo buffers call this method: $w->resetUndo;

  • Rectangular selections.

    Rectangular text zones can be selected, copied, deleted, shifted with the mouse or with the keyboard.

  • Selection right/left char and tab shift.

    Text selections can be shifted left/right of one or more chars or a tabs.

  • Normal and 'inline' selection paste.

    The 'normal' paste is the normal text paste you know:

    Paste Buffer:

    line x

    line y

    Text Buffer:

    line 1

    line2

    Normal paste at line 1:

    line x

    line y

    line 1

    line 2

    The 'inline' paste works like this:
    Inline paste at line 1:

    line x line 1

    line y line 2

  • Parentheses matching.

    To help you inspect nested parentheses, brackets, and other characters, SuperText has both an automatic parenthesis matching mode, and a find matching command. Automatic parenthesis matching is activated when you type or when you move the insertion cursor after a parenthesis. It momentarily highlights the matching character if that character is visible in the window. To find a matching character anywhere in the file, position the cursor after the it, and call the find matching command.

  • Auto-indenting.

    When you press the Return or Enter key, spaces and tabs are inserted to line up the insert point under the start of the previous line.

  • Control codes insertion.

    You can directly insert a non-printable control character in the text.

  • Commands are managed via virtual events.

    Every SuperText command is bound to a virtual event, so to call it or to bind it to a key sequence use the Tk::event functions. I used this format for key bind so there's no direct key-to-command bind, and this gives me more flexibility; however, you can use normal binds.

    Example: $w->eventAdd('Tk::Text::SuperText','<<SelectAll>>','<Control-a>');

    To set default event bindings use this method: $w->bindDefault;

  • Default key bindings are redefined (not really a feature :).

    Every virtual event has an associated public method with the same name of the event but with the first char in lower case (e.g.: <<MouseSelect>> event has a corresponding $super_text->mouseSelect method).

        Virtual Event/Command     Default Key Binding
        
        MouseSetInsert            <Button1>
        MouseSelect               <B1-Motion>
        MouseSelectWord           <Double-1>
        MouseSelectLine           <Triple-1>
        MouseSelectAdd            <Shift-1>
        MouseSelectAddWord        <Double-Shift-1>
        MouseSelectAddLine        <Triple-Shift-1>
        MouseSelectAutoScan       <B1-Leave>
        MouseSelectAutoScanStop   <B1-Enter>,<ButtonRelease-1>
        MouseMoveInsert           <Alt-1>
        MouseRectSelection        <Control-B1-Motion>
        MouseMovePageTo           <2>
        MouseMovePage             <B2-Motion>
        MousePasteSelection       <ButtonRelease-2>
        
        MoveLeft                  <Left>
        SelectLeft                <Shift-Left>
        SelectRectLeft            <Shift-Alt-Left>
        MoveLeftWord              <Control-Left>
        SelectLeftWord            <Shift-Control-Left>
        MoveRight                 <Right>
        SelectRight               <Shift-Right>
        SelectRectRight           <Shift-Alt-Right>
        MoveRightWord             <Control-Right>
        SelectRightWord           <Shift-Control-Right>
        MoveUp                    <Up>
        SelectUp                  <Shift-Up>
        SelectRectUp              <Shift-Alt-Up>
        MoveUpParagraph           <Control-Up>
        SelectUpParagraph         <Shift-Control-Up>
        MoveDown                  <Down>
        SelectDown                <Shift-Down>
        SelectRectDown            <Shift-Alt-Down>
        MoveDownParagraph         <Control-Down>
        SelectDownParagraph       <Shift-Control-Down>
        MoveLineStart             <Home>
        SelectToLineStart         <Shift-Home>
        MoveTextStart             <Control-Home>
        SelectToTextStart         <Shift-Control-Home>
        MoveLineEnd               <End>
        SelectToLineEnd           <Shift-End>
        MoveTextEnd               <Control-End>
        SelectToTextEnd           <Shift-Control-End>
        MovePageUp                <Prior>
        SelectToPageUp            <Shift-Prior>
        MovePageLeft              <Control-Prior>
        MovePageDown              <Next>
        SelectToPageDown          <Shift-Next>
        MovePageRight             <Control-Next>
        SetSelectionMark          <Control-space>,<Select>
        SelectToMark              <Shift-Control-space>,<Shift-Select>
        
        SelectAll                 <Control-a>
        SelectionShiftLeft        <Control-comma>
        SelectionShiftLeftTab     <Control-Alt-comma>
        SelectionShiftRight       <Control-period>
        SelectionShiftRightTab    <Control-Alt-period>
        
        Ins                       <Insert>
        Enter                     <Return>
        AutoIndentEnter           <Control-Return>
        NoAutoindentEnter         <Shift-Return>
        Del                       <Delete>
        BackSpace                 <BackSpace>
        DeleteToWordStart         <Shift-BackSpace>
        DeleteToWordEnd           <Shift-Delete>
        DeleteToLineStart         <Alt-BackSpace>
        DeleteToLineEnd           <Alt-Delete>
        DeleteWord                <Control-BackSpace>
        DeleteLine                <Control-Delete>
        
        InsertControlCode         <Control-Escape>
        
        FocusNext                 <Control-Tab>
        FocusPrev                 <Shift-Control-Tab>
        
        FlashMatchingChar         <Control-b>
        RemoveMatch               <Control-B>
        FindMatchingChar          <Control-j>
        JumpToMatchingChar        <Control-J>
        
        Escape                    <Escape>
        
        Tab                       <Tab>
        
        LeftTab                   <Shift-Tab>
        
        Copy                      <Control-c>
        
        Cut                       <Control-x>
        
        Paste                     <Control-v>
        
        InlinePaste               <Control-V>
        
        Undo                      <Control-z>
        
        Redo                      <Control-Z>
        
        Destroy                   <Destroy>
        
        MenuSelect                <Alt-KeyPress>
  • Public methods.

    $widget->mouseSetInsert

    $widget->museSelect

    $widget->mouseSelectWord

    $widget->mouseSelectLine

    $widget->mouseSelectAdd

    $widget->mouseSelectAddWord

    $widget->mouseSelectAddLine

    $widget->mouseSelectAutoScan

    $widget->mouseSelectAutoScanStop

    $widget->mouseMoveInsert

    $widget->mouseRectSelection

    $widget->mouseMovePageTo

    $widget->mouseMovePage

    $widget->mousePasteSelection

    $widget->moveLeft

    $widget->selectLeft

    $widget->selectRectLeft

    $widget->moveLeftWord

    $widget->selectLeftWord

    $widget->moveRight

    $widget->selectRight

    $widget->selectRectRight

    $widget->moveRightWord

    $widget->selectRightWord

    $widget->moveUp

    $widget->selectUp

    $widget->selectRectUp

    $widget->moveUpParagraph

    $widget->selectUpParagraph

    $widget->moveDown

    $widget->selectDown

    $widget->selectRectDown

    $widget->moveDownParagraph

    $widget->selectDownParagraph

    $widget->moveLineStart

    $widget->selectToLineStart

    $widget->moveTextStart

    $widget->selectToTextStart

    $widget->moveLineEnd

    $widget->selectToLineEnd

    $widget->moveTextEnd

    $widget->selectToTextEnd

    $widget->movePageUp

    $widget->selectToPageUp

    $widget->movePageLeft

    $widget->movePageDown

    $widget->selectToPageDown

    $widget->movePageRight

    $widget->setSelectionMark

    $widget->selectToMark

    $widget->selectAll

    $widget->selectionShiftLeft

    $widget->selectionShiftLeftTab

    $widget->selectionShiftRight

    $widget->selectionShiftRightTab

    $widget->ins

    $widget->enter

    $widget->autoIndentEnter

    $widget-> noAutoindentEnter

    $widget->del

    $widget->backSpace

    $widget->deleteToWordStart

    $widget->deleteToWordEnd

    $widget->deleteToLineStart

    $widget->deleteToLineEnd

    $widget->deleteWord

    $widget->deleteLine

    $widget->insertControlCode

    $widget->focusNext

    $widget->focusPrev

    $widget->flashMatchingChar

    $widget->removeMatch

    $widget->findMatchingChar

    $widget->jumpToMatchingChar

    $widget->escape

    $widget->tab

    $widget->leftTab

    $widget->copy

    $widget->cut

    $widget->paste

    $widget->inlinePaste

    $widget->undo

    $widget->redo

    $widget->destroy

    $widget->menuSelect

AUTHOR

Current maintainer is Alexander Becker, asb@cpan.org.

Originally written by Alessandro Iob.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Tk::Text Tk::ROText Tk::TextUndo

KEYWORDS

text, widget