Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
複製onto分享in copy-first readsTesting
C:\GitHub\linedesktopnvda\.uv-cache-local\archive-v0\gE_Qq9Tk3Gs40iaFLYhBc\Scripts\pytest.exe tests/test_message_context_menu.py tests/test_line_resource_guards.pyGreptile Summary
此 PR 解決了 LINE 桌面版訊息右鍵選單中,OCR 定位因短訊息「雜訊行」(如訊息字數標記 "50")干擾而導致
複製被誤定位至分享按鈕的 bug。主要變更:
_collectPopupMenuRowRects(line.py):透過 UIA Raw View Walker 遍歷彈出視窗的 UIA 樹,蒐集各行的精確邊界矩形(row rects),以幾何位置替代原本的 OCR 索引映射。_resolvePopupMenuLabelClickPoint(line.py):以_buildMenuElements建立元素後,依標籤名稱查找對應的clickPoint,回傳含clickPoint、index、count的結果物件。_buildMenuElements、_normalizeMenuRowRects、_assignRowRectsToElements(messageContextMenu.py):將 OCR 識別到的選單標籤與 row rects 幾何對齊,優先以 OCR 行中心 Y 最近距離原則(distance-minimizing)分配 row rect,並在 row rects 不足時提供多層 fallback。MessageContextMenu.__init__與複製優先讀取路徑(_findCopyMenuItem)及訊息選單動作路徑均已更新,以popupRowRects=...傳入 row rects。test_build_menu_elements_ignores_noise_lines_before_copy_row)、行解析(test_resolve_popup_menu_label_click_point_returns_aligned_click_target)與選單點擊邏輯均有迴歸測試。Confidence Score: 5/5
_assignRowRectsToElements的「保留剩餘元素所需位置」公式maxRowIndex = totalRows - remainingElements可防止越界,且在 row rects 不足時優雅降級至 OCR 衍生座標。測試案例直接驗證雜訊行過濾、click point 對齊及回呼路徑。Important Files Changed
_collectPopupMenuRowRects、_resolvePopupMenuLabelClickPoint,並在三個選單觸發路徑中正確傳入popupRowRects;邏輯清晰,防禦性處理完善。_buildMenuElements、_normalizeMenuRowRects、_assignRowRectsToElements;主路徑以距離最近原則對齊 row rects,fallback 在 row rects 不足時降級至 OCR 衍生座標,行為一致且正確。test_build_menu_elements_ignores_noise_lines_before_copy_row),直接驗證主路徑的 click point 對齊行為。test_resolve_popup_menu_label_click_point_returns_aligned_click_target以 mock 驗證 row rects 正確傳遞至_buildMenuElements;現有資源守護測試未受影響。Sequence Diagram
sequenceDiagram participant LPY as line.py participant CRPR as _collectPopupMenuRowRects participant RPMLCP as _resolvePopupMenuLabelClickPoint participant MCM as messageContextMenu._buildMenuElements participant ARRE as _assignRowRectsToElements LPY->>CRPR: popupHwnd, popupRectTuple CRPR-->>LPY: popupRowRects (UIA row geometry list) LPY->>RPMLCP: targetLabel, ocrLines, popupRect, popupRowRects RPMLCP->>MCM: "lines, popupRect, rowRects=popupRowRects" MCM->>MCM: filter noise lines via _matchMenuLabel MCM->>ARRE: elements (with _lineCenterY), rowRects ARRE-->>MCM: clickPoints assigned via nearest-row heuristic MCM-->>RPMLCP: elements list (name + clickPoint) RPMLCP-->>LPY: "{clickPoint, index, count} for targetLabel" LPY->>LPY: send mouse click to clickPointReviews (1): Last reviewed commit: "Fix popup OCR menu alignment for LINE me..." | Re-trigger Greptile