File: snippet_python.md

package info (click to toggle)
frescobaldi 3.0.0~git20161001.0.eec60717%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 19,792 kB
  • ctags: 5,843
  • sloc: python: 37,853; sh: 180; makefile: 69
file content (31 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
=== Python Snippets ===

Python snippets can read and should set the variable `text`.
The variable `text` contains the currently selected text (which may be an
empty string).
        
You may set `text` to a string or a list of strings.

Other variables that may be referenced:

!`state`
: A list of strings describing the type of text the cursor is at.

!`cursor`
: The current QTextCursor, giving access to the document.
  Don't change the document through the cursor, however.

!`CURSOR`
: When setting `text` to a list instead of a string, you can use this value to
  specify the place the text cursor will be placed after inserting the snippet.

!`ANCHOR`
: When setting `text` to a list instead of a string, this value can be used
  together with `CURSOR` to select text when inserting the string parts of
  the list.

!`main`
: When you define a function with this name, it is called without arguments,
  instead of inserting the text from the `text` variable. In this case you 
  may alter the document through the `cursor`.