Document.views()
Document.active_view()
Document.filename()
null
if the document
has not been saved yet or if it can't be represented with a local
path (e.g. if it is in a remote location like a web site).
null
"/home/user/example.txt"
null
Document.uri()
null
if the document has not been
saved yet.
Document.basename()
Document.encoding()
Document.set_encoding(encoding)
Document.reload()
Document.save()
Document.save_as(filename=null)
null
then
Save As will be shown to choose new filename.
Document.can_undo()
Document.can_redo()
Document.undo()
Document.redo()
Document.begin_not_undoable_action()
end_not_undoable_action()
call.
Document.end_not_undoable_action()
begin_not_undoable_action()
.
Document.start_pos()
Document.end_pos()
Document.cursor_pos()
Document.set_cursor_pos(pos)
Document.selection()
cursor()
and selection_bound()
if you need to distinguish beginning and end of selection. If no text is
is selected, then it returns pair [cursor, cursor]
.
Document.set_selection(bounds_as_list)
Document.set_selection(start, end)
Document.selection_bound()
set_selection
arguments).
Document.has_selection()
Document.char_count()
Document.line_count()
Document.line_at_pos(pos)
Document.pos_at_line(line)
Document.pos_at_line(line)
Document.char_at_pos(pos)
Document.text()
Document.text(start, end)
doc.text(doc.start_pos(), doc.end_pos())
is
equivalent to doc.text()
.
Document.insert_text(text)
Document.insert_text(pos, text)
Document.replace_text(start, end, text)
delete_text(start, end), insert_text(start, text)
.
Document.delete_text(start, end)
doc.delete_text(doc.start(), doc.end())
will delete all text in
doc
.
Document.append_text(text)
doc.insert_text(doc.end(), text)
.
Document.clear()
Document.copy()
Document.cut()
Document.paste()
Document.select_text(bounds_as_list)
Document.select_text(start, end)
set_selection()
.
Document.select_lines(line)
Document.select_lines(first, last)
Document.select_lines_at_pos(bounds_as_list)
Document.select_lines_at_pos(start, end)
select_text
, but select whole lines.
Document.select_all()
Document.selected_text()
Document.selected_lines()
Document.delete_selected_text()
doc.delete_text(doc.cursor(),
doc.selection_bound())
.
Document.delete_selected_lines()
delete_selected_text()
but
selection is extended to include whole lines. If nothing is selected,
then line at cursor is deleted.
Document.replace_selected_text(text)
Document.replace_selected_lines(text)
replace_selected_text()
, but selection is extended to include
whole lines. If nothing is selected, then line at cursor is replaced.