Text Widget Actions
Author: Roland Krause 2002, roland_krause@freenet.de
Description: Documentation to XawPlus

### _________________________________________________________XawPlus

### Text Widget Actions

All editing functions are performed by translation manager actions that may be specified through the translations resource in the Text widget.

### Differences between Xaw and XawPlus

None.

### Cursor Movement Actions

forward-character() backward-character() | These actions move the insert point forward or backward one character in the buffer. If the insert point is at the end or beginning of a line this action will move the insert point to the next (or previous) line.
backward-character() | These actions move the insert point forward or backward one character in the buffer. If the insert point is at the end or beginning of a line this action will move the insert point to the next (or previous) line.
forward-word() backward-word() | These actions move the insert point to the next or previous word boundary. A word boundary is defined as a Space, Tab or Carriage Return.
forward-paragraph() backward-paragraph() | These actions move the insert point to the next or previous paragraph boundary. A paragraph boundary is defined as two Carriage Returns in a row with only Spaces or Tabs between them.
beginning-of-line() end-of-line() | These actions move to the beginning or end of the current line. If the insert point is already at the end or beginning of the line then no action is taken.
next-line() previous-line() | These actions move the insert point up or down one line. If the insert point is currently N characters from the beginning of the line then it will be N characters from the beginning of the next or previous line. If N is past the end of the line, the insert point is placed at the end of the line.
next-page() previous-page() | These actions move the insert point up or down one page in the file. One page is defined as the current height of the text widget. The insert point is always placed at the first character of the top line by this action.
beginning-of-file() end-of-file() | These actions place the insert point at the beginning or end of the current text buffer. The text widget is then scrolled the minimum amount necessary to make the new insert point location visible.
scroll-one-line-up() scroll-one-line-down() | These actions scroll the current text field up or down by one line. They do not move the insert point. Other than the scrollbars this is the only way that the insert point may be moved off of the visible text area. The widget will be scrolled so that the insert point is back on the screen as soon as some other action is executed.

### Delete Actions

delete-next-character() delete-previous-character() | These actions remove the character immediately before or after the insert point. If a Carriage Return is removed then the next line is appended to the end of the current line.
delete-next-word() delete-previous-word() | These actions remove all characters between the insert point location and the next word boundary. A word boundary is defined as a Space, Tab or Carriage Return.
delete-selection() | This action removes all characters in the current selection. The selection can be set with the selection actions.

### Selection Actions

select-word() | This action selects the word in which the insert point is currently located. If the insert point is between words then it will select the previous word.
select-all() | This action selects the entire text buffer.
select-start() | This action sets the insert point to the current pointer location. It will then begin a selection at this location. If many of these selection actions occur quickly in succession then the selection count mechanism will be invoked (see the section titled Text Selections for Application Programmers for details).
select-adjust() | This action allows a selection started with the select-start action to be modified, as described above.
select-end (name[,name, ...]) | This action ends a text selection that began with the select-start action, and asserts ownership of the selection or selections specified. A name can be a selection (e.g. PRIMARY) or a cut buffer (e.g CUT_BUFFER0). Note that case is important. If no names are specified, PRIMARY is asserted.
extend-start() | This action finds the nearest end of the current selection, and moves it to the current pointer location.
extend-adjust() | This action allows a selection started with an extend-start action to be modified.
extend-end (name[,name, ...]) | This action ends a text selection that began with the extend-start action, and asserts ownership of the selection or selections specified. A name can be a selection (e.g. PRIMARY) or a cut buffer (e.g CUT_BUFFER0). Note that case is important. If no names are given, PRIMARY is asserted.
insert-selection (name[,name ,...]) | This action retrieves the value of the first (left-most) named selection that exists or the cut buffer that is not empty and inserts it into the Text widget at the current insert point location. A name can be a selection (e.g. PRIMARY) or a cut buffer (e.g CUT_BUFFER0). Note that case is important.

### New Line Actions

newline-and-indent() | This action inserts a newline into the text and adds spaces to that line to indent it to match the previous line.
newline-and-backup() | This action inserts a newline into the text after the insert point.
newline() | This action inserts a newline into the text before the insert point.

### Kill Actions

kill-word() backward-kill-word() | These actions act exactly like the delete-next-word and delete-previous-word actions, but they stuff the word that was killed into the kill buffer (CUT_BUFFER_1).
kill-selection() | This action deletes the current selection and stuffs the deleted text into the kill buffer (CUT_BUFFER_1).
kill-to-end-of-line() | This action deletes the entire line to the right of the insert point position, and stuffs the deleted text into the kill buffer (CUT_BUFFER_1).
kill-paragraph() | This action deletes the current paragraph, if between paragraphs it deletes the paragraph above the insert point, and stuffs the deleted text into the kill buffer (CUT_BUFFER_1).
kill-to-end-of-paragraph() | This action deletes everything between the current insert point location and the next paragraph boundary, and stuffs the deleted text into the kill buffer (CUT_BUFFER_1).

### Miscellaneous Actions

redraw-display() | This action recomputes the location of all the text lines on the display, scrolls the text to vertically center the line containing the insert point on the screen, clears the entire screen, and redisplays it.
insert-file([filename]) | This action activates the insert file popup. The filename option specifies the default filename to put in the filename buffer of the popup. If no filename is specified the buffer is empty at startup.
insert-char() | This action may only be attached to a key event. It calls XLookupString to translate the event into a (rebindable) Latin-1 character (sequence) and inserts that sequence into the text at the insert point position.
insert-string (string[,string ,...]) | This action inserts each string into the text at the insert point location. Any string beginning with the characters "0x" and containing only valid hexadecimal digits in the remainder is interpreted as a hexadecimal constant and the corresponding single character is inserted instead.
display-caret (state,when) | This action allows the insert point to be turned on and off. The state argument specifies the desired state of the insert point. This value may be any of the string values accepted for Boolean resources (e.g. on, True, off, False, etc.). If no arguments are specified, the default value is True. The when argument specifies, for EnterNotify or LeaveNotify events whether or not the focus field in the event is to be examined. If the second argument is not specified, or specified as something other than always then if the action is bound to an EnterNotify or LeaveNotify event, the action will be taken only if the focus field is True. An augmented binding that might be useful is: *Text.Translations: #override \\ : display-caret(on) \\n\\ : display-caret(off)
focus-in() focus-out() | These actions do not currently do anything.
search(direction, [string]) | This action activates the search popup. The direction must be specified as either forward or backward. The string is optional and is used as an initial value for the Search for: string. For further explanation of the search widget see the section on Text Searches.
multiply(value) | The multiply action allows the user to multiply the effects of many of the text actions. Thus the following action sequence multiply(10) delete-next-word() will delete 10 words. It does not matter whether these actions take place in one event or many events. Using the default translations the key sequence Control-u, Control-d will delete 4 characters. Multiply actions can be chained, thus multiply(5) multiply(5) is the same as multiply(25). If the string reset is passed to the multiply action the effects of all previous multiplies are removed and a beep is sent to the display.
form-paragraph() | This action removes all the Carriage Returns from the current paragraph and reinserts them so that each line is as long as possible, while still fitting on the current screen. Lines are broken at word boundaries if at all possible. This action currently works only on Text widgets that use ASCII text.
transpose-characters() | This action will swap the position of the character to the left of the insert point with the character to the right of the insert point. The insert point will then be advanced one character.
no-op([action]) | The no-op action makes no change to the text widget, and is mainly used to override translations. This action takes one optional argument. If this argument is RingBell then a beep is sent to the display.
XawWMProtocols ([wm_protocol_name]) | This action is written specifically for the transient shells instantiated by the Text widget, which are the file insertion and the search and replace dialog boxes. This action is attached to those shells by the Text widget, in order to handle ClientMessage events with the WM_PROTOCOLS atom in the detail field. This action supports WM_DELETE_WINDOW on the Text widget popups, and may support other window manager protocols if necessary in the future. The popup will be dismissed if the window manager sends a WM_DELETE_WINDOW request and there are no parameters in the action call, which is the default. The popup will also be dismissed if the parameters include the string "wm_delete_window", and the event is a ClientMessage event requesting dismissal or is not a ClientMessage event. This action is not sensitive to the case of the strings passed as parameters.

### Text Selections for Application Programmers

The default behavior of the text selection array is described in the section called Text Selections for Users. To modify the selections a programmer must construct a XawTextSelectType array (called the selection array), containing the selections desired, and pass this as the new value for the selectionTypes resource. The selection array may also be modified using the XawTextSetSelectionArray function. All selection arrays must end with the value XawselectNull. The selectionTypes resource has no converter registered and cannot be modified through the resource manager.

The array contains a list of entries that will be called when the user attempts to select text in rapid succession with the select-start action (usually by clicking a pointer button). The first entry in the selection array will be used when the select-start action is initially called. The next entry will be used when select-start is called again, and so on. If a timeout value (1/10 of a second) is exceeded, the the next select-start action will begin at the top of the selection array. When XawselectNull is reached the array is recycled beginning with the first element.

XawselectAll | Selects the contents of the entire buffer.
XawselectChar | Selects text characters as the pointer moves over them.
XawselectLine | Selects the entire line.
XawselectNull | Indicates the end of the selection array.
XawselectParagraph | Selects the entire paragraph.
XawselectPosition | Selects the current pointer position.
XawselectWord | Selects whole words as the pointer moves onto them.

The default selectType array is: {XawselectPosition, XawselectWord, XawselectLine, XawselectParagraph, XawselectAll, XawselectNull}

The selection array is not copied by the text widgets. The application must allocate space for the array and cannot deallocate or change it until the text widget is destroyed or until a new selection array is set.

### Default Translation Bindings

The following translations are defaults built into every Text widget. They can be overridden, or replaced by specifying a new value for the Text widget's translations resource.

Ctrl<Key>A: Ctrl<Key>B: Ctrl<Key>D: Ctrl<Key>E: Ctrl<Key>F: Ctrl<Key>G: Ctrl<Key>H: Ctrl<Key>J: Ctrl<Key>K: Ctrl<Key>L: Ctrl<Key>M: Ctrl<Key>N: Ctrl<Key>O: Ctrl<Key>P: Ctrl<Key>R: Ctrl<Key>S: Ctrl<Key>T: Ctrl<Key>U: Ctrl<Key>V: Ctrl<Key>W: Ctrl<Key>Y: Ctrl<Key>Z: Meta<Key>B: Meta<Key>F: Meta<Key>I: Meta<Key>K: Meta<Key>Q: Meta<Key>V: Meta<Key>Y: Meta<Key>Z: :Meta<Key>d: :Meta<Key>D: :Meta<Key>h: :Meta<Key>H: :Meta<Key>\\<: :Meta<Key>\\>: :Meta<Key>]: :Meta<Key>[: ~Shift Meta<Key>Delete: \ Shift Meta<Key>Delete: ~Shift Meta<Key>Backspace: \ Shift Meta<Key>Backspace: <Key>Right: <Key>Left: <Key>Down: <Key>Up: <Key>Delete: <Key>BackSpace: <Key>Linefeed: <Key>Return: <Key>: <FocusIn>: <FocusOut>: <Btn1Down>: <Btn1Motion>: <Btn1Up>: <Btn2Down>: <Btn3Down>: <Btn3Motion>: <Btn3Up>: | beginning-of-line() backward-character() delete-next-character() end-of-line() forward-character() multiply(Reset) delete-previous-character() newline-and-indent() kill-to-end-of-line() redraw-display() newline() next-line() newline-and-backup() previous-line() search(backward) search(forward) transpose-characters() multiply(4) next-page() kill-selection() insert-selection(CUT_BUFFER1) scroll-one-line-up() backward-word() forward-word() insert-file() kill-to-end-of-paragraph() form-paragraph() previous-page() insert-selection(PRIMARY, CUT_BUFFER0) scroll-one-line-down() delete-next-word() kill-word() delete-previous-word() backward-kill-word() beginning-of-file() end-of-file() forward-paragraph() backward-paragraph() delete-previous-word() backward-kill-word() delete-previous-word() backward-kill-word() forward-character() backward-character() next-line() previous-line() delete-previous-character() delete-previous-character() newline-and-indent() newline() insert-char() focus-in() focus-out() select-start() extend-adjust() extend-end(PRIMARY, CUT_BUFFER0) insert-selection(PRIMARY, CUT_BUFFER0) extend-start() extend-adjust() extend-end(PRIMARY, CUT_BUFFER0)

### XawPlus_________________________________________________________