テキスト非選択でも現在行を逆インデント
- ページ: Macro/投稿
- 作者: ルーチェ?
- カテゴリー: js
- 投稿日: 2011-10-30 (日) 21:06:11
メッセージ
テキスト非選択状態であっても現在行の行頭に対して逆インデントを行います。
テキスト選択状態の場合は通常通りの逆インデントを行います。
Shift+Tab に標準の逆TABインデントの代わりに割り当てて使うことができます。
0
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
| |
(function()
{
switch (Editor.IsTextSelected())
{
case 0: {
pos = parseInt(Editor.ExpandParameter('$x')) - 1;
lineOld = Editor.GetLineStr(0);
Editor.GoLineEnd();
Editor.GoLineTop_Sel();
if (Editor.IsTextSelected() != 0)
{
Editor.UnindentTab();
if (Editor.GetSelectLineFrom() == Editor.GetSelectLineTo())
{
Editor.GoLineEnd();
Editor.GoLineTop();
}
else
{
Editor.Up();
}
lineNow = Editor.GetLineStr(0);
pos -= lineOld.length - lineNow.length;
for (i = 0; i < pos; ++i)
{
Editor.Right();
}
}
}
break;
case 1: case 2: default:
Editor.UnindentTab();
break;
}
})();
|