
    TSE Jr Command              TSE Pro Command
    --------------------        ---------------

    addline                     AddLine()
    align                       ExecMacro("Align")
    altwordset                  Set(WordSet, ChrSet("0-9A-Za-z_!#$%&`'()-./\@{}~:^"))
    appendscrbuff               ExecMacro("nameclip -copyappend")
    asciichart                  Macro in tsejr.ui (mAsciiChart())
    backspace                   BackSpace()
    begfile                     BegFile()
    begline                     BegLine()
    begscreen                   BegWindow()
    centerline                  ExecMacro("Center")
    changefilename              ChangeCurrFilename()
    closewindow                 CloseWindow()
    copy                        Copy()
    copyblock                   CopyBlock()
    copyoverblock               CopyBlock(_OVERWRITE_)
    currentfilename             InsertText(CurrFileName())
    cursordown                  Down()
    cursorleft                  Left()
    cursorright                 Right()
    cursorup                    Up()
    cut                         Cut()
    defaultwordset              Set(WordSet, ChrSet("0-9A-Za-z_"))
    delch                       DelChar()
    deleteblock                 DelBlock()
    delline                     DelLine()
    delltword                   DelLeftWord()
    delrtword                   DelRightWord()
    delscrbuff                  ExecMacro("nameclip -delete")
    deltoeol                    DelToEol()
    dirtree                     ExecMacro("Tree")
    dos                         Dos()
    dropanchor                  MarkStream()
    dupline                     DupLine()
    editfile                    EditFile()
    endfile                     EndFile()
    endline                     EndLine()
    endpara                     See "Paragraph Utilities" section
    endscreen                   EndWindow()
    executescrap                ExecScrapMacro()
    exit                        QuitFile()
    file                        SaveAndQuitFile()
    fillblock                   FillBlock()
    find                        Find()
    findreplace                 Replace()
    firstnonwhite               GotoPos(PosFirstNonWhite())
    flip                        Flip()
    getprev                     Macro in tsejr.ui (mCopyCharAbove())
    getscrbuff                  ExecMacro("nameclip -paste")
    gexit                       Exit()
    gfile                       SaveAllAndExit()
    goback
    gotoblockbeg                GotoBlockBegin()
    gotoblockend                GotoBlockEnd()
    gotocolumn                  GotoColumn()
    gotofirstline               GotoLine(1)
    gotolastline                GotoLine(NumLines())
    gotoline                    GotoLine()
    gpquit                      See "Macros for PQuit and GPQuit" section below.
    grabscreen
    growwindow                  ResizeWindow()
    gsave                       SaveAllFiles()
    halfpgdn                    RollDown(Query(WindowRows)/2)
    halfpgup                    RollUp(Query(WindowRows)/2)
    horizontalwindow            HWindow()
    incrementalsearch           ExecMacro("Isrch")
    inputch                     SelfInsert()
    insertdate                  InsertText(GetDateStr(),_INSERT_)
    insertline                  InsertLine()
    inserttime                  InsertText(GetTimeStr(),_INSERT_)
    isbegline                   (CurrCol() == 1)
    iscurrchar                  (Chr(CurrChar()) ==
    iscursorinblock             isCursorInBlock()
    isemptyline                 (CurrLineLen() == 0)
    isendline                   (CurrChar() < 0)
    isfirstline                 (CurrLine() == 1)
    islastline                  (CurrLine() >= NumLines())
    isword                      isWord()
    jfalse
    joinline                    JoinLine()
    jtrue
    jump
    killfile                    KillFile()
    linedown                    RollDown()
    lineup                      RollUp()
    listfiles                   ExecMacro("ListOpen")
    literal                     Literal()
    locatefile                  ExecMacro("Where")
    lower                       Lower()
    macrobegin
    macroquit                   return()
    macroquitfalse
    macroquittrue
    macroread                   LoadMacro()
    macrorecord                 RecordKeyMacro()
    macrowrite                  SaveKeyMacro()
    mainmenu                    MainMenu()
    makebotofscreen             ScrollToRow(Query(WindowRows))
    makectrofscreen             ScrollToCenter()
    maketopofscreen             ScrollToTop()
    markblockbegin              macro in tsejr.UI  (mMarkBlockBegin() see also ShowMark())
    markblockend                macro in tsejr.UI  (mMarkBlockEnd() see also ShowMark())
    markcharacter               MarkChar()
    markcolumn                  MarkColumn()
    markline                    MarkLine()
    markword                    MarkWord()
    match                       ExecMacro("Match")
    maximizewindow              See "MaximizeWindow" section below.
    mousemenu                   menu in tsejr.ui  (MouseMenu())
    moveblock                   MoveBlock()
    newfile                     ReplaceFile()
    nextequalindent             See "NextEqualIndent" macro below
    nextfile                    NextFile()
    nextpara                    See "Paragragh Utilites" below
    nextwindow                  NextWindow()
    onewindow                   OneWindow()
    pagedown                    PageDown()
    pageup                      PageUp()
    paste                       Paste()
    pasteover                   Paste(_OVERWRITE_)
    pause
    pquit                       if (not FileChanged() or YesNo("Lose Changes?") == 1) FileChanged(FALSE) QuitFile() endif
    prevequalindent             See "PrevEqualIndent" section below
    prevfile                    PrevFile()
    prevpara                    See "Paragraph Utilities" section below
    prevposition                PrevPosition()
    prevwindow                  PrevWindow()
    printall                    PrintFile()
    printblock                  PrintBlock()
    printeject                  PrintChar(Chr(12))
    quickhelp                   QuickHelp(KeyAssignments)
    quit                        AbandonFile()
    readblock                   InsertFile()
    repeatcmd                   RepeatCmd()
    repeatfind                  RepeatFind()
    resizewindow                ResizeWindow()
    restoresettings             See "SaveSettings RestoreSettings" section below
    return                      CReturn()
    savefile                    SaveFile()
    savesettings                See "SaveSettings RestoreSettings" section below
    screenleft                  RollLeft()
    screenright                 RollRight()
    scrolldown                  ScrollDown()
    scrollup                    ScrollUp()
    setautoindentmode           Set(AutoIndent,1)
    setbakups                   Set(MakeBackups, On)
    setboxdraw                  Set(LineDrawing, On)
    setcenterfinds              Set(CenterFinds, On)
    setctabwidth                See "SetCTabWidth, SetPTabWidth" section below
    setcuamarking               PurgeMacro("CUAMark") LoadMacro("CUAMark")
    setega25                    Set(CurrVideoMode,_25_LINES_)
    setega28                    Set(CurrVideoMode,_28_LINES_)
    setega43                    Set(CurrVideoMode,_43_LINES_)
    setentermatching            PurgeMacro("insmatch") LoadMacro("insmatch")
    setinsmode                  Set(InsertMode,ON)
    setprintaddff               Set(PrintAddFF, On)
    setprintbotmargin           See "SetPrintBotMargin" section below
    setprintdevice              See "SetPrintDevice" section below
    setprintleftmargin          See "SetPrintLeftMargin" section below
    setprintlinespacing         See "SetPrintLineSpacing" section below
    setprintpagesize            See "SetPrintPageSize" section below
    setprinttopmargin           See "SetPrintTopMargin" section below
    setpromptforeas
    setptabwidth                See "SetCTabWidth, SetPTabWidth" section below
    setrmargin                  Macro in tsejr.UI (mSetRMargin())
    setscreenoff
    setscreenon
    setsoundoff                 Set(Beep,OFF)
    setsoundon                  Set(Beep,ON)
    setswap
    setsyncscroll               PurgeMacro("synchsrc") ExecMacro("synchsrc")
    settabsexpand               Set(ExpandTabs, On)
    settabsout
    settabtype                  Macro in tsejr.ui (TabTypeMenu())
    setvartabstops              See "SetVarTabStops" section below
    setwordwrapmode             Set(WordWrap,ON)
    shell                       Shell()
    shiftleft                   macro in tse.ui (mShiftBlock(0) also see mShift() macro.)
    shiftright                  macro in tse.ui (mShiftBlock(1) also see mShift() macro.)
    showentryscreen             ShowEntryScreen()
    shrinkwindow                Resizewindow()
    sort                        Sort()
    spacestotabs                LoadMacro("tabutil") ExecMacro("entab")
    spellcheck                  ExecMacro("SpellChk")
    splitline                   SplitLine()
    storescrbuff                ExecMacro("nameclip -copy")
    swapchars                   See "SwapChars" section below
    swaplines                   macro in tsejr.ui (mSwapLines())
    swapwords                   See "SwapWords" section below
    tablt                       TabLeft() or macro in tsejr.ui (qeTabLeft())
    tabrt                       TabRight() or macro in tsejr.ui (qeTabRight())
    tabstospaces                LoadMacro("tabutil") ExecMacro("detab")
    togglebakups                Toggle(MakeBackups)
    toggleboxdraw               Toggle(LineDrawing)
    toggleboxtype               LineTypeMenu()
    togglecenterfinds           Toggle(CenterFinds)
    togglecuamarking            see "mToggleCuaMarking" section below
    toggleega28                 Set(CurrVideoMode,iif(Query(CurrVideoMode)<>_25_LINES_,_25_LINES_,_28_LINES_))
    toggleega43                 Set(CurrVideoMode,iif(Query(CurrVideoMode)<>_25_LINES_,_25_LINES_,_43_LINES_))
    toggleentermatching         macro in tsejr.ui (mToggleEnterMatching())
    toggleindent                Set(AutoIndent,iif(Query(AutoIndent) <> 0,0,1))
    toggleinsert                ToggleInsert()
    toggleprintaddff            Toggle(PrintAddFF)
    toggleprintlinenumbers      Toggle(PrintLineNumbers)
    toggleprintpause            Toggle(PrintPause)
    togglepromptforeas
    toggleshowcurrchar          ExecMacro("showcurr")
    togglesmarttabs             Set(TabType,iif(Query(TabType)<>_SMART_,_SMART_,_SOFT_))
    togglesortcaseinsensitive   ToggleSortFlag(2)
    togglesortdescending        ToggleSortFlag(1)
    toggleswap
    togglesyncscroll            ExecMacro("synchscr")
    toggletabsexpand            Toggle(ExpandTabs)
    toggletabsout
    togglevartabs               Set(TabType,iif(Query(TabType)<>_VARIABLE_,_SOFT_,_VARIABLE_))
    togglewordwrap              macro in tsejr.ui (mToggleWordWrap())
    tsrpaste
    undocursorline              RestoreCursorLine()
    unkill                      UnDelete()
    unmarkblock                 UnMarkBlock()
    upper                       Upper()
    winclipcopy                 CopyToWinClip()
    winclippaste                PasteFromWinClip()
    wordleft                    WordLeft()
    wordright                   WordRight()
    wrappara                    WrapPara()
    writeblock                  SaveBlock()
    zoomwindow                  ZoomWindow()

/* ------------------------------------------------------------------------
 * Macros for PQuit and GPQuit:
 * ---------------------------
 *
 * The mQuitFile() macro duplicates the "Lose Changes?" menu from TSE Jr's
 * PQuit command.
 *
 * The mGPQuit() macro duplicates GPQuit command from TSE Jr.  This macro
 * calls the mQuitFile() macro to duplicate the PQuit command and "Lose
 * Changes?" menu from TSE Jr.
 *
 * ------------------------------------------------------------------------
 */

integer proc mQuitFile()
    if FileChanged()
        if YesNo("Lose Changes? ") == 1
            FileChanged(FALSE)
            QuitFile()
        else
            return (FALSE)
        endif
    else
        QuitFile()
    endif
    return (TRUE)
end

proc mGPQuit()
    integer qtp=set(QuitToPrompt,OFF)

    while mQuitFile()    // call the macro listed above
        UpdateDisplay()
    endwhile
    Set(QuitToPrompt,qtp)
end


/* ------------------------------------------------------------------------
 * Paragraph Utilities
 * -----------------------------
 *
 * ALL OF THE MACROS IN THIS SECTION MUST BE USED TOGETHER.
 *
 * TSE JR Cmd   MacroName       ShortDescript
 * ----------   ---------       -------------
 * endpara      mEndPara()      Move cursor to end of current paragraph
 * nextpara     mNextPara()     Move cursor to beginning of next paragraph
 * prevpara     mPrevPara()     Positions cursor on first character of previous paragraph.
 *
 * ------------------------------------------------------------------------
 */

integer proc FindPreviousBlankLine()
    repeat
        if not Up()
            return (FALSE)
        endif
    until PosFirstNonWhite() == 0
    return (TRUE)
end

integer proc FindPreviousNonBlankLine()
    repeat
        if not Up()
            return (FALSE)
        endif
    until PosFirstNonWhite()
    return (TRUE)
end

integer proc FindNextBlankLine()
    repeat
        if not Down()
            return (FALSE)
        endif
    until PosFirstNonWhite() == 0
    return (TRUE)
end

integer proc FindNextNonBlankLine()
    repeat
        if not Down()
            return (FALSE)
        endif
    until PosFirstNonWhite()
    return (TRUE)
end

integer proc FindPara(integer previous)
    integer col = CurrCol(), cline = CurrLine()
    string opt[1], s[80] = GetFunctionStr()

    if Length(s)
        if previous
            BegLine()
            opt = 'b'
        else
            EndLine()
            opt = ''
        endif
        lFind(s, "ix+" + opt)
    else    // unknown type, use line delimited chunks
        PushPosition()
        if previous
            Up()
            repeat until PosFirstNonWhite() or not Up()
            repeat until not Up() or PosFirstNonWhite() == 0
            if PosFirstNonWhite() == 0
                Down()
            endif
            if PosFirstNonWhite()
                KillPosition()
            else
                PopPosition()
            endif
        else
            if (PosFirstNonWhite() == 0 or FindNextBlankLine())
                    and FindNextNonBlankLine()
                KillPosition()
            else
                PopPosition()
            endif
        endif
    endif
    GotoColumn(col)
    return (CurrLine() <> cline)
end

integer proc mPrevPara()
    return (FindPara(TRUE))
end

integer proc mNextPara()
    return (FindPara(FALSE))
end

proc mBegPara()
    integer cline, pline

    cline = CurrLine()
    mPrevPara()
    pline = CurrLine()
    mNextPara()
    if cline <> CurrLine()
        GotoLine(pline)
    endif
end

proc mEndPara()
    integer cline = CurrLine()

    if mNextPara()
        FindPreviousBlankLine()
        FindPreviousNonBlankLine()
    else
        EndFile()
        repeat until CurrLine() <= cline or PosFirstNonWhite() or not Up()
    endif
end

/* ------------------------------------------------------------------------
 * MaximizeWindow
 * -----------------------------
 *
 * Makes the current window as large as possible by minimizing
 * all other open windows on the screen.
 *
 * This command differs some from the MaximizeWindow command in TSE Jr.
 * to take vertical windows into account when minimizing open windows.
 *
 * ------------------------------------------------------------------------
 */

proc mMaximizeWindow()
    integer id = WindowId(), changed, i, x, y

    Set(Break, On)
    if NumWindows() > 1
        x = Query(WindowX1)
        y = Query(WindowY1)
        do NumWindows() times
            repeat
                changed = FALSE
                for i = 1 to 9
                    if GotoWindow(i)
                        if i <> id
                            if Query(WindowX1) > x
                                ResizeWindow(_LEFT_, -Query(ScreenCols))
                                ResizeWindow(_RIGHT_, -Query(ScreenCols))
                            else
                                ResizeWindow(_LEFT_, Query(ScreenCols))
                                ResizeWindow(_RIGHT_, Query(ScreenCols))
                            endif
                            if Query(WindowY1) > y
                                ResizeWindow(_UP_, -Query(ScreenRows))
                                ResizeWindow(_DOWN_, -Query(ScreenRows))
                            else
                                ResizeWindow(_DOWN_, Query(ScreenRows))
                                ResizeWindow(_UP_, Query(ScreenRows))
                            endif
                        endif
                    endif
                    GotoWindow(id)
                    changed = ResizeWindow(_UP_, Query(ScreenRows)) | changed
                    changed = ResizeWindow(_DOWN_, -Query(ScreenRows)) | changed
                    changed = ResizeWindow(_LEFT_, Query(ScreenCols)) | changed
                    changed = ResizeWindow(_RIGHT_, -Query(ScreenCols)) | changed
                    x = Query(WindowX1)
                    y = Query(WindowY1)
                endfor
            until NOT changed
        enddo
    endif
end

/* ------------------------------------------------------------------------
 * NextEqualIndent
 * -----------------------------
 *
 * This macro duplicates the nextequalindent command in TSE Jr.
 *
 * This command moves the cursor to the next line whose text satrts in the
 * same column as the current line.  If the current line is blank, moves to
 * the next blank line.
 * ------------------------------------------------------------------------
 */

proc NextEqualIndent()
    integer ci = PosFirstNonWhite()

    while Down() and ci <> PosFirstNonWhite()
    endwhile
end

/* ------------------------------------------------------------------------
 * PrevEqualIndent
 * -----------------------------
 *
 * Moves the cursor to the previous line whose text starts in the same column
 * as the current line.  If the current line is blank, moves to the previous
 * blank line.
 * ------------------------------------------------------------------------
 */

proc PrevEqualIndent()
    integer ci = PosFirstNonWhite()

    while Up() and ci <> PosFirstNonWhite()
    endwhile
end

/* ------------------------------------------------------------------------
 * mToggleCuaMarking
 * -----------------------------
 *
 *  Toggles (ON and OFF) CUA-Style Block Marking Mode.  If ON, the
 *  shifted cursor keys can be used to mark non-inclusive character
 *  Blocks.
 *
 * ------------------------------------------------------------------------
 */

proc mToggleCuaMarking()
    if isMacroLoaded("cuamark")
        PurgeMacro("cuamark")
    else
        LoadMacro("cuamark")
    endif
end

/* ------------------------------------------------------------------------
 * SetCTabWidth, SetPTabWidth
 * -----------------------------
 * SetCTabWidth:
 *
 *  Sets the cursor tab width.  This is the width that is used when the
 *  TabRt or TabLt commands are executed and Fixed Tabs mode is in
 *  effect.
 *
 * SetPTabWidth:
 *
 *  Sets the Physical Tab Width.  This determines the width to which
 *  physical tab characters found in files are expanded if Physical Tab
 *  Expansion is set ON.  It also determines the number of spaces to be
 *  used for Tabs Out mode.
 *
 * Either pass the tab width you want or a null string for the macro
 * to prompt you.
 *
 * ------------------------------------------------------------------------
 */

proc mSetTabWidth(string width)
    string t[10] = width
    if NOT Length(t)
        AskNumeric("Tab width:", t)
    endif
    if Length(t)
        Set(TabWidth, Val(t))
    endif
end

/* ------------------------------------------------------------------------
 * SetPrintBotMargin
 * -----------------------------
 *
 * Sets the number of lines that are left blank at the bottom of each
 * page during printing. Either pass the print bottom margin you want or
 * a null string for the macro to prompt you.
 *
 * ------------------------------------------------------------------------
 */

proc mSetPrintBotMargin(string b_margin)
    string t[10] = b_margin
    if NOT Length(t)
        AskNumeric("Print bottom margin:", t)
    endif
    if Length(t)
        Set(PrintBotMargin, Val(t))
    endif
end

/* ------------------------------------------------------------------------
 * SetPrintTopMargin
 * -----------------------------
 * This command specifies the number of lines printed at the top of each
 * page before the text is printed.  Valid values are zero to 200.  If
 * the print page size is zero, the editor treats the document as one
 * page and the top margin is ignored for all pages except the first
 * printed page. Either pass the print top margin you want or a null
 * string for the macro to prompt you.
 *
 * ------------------------------------------------------------------------
 */

proc mSetPrintTopMargin(string t_margin)
    string t[10] = t_margin
    if NOT Length(t)
        AskNumeric("Print top margin:", t)
    endif
    if Length(t)
        Set(PrintTopMargin, Val(t))
    endif
end

/* ------------------------------------------------------------------------
 * SetPrintLeftMargin
 * -----------------------------
 * Sets the number of spaces that are printed as a left margin at the
 * beginning of each line.  The default is zero. Either pass the print
 * left margin you want or a null string for the macro to prompt you.
 * ------------------------------------------------------------------------
 */

proc mSetPrintLeftMargin(string l_margin)
    string t[10] = l_margin
    if NOT Length(t)
        AskNumeric("Print left margin:", t)
    endif
    if Length(t)
        Set(PrintLeftMargin, Val(t))
    endif
end

/* ------------------------------------------------------------------------
 * SetPrintPageSize
 * -----------------------------
 *
 * This command specifies the number of lines to be printed on each
 * page. Valid values are zero to 200.  A value of zero instructs TSE to
 * print continuously without page breaks. Either pass the print page
 * size you want or a null string for the macro to prompt you.
 *
 * ------------------------------------------------------------------------
 */

proc mSetPrintPageSize(string p_size)
    string t[10] = p_size
    if NOT Length(t)
        AskNumeric("Print page size:", t)
    endif
    if Length(t)
        Set(PrintPageSize, Val(t))
    endif
end

/* ------------------------------------------------------------------------
 * SetPrintLineSpacing
 * -----------------------------
 *
 * Allows the setting of the print line spacing, up to a value of 200.
 *
 * 1 = single-space, 2 = double-space, 3 = triple-space, etc.
 *
 * Either pass the print line spacing you want or a null string for
 * the macro to prompt you.
 *
 * ------------------------------------------------------------------------
 */

proc mSetPrintLineSpacing(string p_size)
    string t[10] = p_size
    if NOT Length(t)
        AskNumeric("Print line spacing:", t)
    endif
    if Length(t)
        Set(PrintLineSpacing, Val(t))
    endif
end

/* ------------------------------------------------------------------------
 * SetVarTabStops
 * -----------------------------
 *
 * Allows the setting of the tab stops used when Variable tab type is
 * selected. Either pass the tab stops you want or a null string for the
 * macro to prompt you.
 *
 * ------------------------------------------------------------------------
 */

proc mSetVarTabStops(string t_stops)
    string t[70] = t_stops
    if NOT Length(t)
        Ask("Tab stops:", t)
    endif
    if Length(t)
        Set(VarTabs, TabSet(t))
    endif
end

/* ------------------------------------------------------------------------
 * SaveSettings RestoreSettings
 * -----------------------------
 * SaveSettings: Saves the current settings of: Insert, AutoIndent,
 * WordWrap, Sound, and Screen Updating. See RestoreSettings.
 *
 * RestoreSettings: Restores settings saved by the SaveSettings command.
 * ------------------------------------------------------------------------
 */

integer QE_SaveIndent, QE_SaveInsert, QE_SaveWordWrap, QE_SaveSound

proc SaveQESettings()
    QE_SaveIndent   = Query(AutoIndent)
    QE_SaveInsert   = Query(Insert)
    QE_SaveWordWrap = Query(WordWrap)
    QE_SaveSound    = Query(Beep)
end

proc RestoreQESettings()
    Set(AutoIndent, QE_SaveIndent  )
    Set(Insert    , QE_SaveInsert  )
    Set(WordWrap  , QE_SaveWordWrap)
    Set(Beep      , QE_SaveSound   )
end

/* ------------------------------------------------------------------------
 * SetPrintDevice
 * -----------------------------
 * Allows the setting of the default print device.  Choices include PRN,
 * LPT1 through LPT3, or any valid DOS filename. Either pass the option
 * you want or a nothing for the macro to prompt you.
 *
 * The two macros in this section MUST be used together.
 * ------------------------------------------------------------------------
 */

proc mGetPrintDevice()
    string out[48] = ""
    if Ask("Printer Device Filename:", out) AND Length(out)
        Set(PrintDevice, out)
    endif
end

menu mSetPrintDevice()
    history
    "&PRN"          , Set(PrintDevice, "PRN")
    "LPT&1"         , Set(PrintDevice, "LPT1")
    "LPT&2"         , Set(PrintDevice, "LPT2")
    "LPT&3"         , Set(PrintDevice, "LPT3")
    "Disk &File"    , mGetPrintDevice()
end

/* ------------------------------------------------------------------------
 * SwapChars
 * -----------------------------
 *
 * Swaps the character at the cursor position with the character preceding
 * the cursor.  The cursor column position does not change.  If, when this
 * command is executed, the cursor is in cloumn 1, or is positioned beyond
 * the last non-blank character of the line, then no action occurs.
 *
 * ------------------------------------------------------------------------
 */

proc mSwapChars()
    if CurrChar() == _BEYOND_EOL_
        return()
    endif

    if Left()
        PushBlock()
        MarkColumn()
        MarkColumn()
        Right()
        CopyBlock()
        PopBlock()
    endif
end


/* ------------------------------------------------------------------------
 * SwapWords
 * -----------------------------
 *
 * Swaps the word in which the cursor is positioned with the previous
 * word on the current line.  Any "non-word" characters between the
 * affected words are preserved.  If, when this command is executed, the
 * cursor is not positioned on a character within a word, or if there is
 * no previous word on the current line, then no action occurs.
 *
 * KillWord() and mSwapWords() are REQUIRED for this macro to work.
 * ------------------------------------------------------------------------
 */

/***********************************************************************
    Kill the current word without going to the delete buffer
 ***********************************************************************/
proc KillWord()
    PushBlock()
    MarkWord()
    GotoBlockBegin()
    KillBlock()
    PopBlock()
end

/***********************************************************************
    Swap the current word with the previous word (if on same line)
 ***********************************************************************/
proc mSwapWords()
    string w1[50], w2[50]
    integer cl = CurrLine()

    PushBlock()
    if MarkWord()
        BegWord()
        w1 = GetMarkedText()
        if NOT (WordLeft() AND cl == CurrLine())
            WordRight()
        else
            if NOT MarkWord()
                WordRight()
            else
                w2 = GetMarkedText()
                KillWord()
                InsertText(w1, _INSERT_)
                WordRight()
                KillWord()
                InsertText(w2, _INSERT_)
                WordLeft()
            endif
        endif
    endif
    PopBlock()
end
