TextEditor(3I)
π TextEditor β basic unstructured text editing
okay bestie, gather round, because this is the manual page for TextEditor, and it lives in the InterViews Reference Manual, section 3I. It's giving "basic unstructured text editing" and honestly? We're obsessed. β¨
β¨ SYNOPSIS β¨
#include <InterViews/texteditor.h>
π¦ DESCRIPTION π¦
So like, a TextEditor is an interactor β meaning it's a thing that handles input β and what it does is give you an interactive interface for simple text editing of a TextBuffer. That's the whole vibe. π
The editing model is built around one single current selection. That's it. Everything orbits around it. Editing operations either:
- operate on the text inside the selection,
- change the position or size of the selection, or
- scroll the display so you can see other parts of the text.
Also, TextEditor interprets a perspective for interactive scrolling using a scroller. iykyk. π
π¨ no cap, this is important:TextEditordoes not come with a default set of keyboard bindings. None. Zero. You get to implement whatever key bindings you want, either by subclassing and redefining theHandleoperation, or by handling keyboard events in an entirely separate class. Main character energy, you decide. π
πΈ PUBLIC OPERATIONS πΈ
TextEditor(int rows, int cols, int tabsize, int highlight)~TextEditor()
Create or destroy an instance of TextEditor. β¨ The natural size of a TextEditor is specified by rows and cols. The TextEditor will be tall enough to display rows lines of text in the current font, and it will be wide enough to display cols characters. For proportionally-spaced fonts, the width of the character 'n' is taken to be representative (she's the blueprint, fr fr). Tab characters in the text are expanded to multiples of tabsize character widths. The current selection is highlighted with the text style highlight.
void Edit(TextBuffer*, int index = 0)
Specify the text buffer to edit. π«Ά A text buffer must be specified before the TextEditor is displayed β like, non-negotiable. The optional index parameter specifies the initial selection point. If necessary, the TextEditor is scrolled so that the selection point is visible.
int Dot()int Mark()
The current selection is bounded by two indices into the text buffer. By convention these indices are called dot and mark. Dot is the position at which text will be inserted and deleted. Mark locates the end of the selection that moves as the selection is modified. When the selection is empty (an insertion point), dot and mark are equal. Bestie behavior, truly. π
void InsertText(const char* string, int count)void DeleteText(int count)void DeleteSelection()
Edit the text buffer at the current selection.
InsertTextinsertscountcharacters fromstringafterdot. The selection becomes an insertion point following the newly inserted text.DeleteTextdeletescountcharacters atdot. Ifcountis positive, the characters followingdotare deleted; ifcountis negative, the characters beforedotare deleted. The selection becomes an insertion point in the place of the deleted text.DeleteSelectiondeletes the text betweendotandmark, changing the selection to an insertion point.
void BackwardCharacter(int count)void ForwardCharacter(int count)void BackwardLine(int count)void ForwardLine(int count)void BackwardWord(int count)void ForwardWord(int count)void BackwardPage(int count)void ForwardPage(int count)
Move the current selection forward or backward by the specified number of the specified units. The default movement is one unit. π¦ The selection is not moved before the beginning or after the end of the text β she stays in bounds, periodt.
void BeginningOfLine()void EndOfLine()void BeginningOfWord()void EndOfWord()void BeginningOfSelection()void EndOfSelection()void BeginningOfText()void EndOfText()
Move the current selection forwards or backwards to the specified feature of the text. Teleportation but make it text. β
void ScrollToSelection(boolean always = false)void SetScrollAlignment(Alignment)Alignment GetScrollAlignment()
ScrollToSelction scrolls the display so that dot will be visible. If dot is currently visible and always is false, no scrolling takes place; if dot is not visible or always is true, the display is scrolled so that dot will be positioned as close as possible to the position specified by SetScrollAlignment. GetScrollAlignment returns the current scroll alignment. The default alignment is Center. π―
void ScrollToView(Coord x, Coord y)void ScrollBy(Coord dx, Coord dy)
ScrollToView scrolls the display so that the text currently at the position (x, y) will be visible. If the specified point is currently visible, no scrolling takes place. ScrollBy specifies an amount by which to scroll the display. Positive values scroll the display upwards and to the right. In each case, the final position of the display is limited so that some text will be visible. (Gotta keep at least a lil text on screen, it's called β¨boundariesβ¨.)
void GrabScroll(Event&)void RateScroll(Event&)
Initiate grab scrolling or rate scrolling. Once called, GrabScroll (RateScroll) polls the current mouse position as long as the middle (right) button is pressed.
- As
GrabScrollpolls, it scrolls the text to follow the mouse position, making it appear as though the user is dragging the text itself. π«³ - Each time
RateScrollpolls the mouse, it scrolls the text by an amount corresponding to the differential between the current and initial mouse positions. This creates the illusion of a joystick interface: the further away the mouse is from its initial position, the greater the scrolling increment and the faster the text appears to scroll; scrolling slows down, stops, and reverses direction as the user drags the mouse back towards and past the initial position. ππ₯ iconic, honestly.
void Select(int dot)void Select(int dot, int mark)void SelectMore(int mark)void SelectAll()
Modify the current selection in terms of text indices.
- With a single parameter,
Selectmoves bothdotandmarkto the specified index. - With two parameters,
dotandmarkcan be controlled independently. SelectMoreleavesdotunchanged and movesmark.SelectAllsetsdotto the end of the text andmarkto the beginning. π
int Locate(Coord x, Coord y)
Return the text index most closely matching the point (x, y). π
π SEE ALSO π
Interactor(2I)TextBuffer(3I)
That's the whole page, bestie β brought to you by InterViews, dated 24 May 1989. β¨ Go forth and edit some unstructured text, you absolute legend. πππ¦
π¦ where this page comes from
- debian bookworm: ivtools-dev 2.0.11d.a1-1+b4
- debian trixie: ivtools-dev 2.0.11d.a1-3+b4
- ubuntu jammy: ivtools-dev 2.0.11d.a1-1build1
- ubuntu noble: ivtools-dev 2.0.11d.a1-3build1
- ubuntu questing: ivtools-dev 2.0.11d.a1-3build7
- ubuntu resolute: ivtools-dev 2.0.11d.a1-3build9
- ubuntu stonking: ivtools-dev 2.1.1+git.2025.07.26.a1-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms