/* * SWAP_CHARS.THE -- transpose two characters * * Transpose the cursor character with the character just preceding, * and move right: * * teh quick --> the quick * ^ ^ * * At the end of a line, transpose the positions of the last two * characters on the line * * teh --> the * ^ ^ * * *stking@bway.net */ if (inprefix() | first()) then exit 1 'extract /field/insertmode/' cfield = field.1 len_text = length(cfield) rh_char_col = field.3 if rh_char_col > len_text+2 then exit 2 if after() then do 'cursor left' rh_char_col = rh_char_col-1 end rh_char = substr(cfield, rh_char_col, 1) 'set insertmode 'on 'sos delchar' 'cursor left' 'text 'rh_char if ( \after() | (field.3() < len_text+1) ) then 'cursor right' 'set insertmode 'insertmode.1 exit 0