What could cause a non-blinking image of a caret to appear on the line below?
Assume this is the line ¦with the real, blinking caret
And this is the line be¦low.
(imagine they line up and don't occupy spaces)
This occurs only when I switch from an underline caret to a line caret, and only if there is not already a phantom caret just below the real one - if there is, it disappears.
Of course, the phantoms disappear when the line is repainted, but repainting lines that should not have changed without understanding the necessity is something I'd like to avoid.
This is the code I use to manipulate carets:
In the initialization:
crecar:
bts [flge], 3 ;caret exists
bt [flge], 5 ;strikeover mode
jc @F
mov BY [csrtyp], 18 ;CurSoRTYPe
xor edx, edx
inc edx
jmp crecar_e
@@:
mov BY [csrtyp], 2
mov edx, [cszh] ;Cursor SiZe Horizontal
crecar_e:
invoke CreateCaret, hwnd, 0, edx, 2
invoke SetCaretBlinkTime, 100
retn
To change type or position:
;; EINS, CRM
eins: ;Toggle caret type
xor BY [csrtyp], 2 xor 18
btc [flge], 5
jc @F
mov edx, [cszh]
invoke CreateCaret, hwnd, 0, edx, 2
jmp eins_e
@@:
invoke CreateCaret, hwnd, 0, 1, 14
eins_e:
invoke ShowCaret, hwnd
retn
crm: ;Caret move
push edx
movzx eax, [crposh]
mul BY [cszh]
mov edx, eax
mov al, [crposv]
mul BY [cszv]
sub eax, [csrtyp]
invoke SetCaretPos, edx, eax
bts [flge], 4
jc crm_end
invoke ShowCaret, hwnd
crm_end:
pop edx
retn
The variables not explained are set elsewhere, and I'm pretty sure they're not causing the problem.
cszh DD ? ;Char cell SiZe Horizontal
cszv DD ? ;Char cell SiZe Vertical
csrtyp DD 18 ;flip 2 <-> 18 0000 0010 0001 1000
crposv DB 0 ;CuRsor POSition Vertical - line - 0..24
DB 3 DUP (0)
cphdw LABEL DWORD ;dword version of crposh
crposh DB 0 ;CuRsor POSition Horiz - column - 0..4F
DB 3 DUP (0)
flge DW 20 ;FLaG - Edit-input
; 7 6 5 4 3 2 1 0
; seb caplk stkvr csrsh csrex in edit rfsh in input
; caplock on cursorshow on rfsh ??
; strikeover mode on
I would greatly appreciate any suggestions or thoughts.
BTS: Are you sure you don't mean BT, Bit Test?
Quote from: jj2007 on April 28, 2008, 07:20:21 AM
BTS: Are you sure you don't mean BT, Bit Test?
Yes. In each case the purpose is to set the flag. The caret is going to exist, [flge], 3 or be shown, [flge], 4, after the next few lines of code.
Incidently, the flge chart didn't copy correctly. It should be:
flge DW 20 ;FLaG - Edit-input
; 7 6 5 4 3 2 1 0
; seb caplk stkvr csrsh csrex in edit rfsh in input
raleeper,
> What could cause a non-blinking image of a caret to appear on the line below?
Its usually a screen update issue, I have seen the effect the most in web browwers.
It's just a repaint thing.. The old caret isn't erased before the new one is moved and drawn. It seems to happen at random in various programs.
If it's happening specifically when changing the caret shape or position, try hiding the caret first, then changing it, and show again. I don't know if that will give enough chance for it to be erased though, so you may need to force a repaint (at least of the line containing the 'old' caret.)
Quote from: Tedd on April 28, 2008, 10:51:25 AM
It's just a repaint thing.. The old caret isn't erased before the new one is moved and drawn. It seems to happen at random in various programs.
If it's happening specifically when changing the caret shape or position, try hiding the caret first, then changing it, and show again. I don't know if that will give enough chance for it to be erased though, so you may need to force a repaint (at least of the line containing the 'old' caret.)
Thanks. I'll try that.
But just to clarify, this is not a matter of on old caret persisting; it's a new non-blinking line caret popping up on the line just below the real, blinking one.
Later - Neither HideCaret nor DestroyCaret has any discernible effect; the phantom still appears.
Okay, that's even more strange :bdg
Want to post a slimmed-down version of your code that still does it? - then we can have a poke :wink
Quote from: raleeper on April 28, 2008, 01:35:53 AM
This occurs only when I switch from an underline caret to a line caret, and only if there is not already a phantom caret just below the real one - if there is, it disappears.
Are you bitblitting something with one of the DSTINVERT etc modes?