feat(input): move physical cursor to visual cursor for IME input (#4652)

* feat(input): add useCursor hook for IME physical cursor tracking

* refactor(input): optimize cursor positioning effect

* feat(input): move setCursorPosition to render phase for immediate cursor positioning

* fix(input): calculate absolute cursor position by walking yoga tree

* fix(input): use addLayoutListener instead of useCursor for zero-jitter cursor positioning

* perf(input): stable addLayoutListener subscription and skip redundant cursor updates

* fix(input): revert lastPos dedup that broke cursorDirty one-shot flag

* feat(input): use patch-package to expose Ink internals for IME cursor positioning

* fix(input): address review feedback — prefixWidth, remove useBoxMetrics, pin ink version

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>

---------

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
This commit is contained in:
yao 2026-06-03 09:45:59 +08:00 committed by GitHub
parent 7ee37277de
commit 77458ad21f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 335 additions and 9 deletions

22
patches/ink+7.0.3.patch Normal file
View file

@ -0,0 +1,22 @@
diff --git a/node_modules/ink/package.json b/node_modules/ink/package.json
--- a/node_modules/ink/package.json
+++ b/node_modules/ink/package.json
@@ -11,8 +11,16 @@
},
"type": "module",
"exports": {
- "types": "./build/index.d.ts",
- "default": "./build/index.js"
+ ".": {
+ "types": "./build/index.d.ts",
+ "default": "./build/index.js"
+ },
+ "./dom": {
+ "default": "./build/dom.js"
+ },
+ "./components/CursorContext": {
+ "default": "./build/components/CursorContext.js"
+ }
},
"engines": {
"node": ">=22"