This reference documents version 5.2.2-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.c_gather_help - Gathers help in C-style files
mp.c_gather_help(word);
word | the help term |
Searches in all applicable files for code snippets that may conform help for word (mp_doccer style help, struct or function definitions, etc).
Returns an array of text with the gathered information.
mp.copy - Copies the selected block or a string 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.cut_lines_with_string - Cuts all lines matching a string
mp.cut_lines_with_string(doc, str);
doc | the document |
str | the string to be matched |
Cuts all lines from the document that matches str, that is a regular expression. The deleted lines are left in the clipboard. If a block is selected, only lines inside it are cut.
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.paste - Pastes from the clipboard into a text or as a value
mp.paste(doc);
doc | the destination of the copy |
If doc is NULL, returns the content of the clipboard as a scalar string; if it's not, is assumed to be a document and pastes the content of the clipboard into the cursor position.
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).