Aleksej R. Serdyukov
2003-12-19 19:11:56 UTC
████ OS/2 ||*()*|| All.
Что заставляет при удалении Del'ом символа из середины (предварительно вводим
строку) изменяться остальные символы?
'$DYNAMIC
defint a-z
declare sub LoadFile()
declare sub Redraw()
declare sub InsChar(CharNum&)
declare sub DelChar()
declare sub SetFChar(FCharPos&, CharNum&)
declare function FChar&(Charnum&)
dim shared FCharArray(500, 500), CurFChar as long, CursorPos as long,_
CharCount as long
screen 12
locate ,,1
do while not ink$=chr$(27)
ink$=inkey$
select case ink$
case chr$(0)+"K" 'left
if CursorPos>1 then CursorPos=CursorPos-1: Redraw
case chr$(0)+"M" 'right
if CursorPos<CharCount then CursorPos=CursorPos+1: Redraw
case chr$(0)+"S" 'Del
DelChar
Redraw
' case chr$(0)+"P" 'down
case ""
case else
InsChar(asc(left$(ink$,1)))
Redraw
end select
loop
0280
sub LoadFile
end sub
0310
sub Redraw
'TEMPORARY=================================================
cls
for CurFChar=1 to CharCount
if CurFChar=CursorPos then color 3 else color 7
print chr$(FChar(CurFChar));
next
end sub
0400
function FChar(CharNum&)
FChar=FCharArray(CharNum&\500, CharNum& mod 500)
end function
sub InsChar(CharNum&)
for CurFChar=CharCount to CursorPos step -1
call SetFChar(CurFChar+1, FChar(CurFChar))
next
call SetFChar(CursorPos, CharNum&)
CharCount=CharCount+1
CursorPos=CursorPos+1
end sub
sub DelChar
for CurFChar=CursorPos to CharCount-1
call SetFChar(CurFChar, FChar(CurFChar)+1)
next
CharCount=CharCount-1
end sub
sub SetFChar(FCharPos&, CharNum&)
FCharArray(FCharPos&\500, FCharPos& mod 500)=CharNum&
end sub
xDel:That's all! WBR, Deleter.
Что заставляет при удалении Del'ом символа из середины (предварительно вводим
строку) изменяться остальные символы?
'$DYNAMIC
defint a-z
declare sub LoadFile()
declare sub Redraw()
declare sub InsChar(CharNum&)
declare sub DelChar()
declare sub SetFChar(FCharPos&, CharNum&)
declare function FChar&(Charnum&)
dim shared FCharArray(500, 500), CurFChar as long, CursorPos as long,_
CharCount as long
screen 12
locate ,,1
do while not ink$=chr$(27)
ink$=inkey$
select case ink$
case chr$(0)+"K" 'left
if CursorPos>1 then CursorPos=CursorPos-1: Redraw
case chr$(0)+"M" 'right
if CursorPos<CharCount then CursorPos=CursorPos+1: Redraw
case chr$(0)+"S" 'Del
DelChar
Redraw
' case chr$(0)+"P" 'down
case ""
case else
InsChar(asc(left$(ink$,1)))
Redraw
end select
loop
0280
sub LoadFile
end sub
0310
sub Redraw
'TEMPORARY=================================================
cls
for CurFChar=1 to CharCount
if CurFChar=CursorPos then color 3 else color 7
print chr$(FChar(CurFChar));
next
end sub
0400
function FChar(CharNum&)
FChar=FCharArray(CharNum&\500, CharNum& mod 500)
end function
sub InsChar(CharNum&)
for CurFChar=CharCount to CursorPos step -1
call SetFChar(CurFChar+1, FChar(CurFChar))
next
call SetFChar(CursorPos, CharNum&)
CharCount=CharCount+1
CursorPos=CursorPos+1
end sub
sub DelChar
for CurFChar=CursorPos to CharCount-1
call SetFChar(CurFChar, FChar(CurFChar)+1)
next
CharCount=CharCount-1
end sub
sub SetFChar(FCharPos&, CharNum&)
FCharArray(FCharPos&\500, FCharPos& mod 500)=CharNum&
end sub
xDel:That's all! WBR, Deleter.