Object which represents a document. It has methods for file operations and manipulating document text.
gtk.GObject
|
+-- moo.Edit
after-save()
This signal is emitted after the document has been successfully saved on disk.
before-save(file)
This signal is emitted when the document is going to be saved on disk. Callbacks should return SAVE_RESPONSE_CANCEL if document should not be saved, and SAVE_RESPONSE_CONTINUE otherwise. For example, if before saving the file must be checked out from a version control system, a callback can do that and return SAVE_RESPONSE_CANCEL if checkout failed. Callbacks should not modify document content. If you need to modify it before saving, use will-save signal instead.
|
the |
Returns: SAVE_RESPONSE_CANCEL to cancel saving, SAVE_RESPONSE_CONTINUE otherwise.
will-save(file)
This signal is emitted when the document is going to be saved on disk, after before-save signal. Callbacks may modify document content at this point.
|
the |
doc.delete_selected_lines()
Delete selected lines. Similar to delete_selected_text() but selection is extended to include whole lines. If no text is selected then line at cursor is deleted.
doc.get_lang_id()
Returns: id of language currently used in the document. If no language is used, then string "none" is returned.
doc.get_line_text(line=0)
|
|
Returns: text at line line, not including line end characters. If line is missing, returns text at cursor line.
doc.get_line_text_at_pos(pos)
|
Returns: text at line which contains position pos, not including line end characters.
doc.get_selected_lines()
Returns selected lines as a list of strings, one string for each line, line terminator characters not included. If nothing is selected, then line at cursor is returned.
Returns: list of strings
doc.get_text(start=nil, end=nil)
|
|
|
|
Returns: text between start and end. If end is missing then it returns text from start to the end of document; and if both start and end are missing then it returns whole document content.
doc.insert_text(text, where=nil)
Insert text at position where or at cursor position if where is .nil
|
|
|
|
doc.is_empty()
This function returns whether the document is "empty", i.e. is not modified, is untitled, and contains no text.
Returns: bool
doc.reload(info=nil)
Reload document from disk
|
|
Returns: whether document was successfully reloaded
doc.replace_selected_lines(replacement)
replace selected lines with replacement. Similar to replace_selected_text(), but selection is extended to include whole lines. If nothing is selected, then line at cursor is replaced.
|
list of lines to replace selected lines with, maybe empty |
doc.replace_selected_text(replacement)
Replace selected text with string replacement. If nothing is selected, then replacement is inserted at cursor.
|
|
doc.replace_text(start, end, text)
|
|
|
|
|
|
doc.select_lines_at_pos(start, end=nil)
Select lines which span the range from start to end (including end position). If end is , then it selects single line which contains position nilstart.
|
|
|
|
doc.select_range(start, end)
Select text from start to end.
|
|
|