~ubuntu-branches/ubuntu/oneiric/kde4libs/oneiric-proposed

« back to all changes in this revision

Viewing changes to kate/script/data/indentation_template.js

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-07-08 00:08:34 UTC
  • mto: This revision was merged to the branch mainline in revision 247.
  • Revision ID: package-import@ubuntu.com-20110708000834-dr9a8my4iml90qe5
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* kate-script
2
 
 * name: Indenter name (appears in the menu)
3
 
 * license: license (BSD, GPL, LGPL, Artistic, etc)
4
 
 * author: first name last name <email-address>
5
 
 * revision: 1 (simple integer number)
6
 
 * kate-version: 3.4
7
 
 */
8
 
 
9
 
// specifies the characters which should trigger indent, beside the default '\n'
10
 
triggerCharacters = "{}/:;";
11
 
 
12
 
/**
13
 
 * Indent a line.
14
 
 * This function is called for every <return/enter> and for all trigger
15
 
 * characters. ch is the character typed by the user. ch is
16
 
 * - '\n' for newlines
17
 
 * - "" empty for the action "Tools > Align"
18
 
 * - all other characters are really typed by the user.
19
 
 *
20
 
 * Return value:
21
 
 * - return -2; - do nothing
22
 
 * - return -1; - keep indentation (searches for previous non-blank line)
23
 
 * - return  0; - All numbers >= 0 are the indent-width in spaces
24
 
 *
25
 
 * Alternatively, an array of two elements can be returned:
26
 
 * return [ indent, align ];
27
 
 *
28
 
 * The first element is the indent-width like above, with the same meaning
29
 
 * of the special values.
30
 
 *
31
 
 * The second element is an absolute value representing a column for
32
 
 * "alignment". If this value is higher than the indent value, the
33
 
 * difference represents a number of spaces to be added after the indent.
34
 
 * Otherwise, it's ignored.
35
 
 *
36
 
 * Example:
37
 
 * Assume using tabs to indent, and tab width is 4. Here ">" represents a
38
 
 * tab, and "." represents a space:
39
 
 * 1: >   >   foobar("hello",
40
 
 * 2: >   >   ......."world")
41
 
 *
42
 
 * When indenting line 2, the script returns [8, 15]. Two tabs are inserted
43
 
 * to indent to column 8, and 7 spaces are added to align the second
44
 
 * parameter under the first, so that it stays aligned if the file is viewed
45
 
 * with a different tab width.
46
 
 */
47
 
function indent(line, indentWidth, ch)
48
 
{
49
 
    return -2;
50
 
}
51
 
 
52
 
// kate: space-indent on; indent-width 4; replace-tabs on;