Text editor

"Notepad software" redirects here. For other uses, see Notepad (disambiguation).
Editors like Leafpad, shown here, are often included with operating systems as a default helper application for opening text files.

A text editor is a type of program used for editing plain text files.

Text editors are provided with operating systems and software development packages, and can be used to change configuration files, documentation files and programming language source code.[1]

Plain text files vs. word processor files

Main articles: Plain text and Document file format

There are important differences between plain text files created by a text editor and document files created by word processors such as Microsoft Word or WordPerfect.

Word processors were developed to allow formatting of text for presentation on a printed page, while text produced by text editors is generally used for other purposes, such as input data for a computer program.

When both formats are available, the user must select with care. Saving a plain text file in a word-processor format adds formatting information that can make the text unreadable by a program that expects plain text. Conversely, saving a word-processor document as plain text removes any formatting information.

History

A box of punched cards with several program decks.

Before text editors existed, computer text was punched into cards with keypunch machines. Physical boxes of these thin cardboard cards were then inserted into a card-reader. Magnetic tape and disk "card-image" files created from such card decks often had no line-separation characters at all, and assumed fixed-length 80-character records. An alternative to cards was punched paper tape. It could be created by some teleprinters (such as the Teletype), which used special characters to indicate ends of records.

The first text editors were "line editors" oriented to teleprinter- or typewriter-style terminals without displays. Commands (often a single keystroke) effected edits to a file at an imaginary insertion point called the "cursor". Edits were verified by typing a command to print a small section of the file, and periodically by printing the entire file. In some line editors, the cursor could be moved by commands that specified the line number in the file, text strings (context) for which to search, and eventually regular expressions. Line editors were major improvements over keypunching. Some line editors could be used by keypunch; editing commands could be taken from a deck of cards and applied to a specified file. Some common line editors supported a "verify" mode in which change commands displayed the altered lines.

When computer terminals with video screens became available, screen-based text editors (sometimes called just "screen editors") became common. One of the earliest full-screen editors was O26, which was written for the operator console of the CDC 6000 series computers in 1967. Another early full-screen editor was vi. Written in the 1970s, it is still a standard editor[2] on Unix and Linux operating systems. Emacs, one of the first open source and free software projects, is another early full-screen or real-time editor, one that was ported to many systems.[3] A full-screen editor's ease-of-use and speed (compared to the line-based editors) motivated many early purchases of video terminals.[4]

The core data structure in a text editor is the one that manages the string (sequence of characters) or list of records that represents the current state of the file being edited. While the former could be stored in a single long consecutive array of characters, the desire for text editors that could more quickly insert text, delete text, and undo/redo previous edits led to the development of more complicated sequence data structures.[5] A typical text editor uses a gap buffer, a linked list of lines (as in PaperClip), a piece table, or a rope, as its sequence data structure.

Types of text editors

Emacs, a text editor popular among programmers, running on Microsoft Windows

Some text editors are small and simple, while others offer broad and complex functions. For example, Unix and Unix-like operating systems have the pico editor (or a variant), but many also include the Emacs editor. Microsoft Windows systems come with the simple Notepad, though many peopleespecially programmersprefer other editors with more features. Under Apple Macintosh's classic Mac OS there was the native SimpleText, which was replaced in Mac OS X by TextEdit, which combines features of a text editor with those typical of a word processor such as rulers, margins and multiple font selection. These features are not available simultaneously, but must be switched by user command, or through the program automatically determining the file type.

Most word processors can read and write files in plain text format, allowing them to open files saved from text editors. Saving these files from a word processor, however, requires ensuring the file is written in plain text format, and that any text encoding or BOM settings won't obscure the file for its intended use. Non-WYSIWYG word processors, such as WordStar, are more easily pressed into service as text editors, and in fact were commonly used as such during the 1980s. The default file format of these word processors often resembles a markup language, with the basic format being plain text and visual formatting achieved using non-printing control characters or escape sequences. Later word processors like Microsoft Word store their files in a binary format and are almost never used to edit plain text files.[6]

Some text editors can edit unusually large files such as log files or an entire database placed in a single file. Simpler text editors may just read files into the computer's main memory. With larger files, this may be a slow process, and the entire file may not fit. Some text editors do not let the user start editing until this read-in is complete. Editing performance also often suffers in nonspecialized editors, with the editor taking seconds or even minutes to respond to keystrokes or navigation commands. By only storing the visible portion of large files in memory, editing performance improves.

Some editors are programmable, meaning they can be customized for specific uses. One motive for customizing is to make a text editor use the commands of another text editor with which the user is more familiar, or to duplicate missing functionality the user has come to depend on. Software developers often use editor customizations tailored to the programming language or development environment they are working in. The programmability of some text editors is limited to enhancing the core editing functionality of the program, but Emacs can be extended far beyond editing text filesfor web browsing, reading email, online chat, managing files or playing games. Emacs can even emulate Vi, its rival in the traditional editor wars of Unix culture.[7][8]

An important group of programmable editors uses REXX[9] as a scripting language. These "orthodox editors" contain a "command line" into which commands[10] and (REXX) macros can be typed. Most such editors are derivatives of ISPF/PDF EDIT or of XEDIT, IBM's flagship editor for VM/CMS. Among them are THE, KEDIT, X2, Uni-edit, and SEDIT.

A text editor written or customized for a specific use can determine what the user is editing and assist the user, often by completing programming terms and showing tooltips with relevant documentation. Many text editors for software developers include source code syntax highlighting and automatic indentation to make programs easier to read and write. Programming editors often let the user select the name of an include file, function or variable, then jump to its definition. Some also allow for easy navigation back to the original section of code by storing the initial cursor location or by displaying the requested definition in a popup window or temporary buffer. Some editors implement this ability themselves, but often an auxiliary utility like ctags is used to locate the definitions.

Typical features

Specialised editors

Some editors include special features and extra functions, for instance,

Programmable editors can usually be enhanced to perform any or all of these functions, but simpler editors focus on just one, or, like gPHPedit, are targeted at a single programming language.

See also

Notes

  1. "The Best Free Text Editors for Windows, Linux, and Mac". Every operating system comes with a default, basic text editor, but most of us install our own enhanced text editors to get more features.
  2. "The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition". The IEEE and The Open Group. 2004. Retrieved January 18, 2010.
  3. "Introducing the Emacs editing environment".
  4. "Multics Emacs: The History, Design and Implementation". Some Multics users purchased these terminals ..., using them either as "glass teletypes" or via "local editing."
  5. Charles Crowley. "Data Structures for Text Sequences". Section "Introduction".
  6. "Text Editors for Programmeres - Programming Tools". If you open a .doc file in a text editor, you will notice that most of the file is formatting codes. Text editors, however, do not add formatting codes, which makes it easier to compile your code.
  7. "From Vim to Emacs+Evil chaotic migration guide".
  8. "Gitorious". Retrieved 27 May 2015.
  9. Originally macros were written in assembler, CLIST (TSO), EXEC (VM), EXEC2 (VM) or PL/I, but most users dropped CLIST, EXEC and EXEC2 once REXX was available.
  10. A line command is a command typed into an entry area associated with a specific line of text and whose scope is limited to that line, or, in the case of a block command, associated with the block of lines between the beginning and ending line commands. An example of the latter would be typing the command ucc into the entry areas of two lines; this has the same effect as typing uc into the entry area of each line in the range.
  11. "LAPIS: Smart Editing with Text Structure". Retrieved 27 May 2015.
  12. "Lightweight Structured Text Processing". Retrieved 27 May 2015.
  13. New gedit plugin: multi edit, and a demo video.

External links

This article is issued from Wikipedia - version of the Monday, April 11, 2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.