Module textadept

The core textadept table.

Fields

  • title: The title of the Textadept window.
  • focused_doc_pointer: The pointer to the document associated with the buffer of the currently focused view. (Used internally; read-only.)
  • menubar: A table of GTK menus defining a menubar (write-only).
  • context_menu: A GTK menu defining the editor's context menu.
  • clipboard_text: The text on the clipboard (read-only).
  • statusbar_text: The text displayed by the statusbar (write-only).
  • docstatusbar_text: The text displayed by the doc statusbar (write-only).
  • size: The size of the Textadept window ({ width, height}).
  • constants: Table containing Scintilla constants.
  • buffer_functions: Table containing Scintilla functions.
  • buffer_properties: Table containing Scintilla set/get functions.

Fields

  • title: The title of the Textadept window.
  • focused_doc_pointer: The pointer to the document associated with the buffer of the currently focused view. (Used internally; read-only.)
  • menubar: A table of GTK menus defining a menubar (write-only).
  • context_menu: A GTK menu defining the editor's context menu.
  • clipboard_text: The text on the clipboard (read-only).
  • statusbar_text: The text displayed by the statusbar (write-only).
  • docstatusbar_text: The text displayed by the doc statusbar (write-only).
  • size: The size of the Textadept window ({ width, height}).
  • constants: Table containing Scintilla constants.
  • buffer_functions: Table containing Scintilla functions.
  • buffer_properties: Table containing Scintilla set/get functions.

Fields

  • title: The title of the Textadept window.
  • focused_doc_pointer: The pointer to the document associated with the buffer of the currently focused view. (Used internally; read-only.)
  • menubar: A table of GTK menus defining a menubar (write-only).
  • context_menu: A GTK menu defining the editor's context menu.
  • clipboard_text: The text on the clipboard (read-only).
  • statusbar_text: The text displayed by the statusbar (write-only).
  • docstatusbar_text: The text displayed by the doc statusbar (write-only).
  • size: The size of the Textadept window ({ width, height}).
  • constants: Table containing Scintilla constants.
  • buffer_functions: Table containing Scintilla functions.
  • buffer_properties: Table containing Scintilla set/get functions.

Functions

_print (buffer_type, ...) Helper function for printing messages to buffers.
check_focused_buffer (buffer) Checks if the buffer being indexed is the currently focused buffer.
dialog (kind, ...) Displays a CocoaDialog of a specified type with the given string arguments.
get_split_table () Gets the current split view structure.
goto_view (n, absolute) Goes to the specified view.
gtkmenu (menu_table) Creates a GTK menu, returning the userdata.
iconv (text, to, from) Converts a string from one character set to another using iconv().
new_buffer () Creates a new buffer.
print (...) Prints messages to the Textadept message buffer.
quit () Quits Textadept.
reset () Resets the Lua state by reloading all init scripts.

Tables

buffers A numerically indexed table of open buffers in Textadept.
views A numerically indexed table of views in Textadept.


Functions

_print (buffer_type, ...)
Helper function for printing messages to buffers. Splits the view and opens a new buffer for printing messages. If the message buffer is already open and a view is currently showing it, the message is printed to that view. Otherwise the view is split, goes to the open message buffer, and prints to it.

Parameters

  • buffer_type: String type of message buffer.
  • ...: Message strings.

Usage

  • textadept._print(locale.ERROR_BUFFER, error_message)
  • textadept._print(locale.MESSAGE_BUFFER, message)
check_focused_buffer (buffer)
Checks if the buffer being indexed is the currently focused buffer. This is necessary because any buffer actions are performed in the focused views' buffer, which may not be the buffer being indexed. Throws an error if the check fails.

Parameters

  • buffer: The buffer in question.
dialog (kind, ...)
Displays a CocoaDialog of a specified type with the given string arguments. Each argument is like a string in Lua's 'arg' table.

Parameters

  • kind:
  • ...:

Return value:

string CocoaDialog result.
get_split_table ()
Gets the current split view structure.

Return value:

table of split views. Each split view entry is a table with 4 fields: 1, 2, vertical, and size. 1 and 2 have values of either split view entries or the index of the buffer shown in each view. vertical is a flag indicating if the split is vertical or not, and size is the integer position of the split resizer.
goto_view (n, absolute)
Goes to the specified view. Activates the 'view_*_switch' signal.

Parameters

  • n: A relative or absolute view index.
  • absolute: Flag indicating if n is an absolute index or not.
gtkmenu (menu_table)
Creates a GTK menu, returning the userdata.

Parameters

  • menu_table: A table defining the menu. It is an ordered list of tables with a string menu item and integer menu ID. The string menu item is handled as follows: 'gtk-*' - a stock menu item is created based on the GTK stock-id. 'separator' - a menu separator item is created. Otherwise a regular menu item with a mnemonic is created. Submenus are just nested menu-structure tables. Their title text is defined with a 'title' key.
iconv (text, to, from)
Converts a string from one character set to another using iconv(). Valid character sets are ones GLib's g_convert() accepts, typically GNU iconv's character sets.

Parameters

  • text: The text to convert.
  • to: The character set to convert to.
  • from: The character set to convert from.
new_buffer ()
Creates a new buffer. Activates the 'buffer_new' signal.

Return value:

the new buffer.
print (...)
Prints messages to the Textadept message buffer. Opens a new buffer (if one hasn't already been opened) for printing messages.

Parameters

  • ...: Message strings.
quit ()
Quits Textadept.
reset ()
Resets the Lua state by reloading all init scripts. Language-specific modules for opened files are NOT reloaded. Re-opening the files that use them will reload those modules. This function is useful for modifying init scripts (such as key_commands.lua) on the fly without having to restart Textadept. A global RESETTING variable is set to true when re-initing the Lua State. Any scripts that need to differentiate between startup and reset can utilize this variable.

Tables

buffers
A numerically indexed table of open buffers in Textadept.
views
A numerically indexed table of views in Textadept.

Valid XHTML 1.0!