pyglet / pyglet

pyglet is a cross-platform windowing and multimedia library for Python, for developing games and other visually rich applications.
http://pyglet.org
BSD 3-Clause "New" or "Revised" License
1.78k stars 294 forks source link

Arrow keys don't jump to ends of mouse-created selections extending to either end #1074

Open pushfoo opened 2 months ago

pushfoo commented 2 months ago

Summary

TL;DR: If you click-drag to either end of a text input's contents in either direction, the opposite direction's arrow key won't jump & end the selection as expected.

It's unclear whether this is platform specific, but it's in the left / right arrow key selection response behavior as described in #932.

Selections created with shift + arrow keys work as expected.

EDIT: Discord discussion with @caffeinepills + further tests suggest the following may be happening:

  1. The cursor falls out of the text box's bounds
  2. The text box lose focus
  3. The selection is left in an indeterminate state
  4. The arrow keys fail to work as expected

Versions affected

Tip of master + anything after #1072

Platform info

Linux, Debian 11. Python 3.9.2 Gnome on Wayland with XWayland

Reproduction steps

Left Arrow Key

  1. Launch examples/gui/widgets.py
  2. Left-click anywhere before the end of the text
  3. Drag the cursor rightward to the very end, making sure to include the last character
  4. Release the left mouse button
  5. Press the left arrow key
  6. Observe:
    • The cursor has not moved
    • The selection has not been deselected

Right Arrow Key

  1. Launch examples/gui/widgets.py
  2. Left-click anywhere after the start of the text
  3. Drag to cursor the very start, making sure to include the first character
  4. Release the left mouse button
  5. Press the right arrow key
  6. Observe:
    • The cursor has not moved
    • The selection has not been deselected
sabadam32 commented 2 months ago

@pushfoo tried this on Windows 10 and did not see the issue