Jump to content

Text editor

From Wikipedia, the free encyclopedia
Editors likeLeafpad,shown here, are often included with operating systems as a defaulthelper applicationfor opening text files.

Atext editoris a type ofcomputer programthat editsplain text.An example of such program is "notepad"software (e.g.Windows Notepad).[1][2][3]Text editors are provided withoperating systemsand software development packages, and can be used to change files such asconfiguration files,documentation files andprogramming languagesource code.[4]

Plain text and rich text

[edit]

There are important differences between plain text (created and edited by text editors) andrich text(such as that created byword processorsordesktop 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 specificcharacter encodingconventions, such asASCII,ISO/IEC 2022,Shift JIS,UTF-8,orUTF-16.These conventions define many printable characters, but alsonon-printing charactersthat control the flow of the text, such asspace,line break,andpage break.Plain text contains no other information about the text itself, not even the character encoding convention employed. Plain text is stored intext files,although text files do not exclusively store plain text. Since the early days of computers, plain text was (once by necessity and now by convention) generally displayed using amonospace 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.typeface, size, weight and style), paragraph formatting data (e.g. indentation, alignment, letter and word distribution, and space between lines or other paragraphs), and page specification data (e.g. size, margin and reading direction). Rich text can be very complex. Rich text can be saved inbinary format(e.g.DOC), text files adhering to amarkup language(e.g.RTForHTML), 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

[edit]
A box ofpunched cardswith several program decks.

Before text editors existed, computer text was punched intocardswithkeypunchmachines.[5]Physical boxes of these thin cardboard cards were then inserted into acard reader.Magnetic tape,drumanddiskcard imagefiles 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 wasPunched tape.It could be created by someteleprinters(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 editSQUOZEsource files for SCAT[9]in theSHARE Operating System.

The first interactive text editors were"line editors"oriented to teleprinter- ortypewriter-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, textstrings(context) for which to search, and eventuallyregular 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.

Whencomputer terminalswith video screens became available, screen-based text editors (sometimes called just "screen editors" )became common. One of the earliest full-screen editors wasO26,which was written for the operator console of theCDC 6000 seriescomputers in 1967. Another early full-screen editor wasvi.Written in the 1970s, it is still a standard editor[10]onUnixandLinuxoperating systems. Also written in the 1970s was theUCSD PascalScreen Oriented Editor, which was optimized both for indented source code and general text.[11]Emacs,one of the firstfree and open-source softwareprojects, is another early full-screen or real-time editor, one that wasportedto many systems.[12]The 1977Commodore PETwas 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 ofrecordsthat represents the current state of the file being edited. While the former could be stored in a single long consecutivearrayof 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 agap buffer,alinked listof lines (as inPaperClip), apiece table,or arope,as its sequence data structure.

Types of text editors

[edit]
Emacs, a text editor popular among programmers, running onMicrosoft Windows
geditis a text editor shipped withGNOME

Some text editors are small and simple, while others offer broad and complex functions. For example,Unixand Unix-like operating systems have thepicoeditor (or a variant), but many also include theviand Emacs editors.Microsoft Windowssystems come with the simpleNotepad,though many people—especially programmers—prefer othereditorswith more features. UnderApple Macintosh'sclassic Mac OSthere was the nativeTeachTextlater replaced bySimpleTextin 1994, which was replaced inMac OS XbyTextEdit,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 thefile 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 inplain textformat, and that anytext encodingorBOMsettings will not obscure the file for its intended use. Non-WYSIWYGword processors, such asWordStar,are more easily pressed into service as text editors, and in fact were commonly used as such during the 1980s. The defaultfile formatof these word processors often resembles a markup language, with the basic format being plain text and visual formatting achieved using non-printingcontrol charactersorescape sequences.Later word processors likeMicrosoft Wordstore their files in abinary formatand are almost never used to edit plain text files.[15]

Some text editors canedit unusually large filessuch aslog filesor an entiredatabaseplaced in a single file. Simpler text editors may just read files into the computer's mainmemory.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, butEmacscan be extended far beyond editing text files—for web browsing, reading email, online chat, managing files or playing games and is often thought of as a Lisp execution environment with aText User Interface.Emacs can even be programmed to emulateVi,its rival in the traditionaleditor warsofUnix culture.[16][17]

An important group of programmable editors usesREXX[b]as a scripting language. These "orthodox editors" contain a "command line" into which commands and macros can be typed and text lines into which line commands[c]and macros can be typed. Most such editors are derivatives ofISPF/PDFEDITor ofXEDIT,IBM's flagship editor forVM/SPthroughz/VM.Among them areTHE,KEDIT,X2, Uni-edit, andSEDIT.

A text editor written or customized for a specific use can determine what the user is editing and assist the user, often bycompletingprogramming terms and showingtooltipswith relevant documentation. Many text editors for software developers include source codesyntax highlightingand automaticindentationto make programs easier to read and write. Programming editors often let the user select the name of aninclude file,functionorvariable,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 apopup windowor temporary buffer. Some editors implement this ability themselves, but often an auxiliary utility likectagsis used to locate the definitions.

Typical features

[edit]
  • Find and replace – Text editors provide extensive facilities for searching and replacing strings of text, either individually, or groups of files in opened tabs or a selected folder. Advanced editors can useregular expressionsto search and edit text or code. Additional features may include optionalcase sensitivity,a history of search terms for quick recall andautocompletion,and listing multiple results in one place.[18][better source needed]
  • Cut, copy, and paste– most text editors provide methods to duplicate and move text within the file, or between files.
  • Ability to handleUTF-8encoded text.
  • Text formatting– Text editors often provide basic visual formatting features likeline wrap,auto-indentation,bullet listformatting usingASCIIcharacters,comment formatting,syntax highlightingand so on. These are typically only for display and do not insert formatting codes into the file itself.
  • Undo and redo– As with word processors, text editors provide a way to undo and redo the last edit, or more. Often—especially with older text editors—there is only one level of edit history remembered and successively issuing the undo command will only "toggle" the last change. Modern or more complex editors usually provide a multiple-level history such that issuing the undo command repeatedly will revert the document to successively older edits. A separate redo command will cycle the edits "forward" toward the most recent changes. The number of changes remembered depends upon the editor and is often configurable by the user.
  • Ability to jump to a specified line number.[citation needed]

Advanced features

[edit]
  • 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 filesside-by-side (perhaps with a tiledmultiple-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 calledfolding: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 aBEGIN;and the matchingEND;.
  • Column-based editing; the ability to alter or insert data at a particular column, or to shift data to specific columns.
  • Data transformation– Reading or merging the contents of another text file into the file currently being edited. Some text editors provide a way to insert the output of a command issued to the operating system'sshell.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 Alpha betically or numerically, doing mathematical computations, indentingsource code,and so on.
  • Syntax highlighting– contextually highlightssource code,markup languages,config filesand 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 usethemesto change thelook and feelof the editor's entireuser 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 newWHENclause in aSELECTstatement.
  • Extensibility- a text editor intended for use by programmers must provide somepluginmechanism, or bescriptable,so a programmer can customize the editor with features needed to manage individual software projects, customize functionality orkey bindingsfor specificprogramming languagesorversion controlsystems, or conform to specificcoding styles.
  • Cursornavigation may vary across text editors. For example, pressingEndtwice may navigate to the end of awrapped lineafter one press navigated to the end of an on-screen row of text.Block-oriented terminalstypically 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.,LCto translate a line to lower case,))3to shift a block right three columns. Some editors also support line macros, also known as prefix macros or sequence macros. Despite the nameprefix command,some editors allow the sequence field to appear after the text field.
  • Text editors, especiallysource-code editors,often default to using a monospace font that clearly distinguishes between similar characters (homoglyphs) such as the colon and the semicolon.[19]

Specialized editors

[edit]

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

  • Source code editorsare text editors with additional functionality to facilitate the production of source code. These often feature user-programmable syntax highlighting and code navigation functions as well as coding tools or keyboardmacrossimilar to an HTML editor.
  • Folding editors.This subclass includes so-called "orthodox editors" that are derivatives of Xedit. Editors that implement folding without programing-specific features are usually called outliners (see below).
  • Outliners.Also called tree-based editors, because they combine a hierarchical outlinetree viewwith a text editor. Folding (see above) can be considered a specialized form of outlining.
  • IDEs(integrated development environments) are designed to manage and streamline large programming projects. They are usually only used for programming as they contain many features unnecessary for simple text editing.
  • World Wide Webauthors are offered a variety ofHTML editorsdedicated to the task of creatingweb pages.These include:Dreamweaver,KompoZerandE Text Editor.Many offer the option of viewing a work in progress on a built-inHTML rendering engineor standardweb browser.However, mostweb developmentis done in adynamic programming languagesuch asRubyorPHPusing a source code editor or IDE. The HTML delivered by all but the simplest static web sites is stored as individualtemplate filesthat are assembled by the software controlling the site and do not compose a complete HTML document.
  • Mathematicians, physicists, and computer scientists often produce articles and books usingTeXorLaTeXin plain text files. Such documents are often produced by a standard text editor, but some people use specializedTeX editors.
  • Collaborative editorsallow multiple users to work on the same document simultaneously from remote locations over a network. The changes made by individual users are tracked and merged into the document automatically to eliminate the possibility of conflicting edits. These editors also typically include anonline chatcomponent for discussion among editors.
  • Distraction-free editorsprovide aminimalisticinterface with the purpose of isolating the writer from the rest of the applications and operating system, thus being able to focus on the writing without distractions from interface elements like atoolbarornotification area.

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

See also

[edit]

Notes

[edit]
  1. ^By the late 1960s editors were available that supported variable-length records.
  2. ^Originally macros were written in assembler,CLIST(TSO),CMS EXEC(VM),EXEC2(VM/SE) orPL/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 commanducc(block upper case) into the entry areas of two lines; this has the same effect as typinguc(upper case) into the entry area of each line in the range.

References

[edit]
  1. ^H. Albert Napier; Ollie N. Rivers; Stuart Wagner (2005).Creating a Winning E-Business.Cengage Learning. p. 330.ISBN1111796092.
  2. ^Peter Norton; Scott H. Clark (2002).Peter Norton's New Inside the PC.Sams Publishing. p. 54.ISBN0672322897.
  3. ^L. Gopalakrishnan; G. Padmanabhan; Sudhat Shukla (2003).Your Home PC: Making the Most of Your Personal Computer.Tata McGraw-Hill Education.p. 190.ISBN0070473544.
  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. ^Louden, Kenneth C.; Lambert, Kenneth A. (2011-01-26).Programming Languages: Principles and Practices.Cengage Learning. p. 5.ISBN978-1-133-38749-7.
  6. ^"UNIVAC 90-COLUMN PUNCHED 'CARD-TO-MAGNETIC TAPE CONVERTER"(PDF).UNIVAC II Data Automation System(PDF).Remington-RandUnivac Division ofSperry RandCorporation. 1957. p. 246.RetrievedDecember 16,2022.,
  7. ^Alavudeen, A.; Venkateshwaran, N. (2008-08-18).Computer Integrated Manufacturing.PHI Learning Pvt. Ltd. p. 180.ISBN978-81-203-3345-1.
  8. ^Upton, Eben; Duntemann, Jeffrey; Roberts, Ralph; Mamtora, Tim; Everard, Ben (2016-08-22).Learning Computer Architecture with Raspberry Pi.John Wiley & Sons. pp. 232–234.ISBN978-1-119-18394-5.
  9. ^"Modify and Load"(PDF).SOS Reference Manual(PDF).IBM.November 1959 [Distribution No.1 published in 1959]. p. 05.01.01.RetrievedDecember 15,2022.
  10. ^"The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition".The IEEE and The Open Group. 2004.RetrievedJanuary 18,2010.
  11. ^L. Bowles, Kenneth; Hollan, James (1978-07-01)."An introduction to the UCSD PASCAL system".Behavior Research Methods.10(4): 531–534.doi:10.3758/BF03205341.
  12. ^"Introducing the Emacs editing environment".IBM.Archived fromthe originalon 2014-06-06.Retrieved2014-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 fromthe originalon 28 May 2015.Retrieved27 May2015.
  18. ^"Searching".Notepad++ User Manual.Retrieved21 December2021.
  19. ^ Philipp Acsany. "Choosing the Best Coding Font for Programming". 2023.
[edit]