home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 49
/
Amiga_Dream_49.iso
/
atari
/
texte
/
oribin.zoo
/
bindings
/
add_txt.fun
next >
Wrap
Text File
|
1991-07-09
|
1KB
|
44 lines
{{{ comments
; add to the text-integer 1, cursor-position is not restored!
; cursor must stand on the end of the positiv-integer.
; if there is no digit under the cursor, add_txt generates 1.
;
; example:
; ahkjsfghjadf23kajfdkjas
; ^
; |
; cursor
;
; will be changed to:
; ahkjsfghjadf24kajfdkjas
;
}}}
nodup
{{{ add_txt
(deffun add_txt (
case
{{{ 0..8 simple replacement of digit
(test-char "0 ( "1 ))
(test-char "1 ( "2 ))
(test-char "2 ( "3 ))
(test-char "3 ( "4 ))
(test-char "4 ( "5 ))
(test-char "5 ( "6 ))
(test-char "6 ( "7 ))
(test-char "7 ( "8 ))
(test-char "8 ( "9 ))
}}}
{{{ 9 -> 0 and recursion left of current position
(test-char "9 ( if test-begin-line ( " ) fi O_LEFT add_txt O_RIGHT "0 ))
}}}
{{{ no digit => insert 1
(test-char " ( O_DEL_CHAR_RIGHT "11 O_LEFT ))
(test-char ". ( "11 O_LEFT ))
default ( O_RIGHT "11 O_LEFT )
}}}
esac
O_DEL_CHAR_RIGHT
O_LEFT
))
}}}