Minimum Profit API

This reference documents version 5.50 of the MPSL API. <->

By Source

mp_clipboard.mpsl

mp_core.mpsl

mp_edit.mpsl

mp_search.mpsl

mp_spell.mpsl

mp_syntax.mpsl

mp_writing.mpsl

Alphabetical

mp.ignore_last_misspell

Name

mp.ignore_last_misspell - Ignores last misspelled word.

Synopsis

 mp.ignore_last_misspell();

Description

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

Name

mp.is_word_misspelled - Tests if a word is misspelled.

Synopsis

 mp.is_word_misspelled(w);

Arguments

w  the word

Description

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

Name

mp.ispell - Changes spelling highlight.

Synopsis

 mp.ispell(b);

Arguments

b  boolean value

Description

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

Name

mp.redraw - Triggers a redraw on the next cycle.

Synopsis

 mp.redraw();

Description

Triggers a full document redraw in the next cycle.

mp.search_misspelled

Name

mp.search_misspelled - Searches for the next misspelled word.

Synopsis

 mp_doc.search_misspelled(doc);

Arguments

doc  the document to search

Description

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_doc.break_line

Name

mp_doc.break_line - Breaks current line in two (inserts a newline).

Synopsis

 mp_doc.break_line(doc, col);

Arguments

doc  the document
col  column where the newline will be inserted

Description

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_doc.copy

Name

mp_doc.copy - Copies the selected block to the clipboard

Synopsis

 mp_doc.copy(doc);

Arguments

doc  the document

Description

Copies to the clipboard the content of the selected block, if one exists.

mp_doc.cut_line

Name

mp_doc.cut_line - Cut current line to clipboard

Synopsis

 mp_doc.cut_line(doc);

Arguments

doc  the document

Description

Cut the current line to the clipboard.

mp_doc.cut_lines_with_string

Name

mp_doc.cut_lines_with_string - Cuts all lines matching a string

Synopsis

 mp_doc.cut_lines_with_string(doc, str);

Arguments

doc  the document
str  the string to be matched

Description

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_doc.indent_block

Name

mp_doc.indent_block - Indent the currently selected block.

Synopsis

 mp_doc.indent_block(doc, insert_tab);

Arguments

doc  the document
insert_tab  if set to 1 and there is no selection, it inserts a tab instead

Description

If a selection exists, this increases indentation for the selected lines. Else, it inserts a tabulation

mp_doc.paste

Name

mp_doc.paste - Pastes from the clipboard into a text or as a value

Synopsis

 mp_doc.paste(doc);

Arguments

doc  the destination of the copy

Description

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_doc.repeated_words

Name

mp_doc.repeated_words - Finds words starting or ending the same in a range.

Synopsis

 mp_doc.repeated_words(doc, num_chars, max_dist);

Arguments

doc  the document
num_chars  minimum length for the word to be tested
max_dist  maximum distance the word must have

Description

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_doc.search_set_y

Name

mp_doc.search_set_y - Sets the y position after a successful search.

Synopsis

 mp_doc.search_set_y(doc, y);

Arguments

doc  the document
y  y coordinate

Description

Sets the y position after a successful search, setting the visual line to that defined in mp.config.move_seek_to_line.

mp_doc.section_list

Name

mp_doc.section_list - Returns the list of sections of a document.

Synopsis

 mp_doc.section_list(doc);

Arguments

doc  the document

Description

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).

mp_doc.seek_matching

Name

mp_doc.seek_matching - Move to the matching brace char if the cursor if

Synopsis

 mp_doc.seek_matching(doc);

Description

doc: the document

This can not use regex based searching because of the recurrence issue. This accepts ( { and [ type braces.

mp_doc.unindent_block

Name

mp_doc.unindent_block - Unindent the currently selected block.

Synopsis

 mp_doc.unindent_block(doc, insert_real_tab);

Arguments

doc  the document
insert_real_tab  if set to 1 and there is no selection, it inserts a real tab instead

Description

If a selection exists, this decreases indentation for the selected lines. Else, it inserts a real tabulation


ttcdt - dev@triptico.com - Built with mp_doccer 1.2.2