Difference between revisions of "CudaText API"

From Free Pascal wiki
Jump to navigationJump to search
Line 24: Line 24:
 
===set_caret===
 
===set_caret===
  
  set_caret(posx, posy, endx, endy)
+
  set_caret(posx, posy, endx=-1, endy=-1)
  
 
Sets single caret with given info (4 integers, see get_caret). Multi-carets 're removed.
 
Sets single caret with given info (4 integers, see get_caret). Multi-carets 're removed.

Revision as of 17:58, 23 September 2015

Intro

This is API for CudaText in Python.

  • Main Py module is cudatext. Main module has constants, funcs, class Editor, objects of class Editor.
  • Additional module: cudatext_cmd has constants for command runner func.

Global funcs

msg_box

Editor class

Caret-related

get_caret

get_caret()

Returns 4-tuple: info about top visible caret: (PosX, PosY, EndX, EndY). PosY is line index (0-base), PosX is column (0-base), EndY/EndX are position of selection end for this caret or both -1 if no selection.

get_carets

get_carets()

Returns list of 4-tuples. Each list item is info about each caret, see get_caret.

set_caret

set_caret(posx, posy, endx=-1, endy=-1)

Sets single caret with given info (4 integers, see get_caret). Multi-carets 're removed.

add_caret

add_caret(posx, posy, endx, endy)

Adds caret with given info (4 integers, see get_caret). If called with posx<0, then all carets deleted.

Text read/write

Properties get/set

Misc