[comp.lang.pascal] TV Editor Bug?

rind@popvax.uucp (747707@d.rind) (02/08/91)

I realize that not all the TP people have yet gotten 6.0, but I have
a Turbovision question.  They supply an editor object (demonstrated in
TVEDIT.PAS in the TVDEMOS directory) which won't allow me to type
using the keys 3 4 5 6 or the shifts of those keys # $ % ^.  Their demo
has the same problem as my program.  The Turbo Editor in the IDE has no
problem with those keys.  Any ideas as to what's going on.  Can someone
else confirm this problem? (It occurred for me on 2 different PC's with
different keyboards.)


David Rind
rind@popvax.harvard.edu

bb16@prism.gatech.EDU (Scott Bostater) (02/09/91)

In article <5648@husc6.harvard.edu> rind@popvax.uucp (747707@d.rind) writes:
>I realize that not all the TP people have yet gotten 6.0, but I have
>a Turbovision question.  They supply an editor object (demonstrated in
>TVEDIT.PAS in the TVDEMOS directory) which won't allow me to type
>using the keys 3 4 5 6 or the shifts of those keys # $ % ^.  Their demo
>has the same problem as my program.  The Turbo Editor in the IDE has no
>problem with those keys.  Any ideas as to what's going on.  Can someone
>else confirm this problem? (It occurred for me on 2 different PC's with
>different keyboards.)

Yes, it happens on my machine as well.   I traced down the bug to the procedure
ScanKeyMap.  The problem was the scan code for a 3 is $0433 but was getting
set to a Ctrl-Ins (kbCtrlIns = $0400). The code was checking only the high
byte of the scan code. The fix is one line in the Editors.Pas source code
(see below)

------------------  Fix to ScanKeyMap  --------------------------------------

function ScanKeyMap(KeyMap: Pointer; KeyCode: Word): Word; assembler;
asm
	PUSH	DS
	LDS	SI,KeyMap
	MOV	DX,KeyCode
	CLD
	LODSW
	MOV	CX,AX
@@1:	LODSW
	MOV	BX,AX
	LODSW
	OR	BL,BL
	JE	@@2
	CMP	BL,DL
	JNE	@@3
	OR	BH,BH
	JE	@@4
@@2:	CMP	BX,DX          { this is the line, had been: cmp bh,dh }
	JE	@@4
@@3:	LOOP	@@1
	XOR	AX,AX
@@4:	POP	DS
end;

-----------------------  End of Code  ----------------------------------------

This fixed the problem for me.  Note: I'm not positive if the pascal style
comments work with the inline assembler or whether you need TASM style 
comments.  I put it in after I tested the code to highlight the changed line.

the code to highlight the a
-- 
Scott Bostater      Georgia Tech Research Institute - Radar Systems Analysis
"My soul finds rest in God alone; my salvation comes from Him"  -Ps 62.1
uucp:     ...!{allegra,amd,hplabs,ut-ngp}!gatech!prism!bb16
Internet: bb16@prism.gatech.edu

oneel@heawk1.gsfc.nasa.gov ( Bruce Oneel ) (02/09/91)

In <5648@husc6.harvard.edu> rind@popvax.uucp (747707@d.rind) writes:

>I realize that not all the TP people have yet gotten 6.0, but I have
>a Turbovision question.  They supply an editor object (demonstrated in
>TVEDIT.PAS in the TVDEMOS directory) which won't allow me to type
>using the keys 3 4 5 6 or the shifts of those keys # $ % ^.  Their demo
>has the same problem as my program.  The Turbo Editor in the IDE has no
>problem with those keys.  Any ideas as to what's going on.  Can someone
>else confirm this problem? (It occurred for me on 2 different PC's with
>different keyboards.)


>David Rind
>rind@popvax.harvard.edu

Turns out this is a known bug.  Borland has a patch on compuserve.  Off 
hand, don't they give you the source for TVEDIT?  If they do, you might
be able to fix it on your own.

This is a very obvious bug.  It does look like some of the final QC 
was rushed.

bruce

--
| Bruce O'Neel              | internet : oneel@heasfs.gsfc.nasa.gov|
| Code 664/ST               |     span : lheavx::oneel             |
| NASA/GSFC                 |compuserve: 72737,1315                |
| Greenbelt  MD 20771       |  AT&Tnet : (301)-286-1119            |

rind@popvax.uucp (747707@d.rind) (02/09/91)

Sorry to follow up my own article, but I got in touch with Borland via
Compuserve, and this is a known bug and they have a patch available.

David Rind
rind@popvax.harvard.edu