'ソフトタブ処理 / Ver. 0.80 / by Kabuneko 1999/09/13

proc main 'ソフトタブ挿入
    @Insert space$(@Tab - (@XDisplay + @Tab - 1) mod @Tab)
end proc

proc Indent 'ソフトタブ・インデント
    dim m, n
    '行選択のときのみ実行
    if @Select < 5 then exit proc
    @Redraw = 0
    @UndoBlock = 1
    m = @SelectStartLine
    n = @SelectEndLine
    @BlockSelectEnd
    @Line = n - 1
    do while 1
        @MoveBeginningLine
        @Insert space$(@Tab)
        if @Line <= m then exit do
        @MoveUpChar
    loop
    @UndoBlock = 0
    @Redraw = 1
end proc

proc Unindent 'ソフトタブ・アンインデント
    dim m, n
    '行選択のときのみ実行
    if @Select < 5 then exit proc
    @Redraw = 0
    @UndoBlock = 1
    m = @SelectStartLine
    n = @SelectEndLine
    @BlockSelectEnd
    @Line = n - 1
    do while 1
        @MoveBeginningLine
        if left$(@TextCr$(@Line), @Tab) = space$(@Tab) then \
            @Change @Line, 0, @Tab, ""
        if @Line <= m then exit do
        @MoveUpChar
    loop
    @UndoBlock = 0
    @Redraw = 1
end proc