TKE  3.6
Advanced code editor for programmers
api::edit Namespace Reference

Functions

 get_index interp pname txt position args
 
 delete interp pname txt startpos endpos copy
 
 toggle_case interp pname txt startpos endpos
 
 lower_case interp pname txt startpos endpos
 
 upper_case interp pname txt startpos endpos
 
 rot13 interp pname txt startpos endpos
 
 title_case interp pname txt startpos endpos
 
 join_lines interp pname txt ?num?
 
 bubble_up interp pname txt
 
 bubble_down interp pname txt
 
 comment interp pname txt
 
 uncomment interp pname txt
 
 toggle_comment interp pname txt
 
 indent interp pname txt ?startpos? ?endpos?
 
 unindent interp pname txt ?startpos? ?endpos?
 
 move_cursor interp pname txt position args
 
 format interp pname txt type
 
 unformat interp pname txt
 

Function Documentation

§ bubble_down()

api::edit::bubble_down   interp pname txt  

Moves the current line down by one (unless the current line is the last line in the buffer. If any text is selected, lines containing a selection will be moved down by one line.

Parameters
txtText widget to change.

Definition at line 673 of file api.tcl.

673  proc bubble_down {interp pname txt} {
674 
676 
677  }

§ bubble_up()

api::edit::bubble_up   interp pname txt  

Moves the current line up by one (unless the current line is the first line in the buffer. If any text is selected, lines containing a selection will be moved up by one line.

Parameters
txtText widget to change.

Definition at line 661 of file api.tcl.

661  proc bubble_up {interp pname txt} {
662 
664 
665  }

§ comment()

api::edit::comment   interp pname txt  

Comments the currently selected lines.

Parameters
txtText widget to comment.

Definition at line 683 of file api.tcl.

683  proc comment {interp pname txt} {
684 
685  edit::comment_text [winfo parent $txt]
686 
687  }

§ delete()

api::edit::delete   interp pname txt startpos endpos copy  

Deletes all characters between startpos and endpos-1, inclusive.

Parameters
txtPathname of text widget to delete text from.
startposText widget index to begin deleting from.
endposText widget index to stop deleting from.
copyCopies deleted text to the clipboard.

Definition at line 565 of file api.tcl.

565  proc delete {interp pname txt startpos endpos copy} {
566 
567  edit::delete $txt $startpos $endpos $copy 1
568 
569  }

§ format()

api::edit::format   interp pname txt type  

Adds text formatting to current word of the given type. If text is currently selected, the formatting will be applied to all of the selected text.

Parameters
txtText widget to apply formatting to.
typeType of formatting to apply. The available formats supported by the current syntax are allowed. The legal values for this parameter are as follows:
  • bold
  • italics
  • underline
  • strikethrough
  • highlight
  • superscript
  • subscript
  • code
  • header1
  • header2
  • header3
  • header4
  • header5
  • header6
  • unordered
  • ordered

Definition at line 776 of file api.tcl.

776  proc format {interp pname txt type} {
777 
778  edit::format $txt $type
779 
780  }

§ get_index()

api::edit::get_index   interp pname txt position args  
Returns
Returns the text widget index based on the given input parameters.
Parameters
txtPathname of text widget to get index of.
positionThe specifies the visible cursor position to lookup. The values that can be used for this option are as follows:
  • left Index num characters left of the starting position, staying on the same line.
  • right Index num characters right of the starting position, staying on the same line.
  • up Index above the starting position, remaining in the same column, if possible.
  • down Index below the starting position, remaining in the same column, if possible.
  • first Index of the first line/column in the buffer.
  • last Index of the last line/column in the buffer.
  • char Index of the a specified character before or after the starting position.
  • dchar Index of num'th character before or after the starting position.
  • findchar Index of a specified character before or after the starting position.
  • firstchar Index of first non-whitespace character of the line specified by startpos.
  • lastchar Index of last non-whitespace character of the line specified by startpos.
  • wordstart Index of the first character of the word containing startpos.
  • wordend Index of the last character+1 of the word containing startpos.
  • WORDstart Index of the first character of the WORD containing startpos.
  • WORDend Index of the last character+1 of the WORD containing startpos.
  • column Index of the character in the line containing startpos at the num'th position.
  • linenum Index of the first non-whitespace character on the given line.
  • linestart Index of the beginning of the line containing startpos.
  • lineend Index of the ending of the line containing startpos.
  • dispstart Index of the first character that is displayed in the line containing startpos.
  • dispmid Index of the middle-most character that is displayed in the line containing startpos.
  • dispend Index of the last character that is displayed in the line containing startpos.
  • screentop Index of the start of the first line that is displayed in the buffer.
  • screenmid Index of the start of the middle-most line that is displayed in the buffer.
  • screenbot Index of the start of the last line that is displayed in the buffer.
  • numberstart First numerical character of the word containing startpos.
  • numberend Last numerical character of the word containing startpos.
  • spacestart First whitespace character of the whitespace containing startpos.
  • spaceend Last whitespace character of the whitespace containing startpos.
argsModifier arguments based on position value. -dir Specifies direction from starting position (values are "next" or "prev"). Defaults to "next". -startpos Specifies the starting index of calculation. Defaults to "insert". -num Specifies the number to apply. Defaults to 1. -char Used with "findchar" position type. Specifies the character to find. -exclusive If set to 1, returns character position before calculated index. Defaults to 0. -column Specifies the name of a variable containing the column to use for "up" and "down" positions. -adjust Adjusts the calculated index by the given value before returning the result.

Definition at line 552 of file api.tcl.

552  proc get_index {interp pname txt position args} {
553 
554  return [edit::get_index $txt $position {*}$args]
555 
556  }

§ indent()

api::edit::indent   interp pname txt ?startpos? ?endpos?  

Indents the given range of text between startpos and endpos-1, inclusive, by one level of indentation. If text is currently selected, the selected text is indented instead.

Parameters
txtText widget to indent.
startposStarting position of range to indent.
endposEnding position of range to indent.

Definition at line 717 of file api.tcl.

717  proc indent {interp pname txt {startpos insert} {endpos insert}} {
718 
719  edit::indent $txt $startpos $endpos
720 
721  }

§ join_lines()

api::edit::join_lines   interp pname txt ?num?  

Joins the given number of lines, guaranteeing that on a single space separates the text of each joined line, starting at the current insertion cursor position. If text is selected, any line that contains a selection will be joined together.

Parameters
txtText widget to modify.
numNumber of lines to join below current line.

Definition at line 649 of file api.tcl.

649  proc join_lines {interp pname txt {num 1}} {
650 
652 
653  }

§ lower_case()

api::edit::lower_case   interp pname txt startpos endpos  

Transforms all text in the given range of startpos to endpos-1, inclusive, to lower case. If text is seelected, the selected text is transformed instead of the given range.

Parameters
txtText widget to modify.
startposStarting index of range to modify.
endposEnding index of range to modify.

Definition at line 593 of file api.tcl.

593  proc lower_case {interp pname txt startpos endpos} {
594 
595  edit::transform_to_lower_case $txt $startpos $endpos
596 
597  }

§ move_cursor()

api::edit::move_cursor   interp pname txt position args  

Moves the cursor to the given cursor position. The value of position and args are the same as those of the api::edit::get_index.

Parameters
txtText widget to change the cursor of.
positionPosition to move the cursor to (see api::edit::get_index)
argsList of arguments based on position value (see api::edit::get_index)

Definition at line 744 of file api.tcl.

744  proc move_cursor {interp pname txt position args} {
745 
746  edit::move_cursor $txt $position {*}$args
747 
748  }

§ rot13()

api::edit::rot13   interp pname txt startpos endpos  

Transforms all text in the given range of startpos to endpos-1, inclusive, to its rot13 equivalent. If text is selected, the selected text is transformed instead of the given range.

Parameters
txtText widget to modify.
startposStarting index of range to modify.
endposEnding index of range to modify.

Definition at line 621 of file api.tcl.

621  proc rot13 {interp pname txt startpos endpos} {
622 
623  edit::transform_to_rot13 $txt $startpos $endpos
624 
625  }

§ title_case()

api::edit::title_case   interp pname txt startpos endpos  

Transforms all text in the given range of startpos to endpos-1, inclusive, to title case (first character of each word is capitalized while the rest of the characters are set to lowercase).

Parameters
txtText widget to modify.
startposStarting index of range to modify.
endposEnding index of range to modify.

Definition at line 635 of file api.tcl.

635  proc title_case {interp pname txt startpos endpos} {
636 
637  edit::transform_to_title_case $txt $startpos $endpos
638 
639  }

§ toggle_case()

api::edit::toggle_case   interp pname txt startpos endpos  

Toggles the case of all characters in the range of startpos to endpos-1, inclusive. If text is selected, the selected text is toggled instead of the given range.

Parameters
txtText widget to modify.
startposStarting index of range to modify.
endposEnding index of range to modify.

Definition at line 579 of file api.tcl.

579  proc toggle_case {interp pname txt startpos endpos} {
580 
581  edit::transform_toggle_case $txt $startpos $endpos
582 
583  }

§ toggle_comment()

api::edit::toggle_comment   interp pname txt  

Toggles the comment status of the currently selected lines.

Parameters
txtText widget to change.

Definition at line 703 of file api.tcl.

703  proc toggle_comment {interp pname txt} {
704 
705  edit::comment_toggle_text [winfo parent $txt]
706 
707  }

§ uncomment()

api::edit::uncomment   interp pname txt  

Uncomments the currently selected lines.

Parameters
txtText widget to uncomment.

Definition at line 693 of file api.tcl.

693  proc uncomment {interp pname txt} {
694 
695  edit::uncomment_text [winfo parent $txt]
696 
697  }

§ unformat()

api::edit::unformat   interp pname txt  

Removes any formatting that is applied to the selected text.

Parameters
txtText widget to unformat.

Definition at line 786 of file api.tcl.

786  proc unformat {interp pname txt} {
787 
788  edit::unformat $txt
789 
790  }

§ unindent()

api::edit::unindent   interp pname txt ?startpos? ?endpos?  

Unindents the given range of text between startpos and endpos-1, inclusive, by one level of indentation. If text is currently selected, the selected text is unindented instead.

Parameters
txtText widget to unindent.
startposStarting position of range to unindent.
endposEnding position of range to unindent.

Definition at line 731 of file api.tcl.

731  proc unindent {interp pname txt {startpos insert} {endpos insert}} {
732 
733  edit::unindent $txt $startpos $endpos
734 
735  }

§ upper_case()

api::edit::upper_case   interp pname txt startpos endpos  

Transforms all text in the given range of startpos to endpos-1, inclusive, to upper case. If text is selected, the selected text is transformed instead of the given range.

Parameters
txtText widget to modify.
startposStarting index of range to modify.
endposEnding index of range to modify.

Definition at line 607 of file api.tcl.

607  proc upper_case {interp pname txt startpos endpos} {
608 
609  edit::transform_to_upper_case $txt $startpos $endpos
610 
611  }