home *** CD-ROM | disk | FTP | other *** search
/ Dream 49 / Amiga_Dream_49.iso / atari / texte / oribin.zoo / bindings / add_txt.fun next >
Text File  |  1991-07-09  |  1KB  |  44 lines

  1. {{{  comments
  2. ; add to the text-integer 1, cursor-position is not restored!
  3. ; cursor must stand on the end of the positiv-integer.
  4. ; if there is no digit under the cursor, add_txt generates 1.
  5. ;
  6. ; example:
  7. ;     ahkjsfghjadf23kajfdkjas
  8. ;                  ^
  9. ;                  |
  10. ;                cursor
  11. ;
  12. ; will be changed to:
  13. ;     ahkjsfghjadf24kajfdkjas
  14. ;
  15. }}}
  16. nodup
  17. {{{  add_txt
  18. (deffun add_txt (
  19.   case
  20.     {{{  0..8 simple replacement of digit
  21.     (test-char "0 ( "1 ))
  22.     (test-char "1 ( "2 ))
  23.     (test-char "2 ( "3 ))
  24.     (test-char "3 ( "4 ))
  25.     (test-char "4 ( "5 ))
  26.     (test-char "5 ( "6 ))
  27.     (test-char "6 ( "7 ))
  28.     (test-char "7 ( "8 ))
  29.     (test-char "8 ( "9 ))
  30.     }}}
  31.     {{{  9 -> 0 and recursion left of current position
  32.     (test-char "9 ( if test-begin-line ( "  ) fi O_LEFT add_txt O_RIGHT "0 ))
  33.     }}}
  34.     {{{  no digit => insert 1
  35.     (test-char "  ( O_DEL_CHAR_RIGHT "11 O_LEFT ))
  36.     (test-char ". ( "11 O_LEFT ))
  37.     default ( O_RIGHT "11 O_LEFT )
  38.     }}}
  39.   esac
  40.   O_DEL_CHAR_RIGHT
  41.   O_LEFT
  42. ))
  43. }}}
  44.