muhhiminminmin / mintty

Automatically exported from code.google.com/p/mintty
GNU General Public License v3.0
0 stars 0 forks source link

Left edge of mouse selection too easily extends to previous character #305

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. set the font to Fixedsys Regular 9 pt or Courier New Regular 11 pt (but most 
probably any font will do)
2. make mintty write some text (e.g.: ls)
3. start a mouse selection by clicking on a left-edge pixel of any average 
sized character except the leftmost of a line, and drag to the right.

What is the expected output? What do you see instead?

The selection should start from the character that was clicked initially. 
Instead, it starts from the character to the left of the clicked one.
More in general, the selection should include a character only if it includes 
the center of the character.
For sure it should not include a character it doesn't touch at all.

What versions of mintty, Cygwin/MSYS, and Windows are you using?

Mintty 1.0.2, Cygwin 1.7.9-1, Windows 7 and Vista

Please provide any additional information below.

Depending on font and glyph, even starting from the second column of pixels of 
a character may cause inclusion of the character to the left.

Original issue reported on code.google.com by waltertr...@gmail.com on 24 Nov 2011 at 4:44

GoogleCodeExporter commented 8 years ago
I have tested it and while I do not have the impression that a character gets 
selected without touching it at all, I agree that people attempting to select 
"the whole character" place the cursor on its edge or "between the characters" 
which makes it likely to actually touch the neighbor and get it selected.
So I would support your proposal that 1 half of pixel width should be covered 
to get the character include.
Likewise vertically, line catching sensitivity should be reduced by a few 
pixels, especially as the cursor is of quite long height. My proposal here 
would be that counting from the cursor center, 1/3 (or 1/4) of the pixel height 
should be covered to get the line included. Maybe some fine tuning would be 
good (or even an option...?).

Original comment by towom...@googlemail.com on 25 Nov 2011 at 4:07

GoogleCodeExporter commented 8 years ago
Thank you for looking into this!
I mistakenly have added Vista to the Windows versions that have the full 
problem. Now that I'm back home I realize that in Vista "untouched characters 
are not included", while in W.7 they are (checked on 3 systems). Nonetheless, 
even on Vista mouse selection is somewhat problematic (like you described), 
which is the reason why I thought that the problem was the same.

Original comment by waltertr...@gmail.com on 25 Nov 2011 at 11:25

GoogleCodeExporter commented 8 years ago
Surprised (a little bit) that behaviour depends on the Windows version, I 
should add I tested on Windows XP.

Original comment by towom...@googlemail.com on 26 Nov 2011 at 2:18

GoogleCodeExporter commented 8 years ago
I can reproduce this on Windows 7 too, and not on XP. Haven't tried Vista. So I 
had a closer look and found (somewhat incredulously) that it's a problem with 
Windows 7's default text selection cursor: it appears two pixels to the right 
of where it's supposed to be.

This means that when mintty is told that the mouse is at X coordinate 0, i.e. 
the leftmost pixel inside the window frame, the text selection cursor actually 
appears a couple of pixels further inside the window. This can be seen when 
moving the mouse towards the left window frame, where it changes to the resize 
cursor before it even reaches the frame, whereas on the right hand side one can 
move the selection cursor a couple of pixels onto the window frame before it 
changes.

This doesn't just happen in mintty, but across Windows. For example, it can be 
seen when moving the mouse into a Notepad window. Furthermore, when selecting 
text in GUI programs, characters aren't actually included when the cursor hits 
their centre, but again a couple of pixels to the right of that.

The problem goes away if one chooses a different mouse pointer scheme (e.g. 
"Windows Black") or just a different text selection cursor in the Mouse control 
panel.

Therefore I'm rejecting this as "Not a mintty issue".

Regarding the touched-it-selected-it approach, the Windows console, PuTTY, 
xterm, and rxvt(-unicode) all do that to, so I don't accept that that's a 
defect. Do enter an enhancement issue for it though if you feel strongly enough 
about it.

Original comment by andy.koppe on 26 Nov 2011 at 8:23

GoogleCodeExporter commented 8 years ago
Agreed: not a mintty issue.

For people who cannot wait for Microsoft to fix the bugs of Windows 7:

mintty can be recompiled changing "x - PADDING" to "x + 2 - PADDING" in 
function translate_pos(), file wininput.c

Andy, regarding the touched-it-selected-it approach: gnome-terminal and 
konsole, but also Eclipse, NetBeans, Notepad++, even Notepad, all agree with 
you in the Y direction only, while in the X direction the character's "center" 
is what makes it belong or not to the selection. Furthermore mintty lacks the 
immediate feedback for the left edge of the selection (in the typical case of a 
drag to the right), since the selection is not shown before it includes 2 
characters.

I'm not sure I will enter the enhancement issue, though, since judging from the 
source code this would be quite a complex rewrite.

Anyhow: thank you!

Original comment by waltertr...@gmail.com on 27 Nov 2011 at 3:11

GoogleCodeExporter commented 8 years ago
replaced by issue 307

Original comment by waltertr...@gmail.com on 15 Dec 2011 at 2:23

GoogleCodeExporter commented 8 years ago
I've entered issue 308 for converting to the GUI-style selection approach. 
Also, in r1244 on the 1.0 branch, I've made it possible to select a single 
character without touching a second character first.

Original comment by andy.koppe on 19 Dec 2011 at 6:27

GoogleCodeExporter commented 8 years ago
I reverted r1244 on the 1.0 branch, as it caused unintended selection of single 
characters, particularly when clicking into a mintty window to activate it. 
I'll try again on trunk.

Original comment by andy.koppe on 23 Dec 2011 at 6:09