Skip to main content

Module edit

Module edit 

Source
Expand description

Text editing on a TextBody: positions are (paragraph, character offset). Inserting text with \n splits paragraphs; formatting a range splits runs at its ends.

Functions§

change_case
Change case: upper, lower, sentence, title, toggle.
char_move
One character left/right across paragraph boundaries.
delete
Delete the range between a and b; returns the caret at the start.
delete_word
Delete a word from pos as Ctrl+Backspace (forward == false) or Ctrl+Delete does in PowerPoint; returns the caret.
end
End of the body.
format
Apply f to the run properties of every run in [a, b). An empty range changes the empty paragraph’s end mark (so typing there picks the formatting up).
format_all
Apply f to every run in the body (and end marks).
insert
Insert text at pos (with props, else the props at pos). \n starts a new paragraph (same level and paragraph props); \u{b} inserts a line break. Returns the caret after it.
insert_body
Insert a formatted body at pos (paste): first paragraph merges into the current one.
next_case
The case Shift+F3 changes s to next, as PowerPoint cycles it: lowercase → Capitalize Each Word → UPPERCASE → lowercase; any other mix goes to UPPERCASE first.
para_down
Ctrl+Down: the start of the next paragraph, or the end of the last one.
para_up
Ctrl+Up: the start of the paragraph, or of the previous one when already there.
props_at
The explicit run properties in effect at pos (the run before the caret, or the end mark).
slice
A formatted copy of the range.
text_range
The text between two positions (\n between paragraphs).
word_at
The word a double-click selects around pos (see words::word_at): the word without its trailing spaces, as PowerPoint selects it.
word_move
Next/previous word stop (Ctrl+Right/Left on Windows, Option+arrows on the Mac). At the end of a paragraph Ctrl+Right goes to the start of the next one; at its start Ctrl+Left goes to the end of the previous one.

Type Aliases§

Pos
(paragraph, char offset in the paragraph).