home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / eeedit22.zip / enhanced.zip / SwapChar.plg < prev    next >
Text File  |  2001-04-15  |  820b  |  20 lines

  1. /***********************************/
  2. /* Swap characters on each side of */
  3. /* the current cursor postion      */
  4. /***********************************/
  5. /* Get selection range Target (MLE) */
  6. PARSE VALUE VpGetIndex(window,Target) with First Last
  7.  
  8. if First=Last then do
  9.   /* Get text in range Target (MLE) */
  10.   SelectedText = VpGetItemValue(window,Target,First-1,First+1)
  11.   LastChar=right(SelectedText,1)
  12.   FirstChar=left(SelectedText,1)
  13.   SelectedText=LastChar||FirstChar
  14.   /* Select a range the Target (MLE) */
  15.   CALL VpSelect window,Target,First-1,First+1
  16.   /* Add item at current location Target (MLE) */
  17.   CALL VpAddItem window, Target, 'CURRENT', SelectedText
  18. end
  19. else response=VpMessageBox(window,'SwapChar Notice','Please place the cursor between the two chars you wish to swap and try again.')
  20.