Skip to content

Added contextual yank commands: yl for closest link, yc for closest code snippet and y/Y for page lines. - #4937

Open
oarabilekoore wants to merge 2 commits into
philc:masterfrom
oarabilekoore:main
Open

Added contextual yank commands: yl for closest link, yc for closest code snippet and y/Y for page lines. #4937
oarabilekoore wants to merge 2 commits into
philc:masterfrom
oarabilekoore:main

Conversation

@oarabilekoore

Copy link
Copy Markdown

Hi, I am disclosing that I did use some AI for these feature additions. I used antigravity with Gemini 3.7 Flash.

Features Added

  • Added yankClosestLink (yl): Copies the URL of the link closest to the current mouse cursor
    position.
  • Added yankClosestCode (yc): Copies the code snippet closest to the mouse cursor (tailored for
    AI web apps like Gemini, Claude, and ChatGPT, as well as GitHub and documentation sites,
    automatically stripping toolbar copy buttons).
  • Added yankPageOrLines (y / Y / [count]y): Copies the readable contents of the whole page
    (via y or Y), or copies [count] lines of text starting below the mouse cursor (e.g. 5y).
  • Enhanced KeyHandlerMode and Commands.installKeyStateMapping to support multi-key sequences
    with overlapping prefix commands via a 500ms disambiguation timer.

Key Implementation Details

  • Multi-Key Disambiguation: Updated KeyHandlerMode and Commands.installKeyStateMapping to support single-key prefix commands (like y) alongside multi-key sequences (yl, yc, yy, yf, yt) via a 500ms disambiguation timer.
  • Mouse & Position Tracking: Lightweight passive pointer event listener computes geometric distance from cursor to candidate DOM elements.
  • Backward Compatible: All existing commands (yy, yf, yt, p, P) remain fully intact.

Testing

  • Automated Unit Tests: ./make.js test-unit (221/221 passing)
  • Automated Headless DOM Tests: ./make.js test-dom (113/113 passing)
  • Formatting and Lint: ./make.js check (clean, 0 errors)
  • Manual browser verification on Helium

…age/lines)

- Implement yl (yankClosestLink) to copy link closest to mouse cursor
- Implement yc (yankClosestCode) to copy code snippet closest to cursor (Gemini, Claude, ChatGPT, GitHub)
- Implement y/Y/[count]y (yankPageOrLines) to copy whole page or stated lines below cursor
- Enhance KeyHandlerMode and installKeyStateMapping to support prefix disambiguation with timeouts
- Add GETTING_STARTED.md developer and codebase architecture guide
- Update CHANGELOG.md and add comprehensive unit & DOM test suites

Generated at user request with AI assistance using Google's Gemini 3.7 Flash model.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant