Text Widget Actions
All editing functions are performed by translation manager actions that may
be specified through the translations resource in the Text widget.
Insert Point Movement Delete
forward-character delete-next-character
backward-character delete-previous-character
forward-word delete-next-word
backward-word delete-previous-word
forward-paragraph delete-selection
backward-paragraph
beginning-of-line
end-of-line Selection
next-line select-word
previous-line select-all
next-page select-start
previous-page select-adjust
beginning-of-file select-end
end-of-file extend-start
scroll-one-line-up extend-adjust
scroll-one-line-down extend-end
insert-selection
Miscellaneous New Line
redraw-display newline-and-indent
insert-file newline-and-backup
insert-char newline
insert-string
display-caret
focus-in Kill
focus-in kill-word
search backward-kill-word
multiply kill-selection
form-paragraph kill-to-end-of-line
transpose-characters kill-paragraph
no-op kill-to-end-of-paragraph
XawWMProtocols
reconnect-im
Most of the actions take no arguments, and unless otherwise noted you
may assume this to be the case.
Cursor Movement Actions\fP
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.
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 (if
triggered by a button event) or text cursor location (if triggered by
a key event). 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 \fBText Selections for
Application Programmers\fP 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 (if triggered by a button event) or text
cursor location (if triggered by a key event).
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.
The 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 and 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. When the
international resource is false, this action
calls XLookupString to translate the event into a (rebindable) Latin-1
character (sequence) and inserts it into the text at the
insert point. When the international resource is true,
characters are passed to the input method via XwcLookupString, and any
committed string returned is inserted into the text at the insert point.
insert-string(string[,string,...])
This action inserts each string into the text
at the insert point location. Any string
beginning with the characters "0x" followed by an even
number of hexadecimal digits is
interpreted as a hexadecimal constant and the
corresponding string is inserted instead. This
hexadecimal string may represent up to 50 8-bit characters.
When theinternational resource is
true, a hexadecimal string is intrepeted as
being in a multi-byte encoding, and a hexadecimal
or regular string will result in an error message
if it is not legal in the current locale.
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 \\
<FocusIn>: display-caret(on) \\n\\
<FocusOut>: 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 \fIControl-u,
Control-d\fP will delete 4 characters.
Multiply actions can be chained, thus \fImultiply(5)
multiply(5)\fP 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 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.
reconnect-im()
When the international resource is true,
input is usually passed to an input method, a separate
process, for composing. Sometimes the connection to
this process gets severed; this action will attempt to
reconnect it. Causes for severage include network
trouble, and the user explicitly killing one input
method and starting a new one. This action may also
establish first connection when the application is
started before the input method.
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.