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
63
64
65
66
67
68
69
70
| |
(function (){
if( CompareVersion(Editor.ExpandParameter("$v"), "2.2.0.0") <= 0 ){
InfoMsg("ブックマーク行を削除は sakura 2.2.0.0 以上専用です");
return;
}
var lineCount = Editor.GetLineCount(0);
var firstLine = "";
if( 0 < lineCount ){
firstLine = Editor.GetLineStr(1);
}else{
return;
}
var bMarkOk = false;
var mk = "@@";
var count = 0;
var xOld = Editor.ExpandParameter("$x");
var yOld = Editor.ExpandParameter("$y");
var drawOld = Editor.SetDrawSwitch(0);
Editor.AddRefUndoBuffer();
while( false == bMarkOk ){
if( firstLine.substr(0, mk.length) != mk ){
Editor.MoveCursor(1, 1, 0);
Editor.InsText(mk);
if( 2 <= lineCount ){
Editor.MoveCursor(2, 1, 0);
Editor.SearchNext("^" + mk, 2+4+0x20+0x800+0x1000); var y = Editor.ExpandParameter("$y");
if( y == 1 ){
bMarkOk = true;
}
}else{
bMarkOk = true;
}
Editor.MoveCursor(1, 1, 0);
Editor.MoveCursor(1, mk.length + 1, 1);
Editor.Delete();
}
if( false == bMarkOk ){
mk = "@@mk" + count.toString(16) + "@";
}
count++;
};
var bookCount = 0;
for( var i = 1; i <= lineCount; i++ ){
if( 1 == Editor.GetLineAttribute(i, 2) ){
Editor.MoveCursor(i, 1, 0);
Editor.InsText(mk);
bookCount++;
}
}
if( 0 < bookCount ){
Editor.ReplaceAll("^" + mk, "", 2+4+0x20+0x300+0x800+0x1000); }else{
Editor.MoveCursor(yOld, xOld, 0);
}
Editor.SetDrawSwitch(drawOld);
Editor.SetUndoBuffer();
if( drawOld == 1 ){
Editor.Redraw(0);
}
Editor.StatusMsg("ブックマーク行を" + bookCount + "行削除しました");
})();
|