To trace the glitch, I added
fprintf(stderr, "%d %d\n", sel.alt, !!IS_SET(MODE_ALTSCREEN));
into the draw() function.
What happens:
1. Start st. Type something: both sel.alt and IS_SET(MODE_ALTSCREEN)
are 0.
2. Run "man man". MODE_ALTSCREEN is set to 1.
3. Press LMB. sel.alt is 0, MODE_ALTSCREEN is 1, selection is not
displayed because of the '(sel.alt != 0) ^ alt)' check.
4. Release mouse: sel.alt is set to 1, but selection is still not
displayed.
5. Select again: everything is ok.
After I quit "man", MODE_ALTSCREEN is set to 0 and the same thing
happens again, now sel.alt is 1. So selection is displayed only the
second time.
The problem is that sel.alt is set to IS_SET(MODE_ALTSCREEN) only when
selcopy is called, i.e. when mouse button is released. So I moved
"sel.alt = IS_SET(MODE_ALTSCREEN)" to getbuttoninfo.
Patch is attached.
I also made IS_SET always return 0 and 1 to make things simplier.
Received on Mon Dec 10 2012 - 15:15:29 CET