Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse cannot select text with pyautogui #16268

Open
ebundy opened this issue Nov 6, 2023 · 5 comments
Open

Mouse cannot select text with pyautogui #16268

ebundy opened this issue Nov 6, 2023 · 5 comments
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Terminal The new Windows Terminal.
Milestone

Comments

@ebundy
Copy link

ebundy commented Nov 6, 2023

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

@ebundy ebundy added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Nov 6, 2023
@zadjii-msft
Copy link
Member

Here's possibly a dumb question - does it work if the Terminal isn't running as admin1/? There's typically quite a few protections in place (by Windows itself) that prevent unelevated apps from sending input to elevated ones

Footnotes

  1. Or, the inverse: is pycharm (or whatever's running your pyautogui script) running as admin?

@ebundy
Copy link
Author

ebundy commented Nov 6, 2023

I checked and none of the two applications (Terminal and Pycharm) are running in admin.
I tried to run in admin both and the behavior is the same.
As stated previously, I notice the expected behavior with the classic Windows terminal, Git Bash terminal and WSL2 terminal and that is true in the exact same execution context (no admin running), so I assume that the problem is specific to the (modern) Microsoft Terminal implementation.
If some additional information could be helpful, please tell me what, I would like my best to provide it.
Note : I also tried with the most recent preview build (Microsoft.WindowsTerminalPreview_1.19.2831) but unfortunately the issue persists.

@zadjii-msft
Copy link
Member

image
That little shield icon means either:

  • the Terminal thinks you're running it as admin
  • You have UAC disabled entirely

@ebundy
Copy link
Author

ebundy commented Nov 7, 2023

EDIT :
I managed to run the two applications in non-administrator and the problem persists.
ezgif-2-e8f99b381c

ORIGINAL:
Good point.
I checked the state of the process and it turns out that the process is running as administrator (elevated column in process explorer). Wichis surprising because I didn't execute it as an administrator.
I also checked my UAC, indeed they were disabled entirely. I re-enabled them (intermediary level) and I restarted my computer.
Now Windows Terminal asks me a permission because "the application can do some modification on my computer." If I validate the opening, the problem remains. The application is still executed as an administrator. If I don't the application is not opened.
I tried the hints provided by users in this issue (#13197) but it seems to be not working in my case like for some others.
I also tried to run the program as a regular user with this syntax but it seems to be not acceptable for the terminal :
wt.exe /runas. I have a Windows error saying that /runas is a not valid argument for wt.exe.

Did you have other ideas on how I may fix it?

@carlos-zamora carlos-zamora added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Product-Terminal The new Windows Terminal. Priority-3 A description (P3) and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Nov 8, 2023
@carlos-zamora carlos-zamora added this to the Backlog milestone Nov 8, 2023
@yg-i
Copy link

yg-i commented Jun 5, 2024

I maybe experiencing the same issue as @ebundy

@ebundy:

  • when you hover your mouse over the '+' (new tab) and 'x' (close tab) buttons in the tab bar at the top (not: the close/maximize/minimize buttons in the top right corner), do those buttons change color?
  • When you click them, do tabs get closed/opened?
  • When you right click in the blank areas of the tab, does a context menu show up?

For me the answer is 'no' to all the above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

4 participants