Editing Documents

From Wenlin Guide
Jump to navigation Jump to search

Wenlin 216x93.png Chapter 8 of the Wenlin User’s Guide

This chapter describes Wenlin’s text editor, Edit menu commands, and text formatting codes. It also describes how to save a document after editing it.

With the Wenlin text editor, you can create and edit documents in Chinese characters, pinyin, and English. A complete set of editing tools is available for efficiently cutting, copying, and pasting text within a document or between documents.

This chapter assumes familiarity with Chapters 1 through 4 of this Guide.

Chapter 9 will describe how you can edit the dictionaries.

Plain Text Editing

You can edit files of practically any size in Wenlin (up to two gibibytes, or about two billion characters, which is huge). Wenlin is a plain text editor. It is suitable for reading and writing plain text documents, that can also be read or written using a variety of other Chinese language software programs, on various kinds of computer. There are no special formatting codes for bold or italic text, or mixing different sizes of text, because those features aren’t supported.

Since Wenlin uses word wrap, as explained in Chapter 1, you should press the Return or Enter key only to separate paragraphs, but not at the end of each line. Otherwise, if you end each line with a newline character, then when you change the text size, or add or delete words, some lines may end in awkward places.

While editing, you needn’t worry about inadvertently closing a window and losing your work. If you’ve made changes to the text, Wenlin offers you the option of saving the changes before it closes the window. Similarly, when you quit the program, Wenlin prompts you to save each and every window that you have edited.

Creating a New Document

To create a new document, simply do this:

• Choose New from the File menu
A new window appears
It is the active window
The title of the window is Editing Untitled
Editing is automatically enabled

You can have multiple Editing Untitled windows open simultaneously.

When saving to disk, you must give each document a unique name (something other than “Untitled”).

Editing an Existing Document

Chapter 3 explains how to open a document, so that you can view it in a window.

When you wish to edit a document that’s already in a window:

• Make the window active (click on its title bar, if necessary)
The title bar is highlighted
• Choose Enable Editing from the File menu
The window’s title changes from (Filename) to Editing (Filename)

You can’t edit the same file in multiple windows; but you can edit a file in one window and have copies of the file in one or more read-only windows (i.e., windows in which editing is not enabled).

The Editable Window: Enabled and Active

You can have multiple windows on the screen, each with editing enabled. When you type, text appears in the active window (that is, the window whose title bar is highlighted). Therefore, a window is editable only when editing is enabled for that window and it is the active window. So keep track of the active window and pay attention to the position of the insertion point.

The Edit Menu

If you’ve used other programs that have an Edit menu, most of Wenlin’s Edit commands may already be familiar to you. Just remember that you need to use the Mouse pointer ibeam.jpg I-beam tool when you select text with the mouse. Wenlin also has some unique editing commands, such as Convert, Grab, and Make Transformed Copy, described below.

The availability of the Edit commands depends on the circumstances. For example, Copy is not available until some text is highlighted. Below is a brief description of each command. Later, we illustrate the commands in some typical situations.

Note: Wenlin, like most editors, makes use of a feature called the clipboard. You can think of the clipboard as a temporary storage area that helps you transfer text from one location to another.


Undo undoes the effects of the last editing action. For example, if you had just deleted some text, you could use Undo to restore it. The wording of the Undo command reflects the current circumstances. For example, if your last editing action was a Cut, the Undo command will read Undo Cut. You can even undo an Undo. For example, if you undo a deletion and then immediately choose Undo again, the wording will change to Redo Delete.

Some programs support “multiple levels” of undoing, but Wenlin only enables you to undo the most recent editing action.


Cut removes highlighted text and places it on the clipboard. You can then Paste the text somewhere else. The cut text remains on the clipboard until you choose Cut again, or use the Copy command (see below). The Cut command is available whenever text is highlighted in an editable window or dialog text box. The methods of selecting (highlighting) text are described in Chapter 1.


Copy places a duplicate of the highlighted text on the clipboard. It does not remove text – it leaves the original highlighted text in place, undisturbed. The copied text remains on the clipboard until you choose Cut or Copy again. The Copy command is available whenever text is highlighted. The text can be in a dialog text box or any window.


Paste inserts previously cut or copied text at the insertion point (or selection). It does not remove text from the clipboard, it simply inserts a copy of the text that is already on the clipboard. You can use Paste repeatedly, to insert the same piece of text at different times and locations. The Paste command is available when you are in an editable window or dialog text box and there is text on the clipboard.

Clipboard Format

You can copy and paste text between Wenlin and other programs. The most advanced programs support Unicode, and ideally you can copy and paste between Wenlin and other such programs easily, without worrying about the clipboard format (or encoding).

On Macintosh, Wenlin now assumes that all clipboard text will be Unicode. There is no longer a Clipboard Format item in the Edit menu.

However, on Windows operating systems some programs still only support GB2312 (“simplified”) or Big5 (“traditional”) Chinese text. To copy and paste between those programs and Wenlin, it may be necessary to specify the clipboard format first.

When you choose Clipboard Format from the Edit menu, a dialog box is displayed with a pop-up menu for specifying a format. If GB doesn’t work, try Big5, and vice-versa. Since GB2312 and Big5 are not as comprehensive as Unicode, some characters may be replaced by extended codes from GB18030 or Big5+ (“plus”), or codes like [U+n], where n is the Unicode number. To avoid this, use only simple form characters with GB and only full form characters with Big5. (The Make Transformed Copy command can be useful in this regard.) Besides GB and Big5, Wenlin supports UTF-8, ASCII, Latin1, and MacRoman. These formats are described in Chapter 3. (In brief, UTF-8 is Unicode, with the bits arranged differently; ASCII, Latin1, and MacRoman don’t include Chinese.)

The dialog box for the Clipboard Format command includes a check box, “Disable Unicode clipboard.” Normally, this check box should not be checked, since Unicode is the best way to share text between well-behaved modern programs. Why would you want to disable Unicode? Let’s clarify the situation. There can actually be two or more kinds of “clipping” in the clipboard at the same time. Each clipping has a label identifying it as text, a picture, a sound, or whatever. There can only be one ordinary (non-Unicode) “text” clipping at a time (and it doesn’t say what its format is), but there can simultaneously be a “Unicode text” clipping. This is standard in MS-Windows so different programs recognize these labels. When you copy from Wenlin, it normally puts both Unicode and non-Unicode clippings in the clipboard. When you paste into Wenlin, it normally uses the Unicode clipping, if there is one; otherwise, Wenlin uses the non-Unicode clipping. Generally, this is the best strategy. Occasionally, a program may create a bogus Unicode clipping, due to a failure to identify the original format of some text. (For example, a web browser might treat some GB text as though it were Big5.) In such situations, it may work better to disable Unicode, and set the non-Unicode clipboard format appropriately. There may also be situations where another program can accept either Unicode or non-Unicode, but you want it to receive only Unicode; then you can choose Disable non-Unicode clipboard from Wenlin’s pop-up menu.

When you’re copying and pasting only within Wenlin itself, and don’t need to exchange text with another program, you could disable both Unicode and non-Unicode. Then Wenlin will only use its internal clipboard (which is UTF-8, by the way), and it may be faster (but you’re only likely to notice a difference in speed if you’re copying very large pieces of text).

Here is one way to prevent Chinese e-mail from being garbled in transit. ASCII was originally only intended for English, but you can copy Chinese text from Wenlin as ASCII, and paste it into an e-mail message. All the non-ASCII characters are replaced by codes like [U+n], where n is the Unicode number. (You might need to disable Unicode, if your e-mail program supports Unicode.) The recipient of the message can recover the Chinese text by pasting it into Wenlin.


Clear deletes highlighted text in an editable window or dialog text box. It is available whenever text is highlighted in an editable window or a dialog text box.

Select All

Select All selects (highlights) the entire contents of a window, not just the visible portion. You can then delete, cut, or copy the window’s contents. Choosing Select All is often faster than selecting the window “by hand”, especially if the document is large.


Convert enables you to input Chinese characters by phonetic conversion or stroke count conversion. Chapter 4 gives details.


The “Grabber” is a Wenlin innovation that allows you to copy text using the mouse. In many situations, Grab is faster than Copy and Paste. When you choose Grab from the Edit menu (or click on the Mouse pointer grabber.jpg tool in the toolbar), the mouse pointer turns into a Mouse pointer grabber.jpg disk shape. You can then select any text on any line, and the text is copied to the current position of the insertion point. Since the Grabber is free to roam the screen, you can copy text from any window on the screen (you can even Grab the title of a window). Please note these three points:

Grab is available when the insertion point is in an editable window. Pay attention to the location of the insertion point!

A maximum of one horizontal line of text can be grabbed at a time.

The Grabber is invoked automatically when Wenlin displays a dialog text box.

Make Transformed Copy

The Make Transformed Copy... command brings up a dialog box with several transformations to choose from. (More transformations are available in this dialog box if the Show advanced items in the “Make Transformed Copy...” pop-up list item is enabled in Advanced Options.)

Two of the standard transformations enable you to convert semi-automatically between simple and full form characters. Another enables conversion of characters into pinyin. The highlighted text itself is not modified, but a copy of it is transformed and displayed in a new Untitled window.

To make a simple (or full) form version of an entire document:

• Open the document
• Choose Select All from the Edit menu
• Choose Make Transformed Copy... from the Edit menu
• Choose Simple (or Full) Form Characters from the menu in the dialog box
• Click on the OK button.

The operation may be slow for a long document, so you may prefer to do a paragraph or two at a time, depending on your purposes. To select (highlight) text with the mouse, use the Mouse pointer ibeam.jpg I-beam tool. If no text is selected, a transformed copy of the entire window is made.

Some characters are translated between simple and full forms differently depending on the context. Wenlin tries to do this automatically, by parsing the text into words (or phrases); when it can’t determine the appropriate character, it presents you with the alternatives, so that you can choose with a single mouse click. We call this fixing the text. For example, if you choose Full Form Characters, and the selection includes the simple form 发, then it should be translated to 發 if it means ‘emit’, but it should be translated to 髮 if it means ‘hair’. Wenlin isn’t able to determine the meaning from every possible context, but if the preceding character is 头 (頭 tóu ‘head’), then Wenlin translates the word 头发 into 頭髮 since that word is in the dictionary. Otherwise, if 发 does not occur as part of a polysyllabic word in the dictionary, then this notation is inserted in the text:


You can replace the whole notation with one of the characters 發 or 髮, simply by clicking on the round button that precedes it. You can also see the section of the on-line help that describes the Fix: notation, by clicking on the round button in front of the word Fix. If more than one character needs fixing, you can search for subsequent ones by choosing Find Fix and Find Again from the Search menu (described in Chapter 10).

Note: since the Simple/Full form transformations performed by Make Transformed Copy... can result in mistakes, both by the user and by the software itself, we recommend avoiding excessive dependence on it. It may be better to read a text in the forms of characters chosen by its author or editor. In fact, some Chinese texts on the Internet suffer from being automatically converted back and forth between the simple form GB format and the full form Big5 format, picking up small errors along the way. With the increasing use of Unicode, which allows the peaceful coexistence of simple and full form characters, it should be possible to avoid automatic conversion.

Make Transformed Copy... also offers these other useful transformations:

  • Replace 1-4 with tone marks transforms, for example, ni3 hao3 into nǐ hǎo.
  • Replace tone marks with 1-4 transforms, for example, nǐ hǎo into ni3 hao3.
  • Mend broken paragraphs removes excess newline characters that interrupt the flow of paragraphs. This is often useful for texts in which every line ends with a newline character, as is sometimes the case with texts downloaded from the Internet.
  • Break paragraphs into lines does the opposite of Mend broken paragraphs, adding extra newline characters so that the paragraphs fit on a typical email screen. This is useful for sending emails in plain text format.
  • Segment Hanzi inserts vertical bars ( | ) between Chinese characters to show the divisions between words.
  • Pinyin transcription transforms Chinese characters into pinyin. It works best if you use Segment Hanzi as an intermediate step.
  • Compatible characters transforms some Unicode “compatibility characters” (and hanzi from Radical blocks) into their ordinary equivalents.
  • Decode [U+] transforms codes like [U+n] (where n is a Unicode number) into the corresponding characters.
  • Encode [U+] transforms all non-ASCII characters into codes like [U+n], where n is a Unicode number.
  • Decode &# transforms codes like &#n; (where n is a Unicode number) into the corresponding characters. These codes are used in some HTML documents, for web pages.
  • Encode &# (hexadecimal) transforms all non-ASCII characters into codes like &#xn; where n is an ordinary hexadecimal Unicode number.
  • Encode &# (decimal) transforms all non-ASCII characters into codes like &#n; where n is a Unicode number converted to decimal. It’s odd to use decimal for Unicode, but some web browsers only support decimal.
  • Sort lines puts the lines into alphabetical (or Unicode) order. It simply sorts in order of the numerical Unicode values; it does not perform any sophisticated collation.
  • Shuffle lines puts the lines into random order. This may be useful for quizzing yourself on a list of vocabulary.
  • Remove tone change notation (dots/lines below vowels) transforms, for example, nị̌ hǎo into nǐ hǎo (removes the dot), and transforms yī̠xiē into yīxiē (removes the line). Tone change notation is explained in Chapter 11.

Examples Using the Edit Menu

Deleting Text

To delete a section of text:

• Select a section of text
The text is highlighted
• Choose Clear from the Edit menu

To delete the entire contents of a window:

• Choose Select All from the Edit menu
The entire document (not just the visible portion) is selected
• Choose Clear from the Edit menu

Using Cut, Copy, and Paste Within an Editable Window

To remove text from one location and insert it at a new location:

• Select the text
The text is highlighted
• Choose Cut from the Edit menu
The text is placed on the clipboard and then deleted in the window
• Place the insertion point where you want the text inserted
• Choose Paste from the Edit menu
The contents of the clipboard appear in the desired location

To copy text from one location and paste the copy in another location:

• Select the text
The text is highlighted
• Choose Copy from the Edit menu
A duplicate copy of the text is placed on the clipboard
The original text is left undisturbed
• Place the insertion point where you want the text inserted
• Choose Paste from the Edit menu
The contents of the clipboard appear in the desired location

Remember, when you use Cut or Copy, the clipboard stores the text only until the next time you use Cut or Copy.

Using Cut, Copy, and Paste between Windows

You can easily cut, copy, and paste between windows. For example, you can copy text from one window to another, or you can cut some text from one window and paste it into another window. For convenience, we’ll use the terms source and destination to distinguish between these windows. The source window has the text of interest. Text is inserted into the destination window.

In this example, the source window can be any window; but the destination window must have editing enabled.

To Copy text between windows, follow these steps:

• Make the source window active
The title bar is highlighted
• Select the text of interest
The text is highlighted
• Choose Copy from the Edit menu
A duplicate copy of the text is placed on the clipboard

The original text is left undisturbed.

• Make the destination window active
The title bar is highlighted
• Place the insertion point where you want the text inserted
• Choose Paste from the Edit menu
The contents of the clipboard appear in the desired location

In the next example, both the source and destination windows must have editing enabled.

To cut text from one window and insert it into another window, follow these steps:

• Make the source window active
The title bar is highlighted
• Select the text of interest
The text is highlighted
• Choose Cut from the Edit menu
The text is placed on the clipboard and then deleted in the window
• Make the destination window active
The title bar is highlighted
• Place the insertion point where you want the text inserted
• Choose Paste from the Edit menu
The contents of the clipboard appear in the desired location

Using Undo

The Undo command is not a cure for all ills, but it may help you occasionally. Undoing an inadvertent deletion or replacement is one of the best examples of using Undo. Whenever text is highlighted in an editable window or dialog text box, it can be easily deleted or replaced. As explained in Chapter 1, selected (highlighted) text is simply the “extended” insertion point, known as the selection. When you type any text, the selection is replaced by that text.

For example, suppose some text is highlighted and you accidentally press the space bar. Since the highlighted text is regarded as the selection, it is replaced by an invisible space! At this point, the Undo command will read Undo Typing. When you choose Undo, the typing is undone and the selection is restored, because the typed text (the space) replaced the selection. This is a good example, because the Undo command in the Edit menu reads Undo Typing; it is not obvious that it will restore the selection. Undo cancels the effect of the most recent editing action, not just the action itself.

When you undo a cut or a copy, Wenlin restores the clipboard to its previous contents.

Using “The Grabber”

In some situations Grab is more convenient than using Copy and Paste, because the Grabber can roam all over the screen. You can also use the Grabber to copy the title of any window. Here is an example. You see a Chinese word on the screen that you would like in your document. (Maybe you typed it a moment earlier.) You could type the word by phonetic conversion, or you could use the Copy and Paste commands. But Grab is much faster:

• Place the insertion point where you want the text inserted
(Typically the insertion point will already be where you want it)
• Choose Grab from the Edit menu (or click on the Mouse pointer grabber.jpg tool)
• Select the word
The word is copied to the current position of the insertion point

After using Grab, the mouse pointer returns to its previous shape. You can choose Grab repeatedly.

The Grab command is only available when the active window is editable, and it only works on single lines of text – you can’t grab multiple lines all at once. Grab can be canceled by pressing the Escape key, or by clicking on another tool.

Hidden Codes

(Note: This is an advanced topic, you can skip it unless you’re interested.) Although Wenlin is essentially a plain text editor, it recognizes and treats differently certain special sequences of symbols, called codes. These codes consist of ordinary text: we simply chose sequences of symbols that are extremely unlikely to appear together normally. Many of them are enclosed in <angle brackets>. Wenlin uses text formatting codes, which affect the appearance and/or the position of text, and command codes, which accompany triangle buttons and tell Wenlin what operation to carry out when the button is pressed.


You should turn on the Reveal Codes option when inserting codes, so you can see what you are doing. Turn Reveal Codes off to make the codes operational.

Centering Text

To center a line of text, insert the symbols <center> at the beginning of the line, and </center> at the end of the line. For example, to center the words “Chapter One” on a line, type the following:

<center>Chapter One</center>

When Reveal Codes is off, the line looks like this:

Chapter One

Text is centered between the left and right window boundaries. If you print the document, the text is centered on the page.

Hypertext Links

To insert a triangle button for opening a document, the syntax is the same as in HTML, which is the “hypertext mark-up language” used for World Wide Web pages. For example, suppose you want a button that, when clicked on, opens up a file called “MY_FILE.TXT”. Then use this notation (with Reveal codes in this window turned on in the Options menu):

<a href="MY_FILE.TXT">Click here for My File</a>

When Reveal Codes is off, it looks like this:

▷Click here for My File

You can also link a button to a particular location in a file, by enlarging the notation like this: ...href="MY_FILE#MY_PLACE"... (notice the # tic-tac-toe sign separating the file name from the location name). The file MY_FILE.TXT then needs to contain, in the desired location, this notation: <a name='MY_PLACE'> </a>. You can also link a button to another location in the same file that contains the button; simply omit the file name, thus: ......href="#MY_PLACE"...

Colored Text

Text can be in colors: 红 red, 绿 green, 蓝 blue, 等 etc. Text colors are specified using HTML-like font color tags. Use this notation (with Reveal Codes in This Window turned on in the Options menu):

To start a color, use an opening tag like <font color="red"> and to end the color, use the tag </font>. The opening tag has a color attribute, whose value is either the name of a pre-defined color (listed below), or a # plus a six-digit hexadecimal number where the first two digits are the amount of red, the middle two digits are the amount of green, and the last two digits are the amount of blue. (Hexadecimal or base-16 digits are 0 through 9 and A through F, so minimum is 00, medium is 80, and maximum is FF.) By mixing, you can obtain almost any color.

Wenlin recognizes these 16 pre-defined color names:

  • aqua (#00ffff)
  • black (#000000)
  • blue (#0000ff)
  • fuchsia (#ff00ff)
  • green (#008000)
  • lime (#00ff00)
  • maroon (#800000)
  • navy (#000080)
  • olive (#8080ff)
  • purple (#800080)
  • red (#ff0000)
  • silver (#c0c0c0)
  • teal (#008080)
  • white (#ffffff)
  • yellow (#ffff00)

Keep in mind that text will disappear if it's the same color as the background, which is determined by the Colors setting in the Options menu.

Don't try to colorize strings of text longer than about one line. Wenlin is still stupid in this regard, and may “forget” the color when the text has wrapped for more than one line. You could start over periodically, with new tags for each phrase or sentence, but this feature is really only intended for colorizing short strings of text.

JPEG Images

Color pictures in the JPEG format (with file extension .jpg) can be included in documents, using HTML-like img tags. Here's an example:

<img src="sample.jpg">

It's only as high as a single row of text. To make the picture three rows high and centered, use codes like this:

<center><img src="sample.jpg" row="1/3"></center>
<center><img src="sample.jpg" row="2/3"></center>
<center><img src="sample.jpg" row="3/3"></center>

To make pictures taller than one row of text, repeat the tags, using row attributes like 1/3, 2/3, 3/3 (meaning, first, second, and third of three rows). The row attribute isn't part of ordinary HTML, it's a Wenlin addition.

To include a picture in a text file, the .jpg file needs to be in the same folder as the text file. To add color pictures to dictionary entries, put the .jpg files in the Pictures folder, which is inside the Wenlin4 folder.

Other Hidden Codes

Wenlin uses various other codes for graphics, triangle button commands, etc., but those codes are not documented here, and may change in future editions of Wenlin. If you’re interested in creating documents with special properties, such as buttons, or sections of text that act like buttons, connected to sound files, etc., please contact Wenlin Institute.

Saving a Document

It is a good idea to save your work often, just in case of power failures or other unforeseen misfortunes (like hardware or software crashes). While you are editing a document, your changes are only stored in temporary memory, until you save them. (In this respect, Wenlin is like nearly all text editors and word processors.)

If you try to close an editable window, and you’ve made changes to the text, Wenlin gives you the option of saving your changes before it closes the window. Similarly, when you quit the program, if any windows have been edited, you’re given the option of saving your changes before quitting. So you needn’t be too concerned about forgetting to save after editing, the program will remind you when necessary.

If you have created a new document and haven’t saved it yet, the window title is “Editing Untitled”. Wenlin does not let you save a file with the name Untitled; you need to supply another name.

The “Save” and “Save As...” Commands

When you choose Save or Save As... from the File menu, Wenlin saves the contents of the active editable window, and then leaves the window open, with editing still enabled.

The difference between Save and Save As..., is that Save As... gives you a dialog box for specifying the file name, location, and format, while Save simply uses the current name, location, and format. (For a new, untitled document, Save is the same as Save As....)

The Save As... dialog box is different for Macintosh and MS-Windows. For any operating system, there are three things to specify for the file:

(1) a name;
(2) a location (disk and folder/directory); and
(3) a format (UTF-16, UTF-8, Big5, GB, etc.).

For Macintosh, the dialog looks like this.


For MS-Windows, the dialog looks like this.


You have the choice of saving the file as Unicode (recommended), or in any of the other formats described in Chapter 3. By opening a file and saving it in a different format, you can convert between formats. However, some characters are not allowed in some non-Unicode formats. You may need to use one of the Make Transformed Copy... commands before saving in one of these formats. Also, if you choose a non-Unicode format, be sure to use the appropriate extension for the file name (such as “.b5” or “.gb”, as given in Chapter 3), so that you won’t be asked “What format is this file?” when you open it again.

If an old version of the file (or another file with the same name) exists, you must confirm its replacement.

As described in Chapter 2, if the Backup Old Versions option is on, when you replace an existing file, Wenlin makes a backup copy of the old version.


Shēn ‘deep’ – written by 蘇東坡 Sū Dōngpō (1037-1101)

Mouse pointer finger right.jpg | Previous: 7. Stroking Characters | Next: 9. Editing the Dictionaries | Contents |