「タブの桁数」の版間の差分

MSY-07 (トーク | 投稿記録)
変更履歴: バージョン表記の追加
MSY-07 (トーク | 投稿記録)
ソースコードの整形
8行目: 8行目:
== ソースコード ==
== ソースコード ==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
alert( get_tabcolumns() );
alert(get_tabcolumns());


function get_tabcolumns() {
function get_tabcolumns() {
    var x = ScrollX;
var x = ScrollX;
    var y = ScrollY;
var y = ScrollY;
    Redraw = false;
Redraw = false;
    with( Editor.ActiveDocument.Selection ){
with(Editor.ActiveDocument.Selection) {
        var p = GetActivePos();
var p = GetActivePos();
        EndOfDocument();
EndOfDocument();
        Editor.ActiveDocument.Write( "\n\t" );
Editor.ActiveDocument.Write("\n\t");
        SelectLine();
SelectLine();
        Untabify();
Untabify();
        var tab_length = Text.length;
var tab_length = Text.length;
        Delete ();
Delete();
        DeleteLeft();
DeleteLeft();
        SetActivePos( p );
SetActivePos(p);
    };
};
    ScrollX = x;
ScrollX = x;
    ScrollY = y;
ScrollY = y;
    Redraw = true;
Redraw = true;
    return tab_length;
return tab_length;
}
}
</syntaxhighlight>
</syntaxhighlight>
スポンサーリンク