This reference documents version 5.1.3-dev of the MPSL API.
mp.break_line - Breaks current line in two (inserts a newline).
mp.break_line(doc, col);
doc | the document |
col | column where the newline will be inserted |
Breaks current line in two by inserting a newline character in between. If col is not NULL, the newline will be inserted in that column; otherwise, the current x position will be used.
mp.copy - Copies to the clipboard
mp.copy(doc);
doc | the source of the copy |
If doc is a document, it copies to the clipboard the content of the selected block, if one exists. If doc is an array or scalar, it copies that data directly into it.
mp.ignore_last_misspell - Ignores last misspelled word.
mp.ignore_last_misspell();
Ignores the last misspelled word found by mp.search_misspelled()
by adding it to a whitelist, so it won't be found again.
mp.is_word_misspelled - Tests if a word is misspelled.
mp.is_word_misspelled(w);
w | the word |
Tests if a word is misspelled. Returns a negative value if there was an error when querying the external spelling program, 1 if the word is misspelled, or 0 if not.
mp.ispell - Changes spelling highlight.
mp.ispell(b);
b | boolean value |
Changes the status of the highlighting of misspelled words. If b is 0, it's disabled (default value); if it's 1, misspelled words will be highlighted using a special attribute color. If b is -1, the status is toggled.
mp.redraw - Triggers a redraw on the next cycle.
mp.redraw();
Triggers a full document redraw in the next cycle.
mp.repeated_words - Finds words starting or ending the same in a range.
mp.repeated_words(doc, num_chars, max_dist);
doc | the document |
num_chars | minimum length for the word to be tested |
max_dist | maximum distance the word must have |
Finds words starting or ending the same to a maximum of num_chars and that are less than max_dist words apart. If a pair of these words is found, 1 is returned, the cursor positioned over the first one and both highlighted as spelling errors. Otherwise, 0 is returned and nothing is done.
mp.search_misspelled - Searches for the next misspelled word.
mp.search_misspelled(doc);
doc | the document to search |
Searches the document for the next misspelled word. If no more misspelled words can be found, returns 0 and does nothing; otherwise, the cursor is moved just after that word and returns 1.
mp.search_set_y - Sets the y position after a successful search.
mp.search_set_y(doc, y);
Sets the y position after a successful search, setting the visual line to that defined in mp.config.move_seek_to_line.
mp.section_list - Returns the list of sections of a document.
mp.section_list(doc);
doc | the document |
Applies the section
array of regular expressions of the
document's syntax definition and returns it as an array of
line and line number pairs.
If the document has no syntax highlight definition, or it has
one without a section
definition, NULL is returned. Otherwise,
an array of line, line number pairs is returned (it can be
an empty list if the document has no recognizable sections).