RangeFromPoint and ExpandToEnclosingUnit freezes terminal #21977

Closed
opened 2026-01-31 07:59:50 +00:00 by claunia · 0 comments
Owner

Originally created by @michaelmesser on GitHub (Jul 18, 2024).

Originally assigned to: @carlos-zamora on GitHub.

Windows Terminal version

1.20.11781.0

Windows build number

10.0.22631.0

Other Software

https://github.com/yinkaisheng/Python-UIAutomation-for-Windows 2.0.19

Steps to reproduce

import uiautomation as auto
import time
import typing
time.sleep(5)
[x,y] = auto.GetCursorPos()
c = auto.ControlFromPoint(x,y)
if text_pattern := typing.cast(auto.TextPattern | None, c.GetPattern(auto.PatternId.TextPattern)):
    if r := text_pattern.RangeFromPoint(x,y):
        r.ExpandToEnclosingUnit(auto.TextUnit.Word)
        print(r.GetText())

Put the cursor over a terminal window

Expected Behavior

I get the word under the cursor.

Actual Behavior

Windows terminals freezes. This program works fine with other software so I don't think the bug is in UIAutomation.

Originally created by @michaelmesser on GitHub (Jul 18, 2024). Originally assigned to: @carlos-zamora on GitHub. ### Windows Terminal version 1.20.11781.0 ### Windows build number 10.0.22631.0 ### Other Software https://github.com/yinkaisheng/Python-UIAutomation-for-Windows 2.0.19 ### Steps to reproduce ```python import uiautomation as auto import time import typing time.sleep(5) [x,y] = auto.GetCursorPos() c = auto.ControlFromPoint(x,y) if text_pattern := typing.cast(auto.TextPattern | None, c.GetPattern(auto.PatternId.TextPattern)): if r := text_pattern.RangeFromPoint(x,y): r.ExpandToEnclosingUnit(auto.TextUnit.Word) print(r.GetText()) ``` Put the cursor over a terminal window ### Expected Behavior I get the word under the cursor. ### Actual Behavior Windows terminals freezes. This program works fine with other software so I don't think the bug is in UIAutomation.
claunia added the Issue-BugIn-PRNeeds-Tag-FixProduct-TerminalArea-Accessibility labels 2026-01-31 07:59:50 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21977