microsoft / microsoft/terminal

Mouse cannot select text with pyautogui

Open
#16,268 5 comments 0 reactions 0 assignees View on GitHub
Area-UserInterface Issue-Bug Priority-3 Product-Terminal
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

### Windows Terminal version

1.17.11461.0

### Windows build number

10.0.19045.3570

### Other Software

python 3.10, pyautogui 0.9.5 (The exact versions doesn't matter actually)

### Steps to reproduce

Install the pyautogui library (The version doesn't matter).
Execute the following code and you have 3 seconds to switch to the terminal and position the cursor on any text.
```
from time import sleep

import pyautogui
from pyautogui import Point

sleep(3)
pyautogui.click()
pyautogui.mouseDown(button='left')
for i in range(50):
position: Point = pyautogui.position()
pyautogui.moveTo(position.x + 4, position.y)
pyautogui.mouseUp(button='left')
```

### Expected Behavior

The text where the cursor is positioned starts to be selected towards the right.
FYI : I tested that code on other terminals like classic windows terminal, Git Bash and WSL2 and the problem doesn't occur.

### Actual Behavior

The cursor is positioned at the right place and progress to the right as expected but no selection happens.
![ezgif-1-639c7a0728](https://github.com/microsoft/terminal/assets/15986712/8cc1a893-dc52-46b8-86eb-6526e8cd7435)

Contributor guide

Open the contributing guide

Research direction

Start with the supplied Python and pyautogui reproduction on the reported Windows Terminal and Windows build, then compare its behavior with classic Windows Terminal, Git Bash, and WSL2 as described. Trace the terminal's mouse-drag handling to determine why automated movement does not select text; done means the reproduction selects text toward the right without regressing normal mouse selection.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.