pub struct LineBuffer { /* private fields */ }
Expand description

In memory representation of the entered line(s) including a cursor position to facilitate cursor based editing.

Implementations

Create a line buffer instance

Check to see if the line buffer is empty

Check if the line buffer is valid utf-8 and the cursor sits on a valid grapheme boundary

Gets the current edit position

Sets the current edit position

Unicode safety:

Not checked, inproper use may cause panics in following operations

Output the current line in the multiline buffer

Set to a single line of buffer and reset the InsertionPoint cursor to the end

Calculates the current the user is on

Zero-based index

Counts the number of lines in the buffer

Checks to see if the buffer ends with a given character

Reset the insertion point to the start of the buffer

Move the cursor before the first character of the line

Move cursor position to the end of the line

Insertion will append to the line. Cursor on top of the potential \n or \r of \r\n

Set the insertion point behind the last character.

Get the length of the buffer

Returns where the current line terminates

Either:

  • end of buffer (len())
  • \n or \r\n (on the first byte)

Cursor position behind the next unicode grapheme to the right

Cursor position in front of the next unicode grapheme to the left

Cursor position behind the next word to the right

Cursor position behind the next WORD to the right

Cursor position at end of the next word to the right

Cursor position at end of the next WORD to the right

Cursor position in front of the next word to the right

Cursor position in front of the next WORD to the right

Cursor position in front of the next word to the left

Cursor position in front of the next WORD to the left

Cursor position on the next whitespace

Move cursor position behind the next unicode grapheme to the right

Move cursor position in front of the next unicode grapheme to the left

Move cursor position in front of the next word to the left

Move cursor position in front of the next WORD to the left

Move cursor position behind the next word to the right

Move cursor position to the start of the next word

Move cursor position to the start of the next WORD

Move cursor position to the end of the next word

Move cursor position to the end of the next WORD

Insert a single character at the insertion point and move right

Insert &str at the cursor position in the current line.

Sets cursor to end of inserted string

Unicode safety:

Does not validate the incoming string or the current cursor position

Inserts the system specific new line character

  • On Unix systems LF ("\n")
  • On Windows CRLF ("\r\n")

Empty buffer and reset cursor

Clear everything beginning at the cursor to the right/end. Keeps the cursor at the end.

Clear beginning at the cursor up to the end of the line. Newline character at the end remains.

Clear from the start of the buffer to the cursor. Keeps the cursor at the beginning of the line/buffer.

Substitute text covered by range in the current line

Safety: Does not change the insertion point/offset and is thus not unicode safe!

Checks to see if the current edit position is pointing to whitespace

Get the grapheme immediately to the right of the cursor, if any

Get the grapheme immediately to the left of the cursor, if any

Gets the range of the word the current edit position is pointing to

Range over the current line

Starts on the first non-newline character and is an exclusive range extending beyond the potential carriage return and line feed characters terminating the line

Uppercases the current word

Lowercases the current word

Switches the ASCII case of the current char

Capitalize the character at insertion point (or the first character following the whitespace at the insertion point) and move the insertion point right one grapheme.

Deletes on grapheme to the left

Deletes one grapheme to the right

Deletes one word to the left

Deletes one word to the right

Swaps current word with word on right

Swaps current grapheme with grapheme on right

Moves one line up

Moves one line down

Checks to see if the cursor is on the first line of the buffer

Checks to see if the cursor is on the last line of the buffer

Finds index for the first occurrence of a char to the right of offset

Finds index for the first occurrence of a char to the left of offset

Moves the insertion point until the next char to the right

Moves the insertion point before the next char to the right

Moves the insertion point until the next char to the left of offset

Moves the insertion point before the next char to the left of offset

Deletes until first character to the right of offset

Deletes before first character to the right of offset

Deletes until first character to the left of offset

Deletes before first character to the left of offset

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.