Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ xedit(1) — DeltaWindows 1.3.3 Release 4 Version 4.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

 

NAME

xedit − simple text editor for X. 

SYNTAX

xedit [options] [filename]

DESCRIPTION

xedit provides a window consisting of the following four areas:

Commands Section
A set of commands that allows you to exit xedit, save the file, or load a new file into the edit window. 

Message Window
Displays xedit messages. In addition, this window can be used as a scratch pad. 

Filename Display
Displays the name of the file currently being edited, and whether this file is Read−Write or Read Only. 

Edit Window
Displays the text of the file that you are editing or creating.

Chapter 8, Other Clients, describes how to use the xedit client. 

Command Buttons 

QuitQuits the current editing session. If any changes have not been saved, xedit displays a warning message, allowing the user to save the file. 

SaveIf file backups are enabled (see "Resources"), xedit stores a copy of the original, unedited file in <prefix>filename<suffix>, then overwrites the filename with the contents of the edit window.  The filename is retrieved from the Text widget directly to the right of the Load button. 

LoadLoads the file named in the Text widget immediately to the right of this button and displays it in the Edit Window.  If the currently displayed file has been modified, a warning message will ask the user to save the changes or to press Load again. 

Editing 

The Athena Text widget is used for the three sections of this application that allow text input, namely the Message Window, the Edit Window, and the window to the right of the command buttons, in which a filename can be entered. 

The characters typed will go to the Text widget that the pointer is currently over.  If the pointer is not over a Text widget, then the keypresses will have no effect on the application.  This is also true for the special key sequences that pop-up dialog widgets; so, for example, typing CTRL-s in the filename widget (next to the command buttons) will enable searching in that widget, not the Edit Window (edit widget). 

Both the Message Window and the Edit Window will create a scrollbar if the text to display is too large to fit in that window.  Horizontal scrolling is not allowed by default, but can be turned on through the Text widget’s resources.  See Appendix G, Athena Widget Resources, for more information. 

The following list summarizes the editing commands recognized by xedit (i.e., by the Text widget). 

Control-aMove to the beginning of the current line. 

Control-bMove backward one character. 

Control-dDelete the next character. 

Control-eMove to the end of the current line. 

Control-fMove forward one character. 

Control-h orDelete the previous character. 

Backspace

Control-jNew line and indent. 

Control-kKill the rest of this line.  (Does not kill the carriage return at the end of the line.  To do so, use Control-k twice.  However, be aware that the second kill overwrites the text line in the kill buffer.) 

Control-lRedraw the window.  (Also scrolls text so that cursor is positioned in the middle of the window.) 

Control-mNew line. 

Return, or

LineFeed

Control-nMove down to the next line. 

Control-oDivide this line into two lines at this point and move the cursor back up. 

Control-pMove up to the previous line. 

Control-rSearch and replace backward. 

Control-sSearch and replace forward. 

Control-tTranspose characters.  (Swap the characters immediately before and after the cursor.) 

Control-uPerform next command four times.  For example, the sequence Control-u, Control-n moves the cursor down four lines. 

Control-vMove down to the next screenful of text. 

Control-wKill the selected text. 

Control-yInsert the last killed text.  (If the last killed text is a carriage return--see Control-k above--a blank line is inserted.) 

Control-zScroll up the text one line. 

Meta-<Move to the beginning of the file. 

Meta->Move to the end of the file. 

Meta-[Move backward one paragraph. 

Meta-]Move forward one paragraph. 

Meta-bMove backward one word. 

Meta-dDelete the next word. 

Meta-DKill the next word. 

Meta-fMove forward one word. 

Meta-h,Delete the previous word. 

Meta-Backspace, or

Meta-Delete

Meta-H,Kill the previous word. 

Meta-Shift-Backspace, or

Meta-Shift-Delete

Meta-iInsert a file.  A dialog box will appear in which you can type the desired filename. 

Meta-kKill to the end of the paragraph. 

Meta-qJoin lines to form a paragraph. 

Meta-vMove up to the previous screenful of text. 

Meta-yInsert the last selected text here.  Note that this can be text selected in some other text subwindow.  Also, if you select some text in an xterm window, it may be inserted in an xedit window with this command.  Pressing pointer button 2 is equivalent to this command. 

Meta-zScroll down the text one line. 

DeleteDelete the previous character. 

Note that a translation in the application defaults file overrides the translation for the Return key for the text window in which a filename can be entered (next to the command buttons);  in this window only, instead of starting a new line, Return moves the editing cursor to the end of the current line. 

The Text widget fully supports the X selection and cut buffer mechanisms (described in Chapter 5, The xterm Terminal Emulator).  Thus, you can cut and paste text in any of the sections of the xedit window that allow text input.  You can also cut and paste text between xedit and any other application (such as xterm) that supports text selections.  See Chapter 5 for instructions on cutting and pasting text. 

OPTIONS

xedit accepts all of the standard X Toolkit command-line options, which are listed on the X reference page.  In addition, xedit accepts the following argument:

filename
Specifies the file that is to be loaded during start up. This is the file that will be edited. If a file is not specified, xedit lets you load a file or create a new file after it has started up. 

WIDGET HIERARCHY

In order to specify resources, it is useful to know the hierarchy of the widgets which compose xedit.  In the notation below, indentation indicates hierarchical structure.  The widget class name is given first, followed by the widget instance name.  Xedit  xedit  Paned  paned  Paned  buttons  Command  quit  Command  save  Command  load  Text     filename  Label  bc_label  Text   messageWindow
 
Label  labelWindow  Text   editWindow See Appendix G, Athena Widget Resources for a list of resources that can be set for the Athena widgets.  (Note that the Text widget recognizes actions that control cursor movement, editing, text selection, etc.) 

RESOURCES 

The available application resources are:

enableBackups (class EnableBackups)
Specifies that when edits made to an existing file are saved, xedit is to copy the original version of that file to <prefix>filename<suffix> before it saves the changes.  The default value for this resource is "off," stating that no backups should be created. 

backupNamePrefix (class BackupNamePrefix)
Specifies a string that is to be prepended to the backup filename.  The default is that no string shall be prepended.

backupNameSuffix (class BackupNameSuffix)
Specifies a string that is to be appended to the backup filename.  The default is to append the string ".BAK".

ACTIONS

Many standard keyboard editing facilities are supported by the event bindings.  You can map actions to key and pointer button events using the translation mechanism described in Chapter 11, Setting Resources.  For the Text widget, the following actions are supported:

Cursor Movement Action


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 backward-paragraph
beginning-of-line selection
end-of-line insert-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
new Line miscellaneous
newline-and-indent redraw-display
newline-and-backup insert-file
newline insert-char
kill display-caret
kill-word focus-in
backward-kill-word focus-out
kill-selection search
kill-to-end-of-line multiply
kill-paragraph form-paragraph
kill-to-end-of-paragraph transpose-characters
no movement no-op


•A page corresponds to the size of the Text window.  For example, if the Text window is 50 lines in length, scrolling forward one page is the same as scrolling forward 50 lines. 

•The delete action deletes a text item.  The kill action deletes a text item and puts the item in the kill buffer (X cut buffer 1). 

•The insert-selection action retrieves the value of a specified X selection or cut buffer, with fall-back to alternative selections or cut buffers. 

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 moves 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, a tab, or a 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, 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. These actions always place the insert point at the first character of the top line.

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 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 after or before the insert point.  If a carriage return is removed, 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, a tab, or a 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, 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, where a selection then begins.  If many of these selection actions occur quickly in succession then the selection count mechanism will be invoked.

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 name is 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.  This action then 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. 

newline 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.  (Note: this action still has a few bugs.)

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 store the word that was killed into the kill buffer (CUT_BUFFER_1). 

kill-selection()
This action deletes the current selection and stores 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, and stores the deleted text into the kill buffer (CUT_BUFFER_1). 

kill-paragraph()
This action deletes the current paragraph.  If the insert point is between paragraphs, it deletes the paragraph above the insert point, and stores the deleted text into the kill buffer (CUT_BUFFER_1). 

kill-to-end-of-paragraph()
This action deletes everything between the current insert point and the next paragraph boundary, and puts 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 then redisplays it.

insert-file([filename])
This action activates the insert file pop-up.  The filename option specifies the default filename to put in the filename buffer of the pop-up.  If no filename is specified the buffer is empty at startup. 

insert-char()
This action may be attached only 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 \
     <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. 

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 switch the positions of the character to the left of the insert point and 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 used mainly to override translations.  This action takes one optional argument.  If this argument is RingBell then a beep is sent to the display. 

FILES

/usr/lib/X11/app-defaults/Xedit—Specifies required resources. 

RESTRICTIONS

There is no undo function. 

SEE ALSO

X, xrdb; Chapter 8, Other Clients; Appendix G, Athena Widget Resources. 

COPYRIGHT

Copyright © 1988, Digital Equipment Corporation.  Copyright © 1989, Massachusetts Institute of Technology. 

AUTHOR

Chris D. Peterson, MIT X Consortium. 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026