Text editor

Source: Wikipedia, the free encyclopedia.
helper application
for opening text files.

A text editor is a type of computer program that edits plain text. Such programs are sometimes known as "notepad" software (e.g. Windows Notepad).[1][2][3] Text editors are provided with operating systems and software development packages, and can be used to change files such as configuration files, documentation files and programming language source code.[4]

Plain text and rich text

There are important differences between plain text (created and edited by text editors) and

desktop publishing software
).

Plain text exclusively consists of character representation. Each character is represented by a fixed-length sequence of one, two, or four bytes, or as a variable-length sequence of one to four bytes, in accordance to specific

monospace font
, such that horizontal alignment and columnar formatting were sometimes done using whitespace characters.

Rich text, on the other hand, may contain metadata, character formatting data (e.g.

binary format (e.g. DOC), text files adhering to a markup language (e.g. RTF or HTML), or in a hybrid form of both (e.g. Office Open XML
).

Text editors are intended to open and save text files containing either plain text or anything that can be interpreted as plain text, including the markup for rich text or the markup for something else (e.g.

SVG
).

History

punched cards
with several program decks.

Before text editors existed, computer text was punched into

drum and disk card image files created from such card decks often had no line-separation characters at all, and assumed fixed-length[a] 80- or 90-character[6] records.[7] An alternative to cards was Punched tape. It could be created by some teleprinters (such as the Teletype), which used special characters to indicate ends of records.[8] Some early operating systems included batch text editors, either integrated with language processors or as separate utility programs; one early example was the ability to edit SQUOZE source files for SCAT[9] in SHARE Operating System
.

The first interactive 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

ported to many systems.[12] The 1977 Commodore PET was the first mass-market computer to feature a full-screen editor. A full-screen editor's ease-of-use and speed (compared to the line-based editors) motivated many early purchases of video terminals.[13]

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.[14] 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
gedit is a text editor shipped with GNOME

Some text editors are small and simple, while others offer broad and complex functions. For example,

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

binary format and are almost never used to edit plain text files.[15]

Some text editors can

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. Specialized editors have optimizations such as only storing the visible portion of large files in memory, improving editing performance.

Some editors are programmable, meaning, e.g., they can be customized for specific uses. With a programmable editor it is easy to automate repetitive tasks or, add new functionality or even implement a new application within the framework of the editor. One common 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

An important group of programmable editors uses

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

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

Advanced features

  • Macro or procedure definition: to define new commands or features as combinations of prior commands or other macros, perhaps with passed parameters, or with nesting of macros.
  • Profiles to retain options set by the user between editing session.
  • Profile macros with names specified in, e.g., environment, profile, executed automatically at the beginning of an edit session or when opening a new file.
  • Multi-file editing: the ability to edit multiple files during an edit-session, perhaps remembering the current-line cursor of each file, to insert repeated text into each file, copy or move text among files, compare files side-by-side (perhaps with a tiled multiple-document interface), etc.
  • Multi-view editors: the ability to display multiple views of the same file, with independent cursor tracking, synchronizing changes among the windows but providing the same facilities as are available for independent files.
  • Collapse/expand, also called folding: the ability to temporarily exclude sections of the text from view. This may either be based on a range of line numbers or on some syntactic element, e.g., excluding everything between a BEGIN; and the matching END;.
  • Column-based editing; the ability to alter or insert data at a particular column, or to shift data to specific columns.
  • shell
    . Also, a case-shifting feature could translate to lowercase or uppercase.
  • Filtering – Some advanced text editors allow the editor to send all or sections of the file being edited to another utility and read the result back into the file in place of the lines being "filtered". This, for example, is useful for sorting a series of lines alphabetically or numerically, doing mathematical computations, indenting source code, and so on.
  • config files and other text that appears in an organized or predictable format. Editors generally allow users to customize the colors or styles used for each language element. Some text editors also allow users to install and use themes to change the look and feel of the editor's entire user interface
    .
  • Syntax-oriented editors - some editors have support for the syntax of one or more languages, and allow operations in terms of syntactical unit, e.g., insert a new WHEN clause in a SELECT statement.
  • coding styles
    .
  • Block-oriented terminals
    typically have dedicated cursor movement keys, as do keyboards on personal computers.
  • Command line - some editors, e.g., ISPF, XEDIT, have a dedicated field on the screen for entering commands as opposed to text. Depending on the editor, the user may have to use cursor keys to switch between the command and text fields or the editor may interpret, e.g., specific function keys , as requests to switch.
  • Line commands, also known as prefix commands or sequence commands - Some editors treat a file as an array of text lines with associated line numbers or sequence numbers, and have a distinct line number field for each text field. A line command is a string that the user types into a line number field and that the editor recognizes as a command operating on that specific line or block of lines, e.g., LC to translate a line to lower case, ))3 to shift a block right three columns. Some editors also support line macros, also known as prefix macros or sequence macros. Despite the name prefix command, some editors allow the sequence field to appear after the text field.
  • Text editors, especially source-code editors, often default to using a monospace font that clearly distinguishes between similar characters (homoglyphs) such as the colon and the semicolon.[19]

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. ^ By the late 1960s editors were available that supported variable-length records.
  2. EXEC2 (VM/SE) or PL/I
    , but most users dropped CLIST, EXEC and EXEC2 once REXX was available.
  3. ^ A line command is a command typed into the sequence number 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 (block upper case) into the entry areas of two lines; this has the same effect as typing uc (upper case) into the entry area of each line in the range.

References

  1. .
  2. .
  3. .
  4. ^ "The Best Free Text Editors for Windows, Linux, and Mac". 28 April 2012. Every operating system comes with a default, basic text editor, but most of us install our own enhanced text editors to get more features.
  5. .
  6. Sperry Rand
    Corporation. 1957. p. 246. Retrieved December 16, 2022.,
  7. .
  8. .
  9. ^ "Modify and Load" (PDF). SOS Reference Manual (PDF). IBM. November 1959 [Distribution No.1 published in 1959]. p. 05.01.01. Retrieved December 15, 2022.
  10. ^ "The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition". The IEEE and The Open Group. 2004. Retrieved January 18, 2010.
  11. .
  12. ^ "Introducing the Emacs editing environment". IBM. Archived from the original on 2014-06-06. Retrieved 2014-06-06.
  13. ^ "Multics Emacs: The History, Design and Implementation". Some Multics users purchased these terminals ..., using them either as "glass teletypes" or via "local editing."
  14. ^ Charles Crowley. "Data Structures for Text Sequences". Section "Introduction".
  15. ^ "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.
  16. ^ "Vim to Emacs' Evil chaotic migration guide". juanjoalvarez.net. 19 September 2014.
  17. ^ "Gitorious". Archived from the original on 28 May 2015. Retrieved 27 May 2015.
  18. ^ "Searching". Notepad++ User Manual. Retrieved 21 December 2021.
  19. ^ Philipp Acsany. "Choosing the Best Coding Font for Programming". 2023.

External links