The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

Text::Editor::Perl - Perl source code head-less editor written in Perl.

Synopsis

Perl source code head-less editor written in Perl.

Description

Perl source code head-less editor written in Perl.

The following sections describe the methods in each functional area of this module. For an alphabetic listing of all methods by name see Index.

Editor

A new editor

newEditor(@)

Construct a new editor

     Parameter    Description
  1  @attributes  Attributes for a new editor

Example:

  my $e = newEditor;

This is a static method and so should be invoked as:

  Text::Editor::Perl::newEditor

Editor Attributes

Attributes for an editor

editorFile :lvalue

Name of the file from whence the text came

editorLog :lvalue

[Instruction to roll changes back or reapply them ...]

editorLines :lvalue

[lines of text to be editted ...]

editorViews :lvalue

[Views of the text ...]

Editor Methods

Methods for a Attributes of a view

newLastLine($@)

Create a new line

     Parameter    Description
  1  $editor      Editor
  2  @attributes  Attributes

Example:

  my $l = $e->newLastLine();

newEditorView($@)

Create a new view

     Parameter    Description
  1  $editor      Editor
  2  @attributes  Attributes

Example:

  my $v = $e->newEditorView(viewCursorLine=>$l, viewCursorChar=>0);

printEditor($)

Print an editor

     Parameter  Description
  1  $editor    Editor

Example:

  is_deeply $e->printEditor, {lines => ["Hello World"]};

View

A view of the text being editted

View Attributes

Attributes of a view

viewEditor :lvalue

The editor that owns this view

viewCursorLine :lvalue

Line the cursor is in

viewCursorChar :lvalue

The char position of the cursor with 0 being just before the first character

viewCursorVertical :lvalue

The number of lines the cursor spans

viewStartLine :lvalue

The line number (numbered from zero) at which this view starts to display

viewStartChar :lvalue

The character position at which this view starts to display

viewLines :lvalue

The height of the view in rows

viewChars :lvalue

The width of the view in chars

viewSelections :lvalue

[Selection specifications ...]

viewBoxes :lvalue

[Box specifications ...] - a rectangular selection

View Methods

Methods for a Attributes of a view

newView(@)

Create a new view

     Parameter    Description
  1  @attributes  Attributes

This is a static method and so should be invoked as:

  Text::Editor::Perl::newView

viewAddChars($$)

Add the specified chars through the specifed view

     Parameter   Description
  1  $view       View
  2  $textToAdd  Text to add

Example:

  $v->viewAddChars(q(Hello World));

printView($)

Print a view

     Parameter  Description
  1  $view      View

Selection

A selection delimits a contiguous block of text

newSelection(@)

Construct a new view of the data being editted

     Parameter    Description
  1  @attributes  Attributes for a new selection

This is a static method and so should be invoked as:

  Text::Editor::Perl::newSelection

Selection Attributes

Attributes for a selection

selectionView :lvalue

The view that owns this selection

selectionStartLine :lvalue

The line number (numbered from zero) at which this selection starts

selectionStartChar :lvalue

The character position at which this selection starts

selectionEndLine :lvalue

The line number (numbered from zero) at which this selection ends

selectionEndChar :lvalue

The character position at which this selection ends

Box

A box is a rectangular block of text

newBox(@)

Construct a new box

     Parameter    Description
  1  @attributes  Attributes for a new box

This is a static method and so should be invoked as:

  Text::Editor::Perl::newBox

Box Attributes

Attributes for a box

boxView :lvalue

The view that owns this box

boxStartLine :lvalue

The line number (numbered from zero) at which this box starts

boxStartChar :lvalue

The character position at which this box end

boxWidth :lvalue

The width of the box in characters - can be positive, zero or negative

boxHeight :lvalue

The height if the boc in lines - can be positive, zero or negative

Line

A line holds a line of text being editted

newLine(@)

Construct a new line

     Parameter    Description
  1  @attributes  Attributes for a new line

This is a static method and so should be invoked as:

  Text::Editor::Perl::newLine

Line Attributes

Attributes for a line

lineEditor :lvalue

The editor that contains this line

lineText :lvalue

A string holding the text being editted

lineCharAttrs :lvalue

A vec string which bolds 8 bits for each character in the string describing its display attributes

lineLabel :lvalue

A string naming this line

lineCommand :lvalue

A string naming a command that starts or ends on this line

lineVisible :lvalue

The line id visible if true

Snippet

A snippet is a replacement string

newSnippet(@)

Construct a new snippet

     Parameter    Description
  1  @attributes  Attributes for a new snippet

This is a static method and so should be invoked as:

  Text::Editor::Perl::newSnippet

Snippet Attributes

Attributes for a snippet

snippetSource :lvalue

The source to be expanded

snippetReplacement :lvalue

Replacement string

snippetCursor :lvalue

cursor offset in replacement string

Index

1 boxHeight

2 boxStartChar

3 boxStartLine

4 boxView

5 boxWidth

6 editorFile

7 editorLines

8 editorLog

9 editorViews

10 lineCharAttrs

11 lineCommand

12 lineEditor

13 lineLabel

14 lineText

15 lineVisible

16 newBox

17 newEditor

18 newEditorView

19 newLastLine

20 newLine

21 newSelection

22 newSnippet

23 newView

24 printEditor

25 printView

26 selectionEndChar

27 selectionEndLine

28 selectionStartChar

29 selectionStartLine

30 selectionView

31 snippetCursor

32 snippetReplacement

33 snippetSource

34 viewAddChars

35 viewBoxes

36 viewChars

37 viewCursorChar

38 viewCursorLine

39 viewCursorVertical

40 viewEditor

41 viewLines

42 viewSelections

43 viewStartChar

44 viewStartLine

Installation

This module is written in 100% Pure Perl and, thus, it is easy to read, comprehend, use, modify and install via cpan:

  sudo cpan install Text::Editor::Perl

Author

philiprbrenan@gmail.com

http://www.appaapps.com

Copyright

Copyright (c) 2016-2018 Philip R Brenan.

This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.