297 lines
11 KiB
Plaintext
297 lines
11 KiB
Plaintext
|
|
@node Application object
|
|
@section Application object
|
|
@helpsection{SCRIPT_APPLICATION}
|
|
@table @method
|
|
|
|
@item Application.editor()
|
|
returns Editor object.
|
|
@item Application.active_view()
|
|
returns current active document view or @null{} if no documents are open.
|
|
@item Application.active_document()
|
|
returns current active document or @null{} if no documents are open.
|
|
@item Application.active_window()
|
|
returns current active window.
|
|
@item Application.set_active_window(window)
|
|
activates @param{window}.
|
|
@item Application.windows()
|
|
returns a list of all editor windows.
|
|
@item Application.quit()
|
|
quit @medit{}.
|
|
|
|
@end table
|
|
|
|
|
|
@node Editor object
|
|
@section Editor object
|
|
@helpsection{SCRIPT_EDITOR}
|
|
@table @method
|
|
|
|
@item Editor.active_document()
|
|
returns current active document or @null{} if there are no open documents
|
|
@item Editor.set_active_document(doc)
|
|
makes @param{doc} active
|
|
@item Editor.active_window()
|
|
returns current active window
|
|
@item Editor.set_active_window(window)
|
|
makes @param{window} active
|
|
@item Editor.active_view()
|
|
returns current active document view
|
|
@item Editor.set_active_view(view)
|
|
makes @param{view} active
|
|
@item Editor.documents()
|
|
returns list of all open documents
|
|
@item Editor.documents()
|
|
returns list of all open document views
|
|
@item Editor.documents()
|
|
returns list of all document windows
|
|
@item Editor.get_document_by_path(path)
|
|
returns document with path @param{path} or @null{}.
|
|
@item Editor.get_document_by_uri(path)
|
|
returns document with uri @param{uri} or @null{}.
|
|
@item Editor.new_file(file, encoding=null, window=null)
|
|
open file if it exists on disk or create a new one. If @param{encoding} is
|
|
@null{} or "auto" then pick character encoding automatically, otherwise use
|
|
@param{encoding}. If @param{window} is given then open file in that window,
|
|
otherwise in an existing window.
|
|
@item Editor.open_files(files, window=null)
|
|
open files. If @param{window} is given then open files in that window,
|
|
otherwise in an existing window.
|
|
@item Editor.open_files(uris, window=null)
|
|
open files. If @param{window} is given then open files in that window,
|
|
otherwise in an existing window.
|
|
@item Editor.open_file(file, encoding=null, window=null)
|
|
open file. If @param{encoding} is @null{} or "auto" then pick character
|
|
encoding automatically, otherwise use @param{encoding}. If @param{window}
|
|
is given then open files in that window, otherwise in an existing window.
|
|
@item Editor.open_uri(uri, encoding=null, window=null)
|
|
open file. If @param{encoding} is @null{} or "auto" then pick character
|
|
encoding automatically, otherwise use @param{encoding}. If @param{window}
|
|
is given then open files in that window, otherwise in an existing window.
|
|
@item Editor.reload(doc)
|
|
reload document.
|
|
@item Editor.save(doc)
|
|
save document.
|
|
@item Editor.save_as(doc, filename=null)
|
|
save document as @param{filename}. If @param{filename} is not given then
|
|
first ask user for new filename.
|
|
@item Editor.close(doc)
|
|
close document.
|
|
|
|
@end table
|
|
|
|
|
|
@node DocumentWindow object
|
|
@section DocumentWindow object
|
|
@helpsection{SCRIPT_DOCUMENT_WINDOW}
|
|
@table @method
|
|
|
|
@item DocumentWindow.editor()
|
|
returns Editor object.
|
|
@item DocumentWindow.active_view()
|
|
returns current active document view in this window.
|
|
@item DocumentWindow.set_active_view(view)
|
|
makes @param{view} active, i.e. switches to its tab.
|
|
@item DocumentWindow.active_document()
|
|
returns current active document in this window, that is the document
|
|
whose view is the active one.
|
|
@item DocumentWindow.set_active_document(doc)
|
|
makes active a view of document @param{doc}. It picks arbitrary view
|
|
of @param{doc} if there are more than one in this window.
|
|
@item DocumentWindow.views()
|
|
returns list of all document views in this window.
|
|
@item DocumentWindow.documents()
|
|
returns list of all documents in this window.
|
|
@item DocumentWindow.is_active()
|
|
returns whether this window is the active one.
|
|
@item DocumentWindow.set_active()
|
|
makes this window active.
|
|
|
|
@end table
|
|
|
|
|
|
@node DocumentView object
|
|
@section DocumentView object
|
|
@helpsection{DOCUMENT_VIEW}
|
|
@table @method
|
|
|
|
@item DocumentView.document()
|
|
returns document to which this view belongs.
|
|
@item DocumentView.window()
|
|
returns window which contains this view.
|
|
@item DocumentView.line_wrap_mode()
|
|
returns whether line wrapping is enabled.
|
|
@item DocumentView.set_line_wrap_mode(enabled)
|
|
enables or disables line wrapping.
|
|
@item DocumentView.overwrite_mode()
|
|
returns whether overwrite mode is on.
|
|
@item DocumentView.set_overwrite_mode(enabled)
|
|
enables or disables overwrite mode.
|
|
@item DocumentView.show_line_numbers()
|
|
returns whether line numbers are displayed.
|
|
@item DocumentView.set_show_line_numbers(show)
|
|
shows or hides line numbers.
|
|
|
|
@end table
|
|
|
|
|
|
@node Document object
|
|
@section Document object
|
|
@helpsection{DOCUMENT}
|
|
|
|
@table @method
|
|
@item Document.views()
|
|
returns list of views which display this document.
|
|
@item Document.active_view()
|
|
returns active view of this document. If the document has a single
|
|
view, then that is returned; otherwise if the current active view
|
|
belongs to this document, then that view is returned; otherwise
|
|
a random view is picked.
|
|
@item Document.filename()
|
|
returns full file path of the document or @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).
|
|
@itemize @minus
|
|
@item Untitled => @null{}
|
|
@item @file{/home/user/example.txt} => @code{"/home/user/example.txt"}
|
|
@item @file{http://example.com/index.html} => @null{}
|
|
@end itemize
|
|
@item Document.uri()
|
|
returns URI of the document or @null{} if the document has not been
|
|
saved yet.
|
|
@item Document.basename()
|
|
returns basename of the document, that is the full path minus directory
|
|
part. If the document has not been saved yet, then it returns the name
|
|
shown in the titlebar, e.g. "Untitled".
|
|
@item Document.encoding()
|
|
returns character encoding of the document.
|
|
@item Document.set_encoding(encoding)
|
|
set character encoding of the document, it will be used when the document
|
|
is saved.
|
|
@item Document.reload()
|
|
reload the document.
|
|
@item Document.save()
|
|
save the document.
|
|
@item Document.save_as(filename=null)
|
|
save the document as @param{filename}. If @param{filename} is @null{} then
|
|
@uilabel{Save As} will be shown to choose new filename.
|
|
@item Document.can_undo()
|
|
returns whether undo action is available.
|
|
@item Document.can_redo()
|
|
returns whether redo action is available.
|
|
@item Document.undo()
|
|
undo.
|
|
@item Document.redo()
|
|
redo.
|
|
@item Document.begin_not_undoable_action()
|
|
mark the beginning of a non-undoable operation. Undo stack will be erased
|
|
and undo will not be recorded until @method{end_not_undoable_action()} call.
|
|
@item Document.end_not_undoable_action()
|
|
end the non-undoable operation started with @method{begin_not_undoable_action()}.
|
|
@end table
|
|
@table @method
|
|
@item Document.start_pos()
|
|
position at the beginning of the document (0 in Python, 1 in Lua, etc.)
|
|
@item Document.end_pos()
|
|
position at the end of the document. This is the position past the last
|
|
character: it points to no character, but it is a valid position for
|
|
text insertion, cursor may be put there, etc.
|
|
@item Document.cursor_pos()
|
|
position at the cursor.
|
|
@item Document.set_cursor_pos(pos)
|
|
move cursor to position @param{pos}.
|
|
@item Document.selection()
|
|
returns selection bounds as a list of two items, start and end. Returned
|
|
list is always sorted, use @method{cursor()} and @method{selection_bound()}
|
|
if you need to distinguish beginning and end of selection. If no text is
|
|
is selected, then it returns pair @code{[cursor, cursor]}.
|
|
@item Document.set_selection(bounds_as_list)
|
|
@item Document.set_selection(start, end)
|
|
select text.
|
|
@item Document.selection_bound()
|
|
returns the selection bound other than cursor position. Selection is
|
|
either [cursor, selection_bound) or [selection_bound, cursor), depending
|
|
on direction user dragged the mouse (or on @method{set_selection}
|
|
arguments).
|
|
@item Document.has_selection()
|
|
whether any text is selected.
|
|
@item Document.char_count()
|
|
character count.
|
|
@item Document.line_count()
|
|
line count.
|
|
@item Document.line_at_pos(pos)
|
|
returns index of the line which contains position @param{pos}.
|
|
@item Document.pos_at_line(line)
|
|
returns position at the beginning of line @param{line}.
|
|
@item Document.pos_at_line(line)
|
|
returns position at the end of line @param{line}.
|
|
@item Document.char_at_pos(pos)
|
|
returns character at position @param{pos} as string.
|
|
@item Document.text()
|
|
returns whole document contents.
|
|
@item Document.text(start, end)
|
|
returns text in the range [@param{start}, @param{end}), @param{end} not
|
|
included. Example: @code{doc.text(doc.start_pos(), doc.end_pos())} is
|
|
equivalent @code{to doc.text()}.
|
|
@item Document.insert_text(text)
|
|
@item Document.insert_text(pos, text)
|
|
insert text into the document. If @param{pos} is not given, insert at
|
|
cursor position.
|
|
@item Document.replace_text(start, end, text)
|
|
replace text in the region [@param{start}, @param{end}). Equivalent to
|
|
@code{delete_text(start, end), insert_text(start, text)}.
|
|
@item Document.delete_text(start, end)
|
|
delete text in the region [@param{start}, @param{end}). Example:
|
|
@code{doc.delete_text(doc.start(), doc.end())} will delete all text in
|
|
@code{doc}.
|
|
@item Document.append_text(text)
|
|
append text. Equivalent to @code{doc.insert_text(doc.end(), text)}.
|
|
@item Document.clear()
|
|
delete all text in the document.
|
|
@item Document.copy()
|
|
copy selected text to clipboard. If no text is selected then nothing
|
|
will happen, same as Ctrl-C key combination.
|
|
@item Document.cut()
|
|
cut selected text to clipboard. If no text is selected then nothing
|
|
will happen, same as Ctrl-X key combination.
|
|
@item Document.paste()
|
|
paste text from clipboard. It has the same effect as Ctrl-V key combination:
|
|
nothing happens if clipboard is empty, and selected text is replaced with
|
|
clipboard contents otherwise.
|
|
@item Document.select_text(bounds_as_list)
|
|
@item Document.select_text(start, end)
|
|
select text, same as @method{set_selection()}.
|
|
@item Document.select_lines(line)
|
|
select a line.
|
|
@item Document.select_lines(first, last)
|
|
select lines from @param{first} to @param{last}, @emph{including}
|
|
@param{last}.
|
|
@item Document.select_lines_at_pos(bounds_as_list)
|
|
@item Document.select_lines_at_pos(start, end)
|
|
select lines: similar to @method{select_text}, but select whole lines.
|
|
@item Document.select_all()
|
|
select all.
|
|
@item Document.selected_text()
|
|
returns selected text.
|
|
@item Document.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.
|
|
@item Document.delete_selected_text()
|
|
delete selected text, equivalent to @code{doc.delete_text(doc.cursor(),
|
|
doc.selection_bound())}.
|
|
@item Document.delete_selected_lines()
|
|
delete selected lines. Similar to @method{delete_selected_text()} but
|
|
selection is extended to include whole lines. If nothing is selected,
|
|
then line at cursor is deleted.
|
|
@item Document.replace_selected_text(text)
|
|
replace selected text with @param{text}. If nothing is selected,
|
|
@param{text} is inserted at cursor.
|
|
@item Document.replace_selected_lines(text)
|
|
replace selected lines with @param{text}. Similar to
|
|
@method{replace_selected_text()}, but selection is extended to include
|
|
whole lines. If nothing is selected, then line at cursor is replaced.
|
|
@end table
|
|
|
|
|