GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — fix: テーブル境界の巨大キャレット修正と gap cursor 導入 (#146, #167) by ymnao · Pull Request #168 · ymnao/scripta Conversation
Owner
概要テーブル右余白クリックで widget 全高の巨大キャレットが表示されるバグ(#146)を修正し、レビュー過程で判明した「カーソル配置だけで文書が変わり dirty になる」trade-off を gap cursor パターン(ProseMirror gapcursor 相当、#167)の導入で解消する。 関連 Issue移行 Stage該当なし(Live Preview のバグ修正・改善)
変更内容
動作確認
スクリーンショットなし(gap cursor バーの見た目は実機確認時に併せて確認) 🤖 Generated with Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions- ignoreEvent でセル外クリックを CM に委譲していたのをウィジェット側で 消費するよう変更し、CM がカーソルをウィジェット境界に置くのを防止 - handleCellMouseDown でセル外クリック時にフォーカスセルを明示的に blur - tableCursorFilter をテーブル先頭境界 (from) にも対応させ、 DOC 先頭にテーブルがある場合は改行を補填して退避 Co-Authored-By: Claude Opus 4.6 <[email protected]> - tableCursorFilter の先頭境界(from)退避 3 ケースを unit テストで担保 (前行末尾への退避 / DOC 先頭テーブルの改行補填 / 再入防止) - テーブル右余白クリックの巨大キャレット防止とセル blur を e2e で担保 (修正前コードで巨大キャレットテストが fail することを確認済み) Co-Authored-By: Claude Fable 5 <[email protected]> /simplify レビュー(4 agents)の適用: - ignoreEvent のセル外クリック全消費を撤回し delegation を復元。 真の修正は filter の先頭境界対応のみで足りることを e2e で実証 (CM の atomicRanges は境界 position を素通しし、クリック由来の selection も必ず transactionFilter を通るため)。これにより テーブル右余白がクリック・デッドゾーンにならず、隣接行に カーソルが置ける - handleCellMouseDown の手動 blur を削除(CM の focus 移動で自然に blur) - exitTableDown の EOF 改行補填を filter に委譲し、直下行確保の 不変条件の二重実装を解消。exitTableUp には filter 依存の相互参照 コメントを追加 - prepend/append 改行変数を boolean 化(挿入位置は 0 / doc.length の 定数なので number | null は偽の自由度) - e2e を openSingleFileWorkspace ヘルパーへ移行し、クリック座標・ activeElement 判定の重複を抽出。カーソルが実際に置かれることの 検証も追加(デッドゾーン回帰防止) Co-Authored-By: Claude Fable 5 <[email protected]> - 先頭への改行挿入は後続の全 selection 座標を +1 ずらすため、prepend の 有無を ranges.map の前に確定し、末尾退避先・未修正カーソル・非空 range すべてにシフトを織り込む(sequential selection は extra.changes 適用後の 座標で書く必要がある) - multi-cursor の回帰テスト 2 件を追加(修正前に 1-off で fail することを 確認済み。本番は basicSetup 既定で allowMultipleSelections 有効) - BOF 補填の trade-off(selection のみの操作で dirty になる)と左上セル ArrowUp 閉じ込め維持(#90)の設計判断をコメントに明文化 Co-Authored-By: Claude Fable 5 <[email protected]> ProseMirror gapcursor 相当のパターンで「selection を置くだけで文書が変わり dirty になる」trade-off を解消する: - tableCursorFilter: 文書先頭/末尾の境界(退避先の行が無い)を gap として 許容し、文書を変えずに留まれるようにする。中間境界の退避は維持 - tableGapMaterialize: gap への挿入(typing / paste)に改行を補い、入力が テーブルの Markdown 行に食い込むのを防ぐ。挿入自身が反対側の端で改行 している場合(Enter / 改行終わりペースト)は分離済みなので補わない - tableGapImeKeydown: IME は composition 開始後の文書変更が Chromium で composition を壊すため、keydown(229) の時点で空行を先行 materialize - tableGapCursorLayer: gap 滞在中はテーブル直上/直下に水平バーを描画。 drawSelection の巨大キャレットは .cm-table-gap-active + baseTheme より specificity を上げた CSS で抑制 - 左上セルからの ArrowUp / セル先頭 ArrowLeft は BOF gap へ抜ける形に変更 (#90 の閉じ込めは補填による改変回避が理由だったため、gap 導入で前提が 消えた。ArrowDown 側と対称になる) - テーブル直下の最後の空行が Backspace で消せるようになる(旧設計は filter が改行を補い直すため実質消せなかった) materialize(補った改行 + 入力)は 1 undo 単位。実機での日本語 IME 確認は 別途必要。 Co-Authored-By: Claude Fable 5 <[email protected]> 4 観点(reuse / simplification / efficiency / altitude)の指摘を適用: - tableGapMaterialize を [tr, extra] の追加 spec 返却に変更。spec 丸ごと 再構築による annotations(addToHistory 等)の脱落と effects の座標 シフト漏れが構造的に消え、約 25 行減 - materialize 内の BOF/EOF 判定ループを gapAt の呼び出しに置換 (decoration 走査の 3 重実装を解消) - inserted.toString()(rope 平坦化)を gap 端への挿入と確定してから呼ぶ 形に変更(テーブルで終わる文書での中間編集や大型 paste で、変形しない 挿入テキストの全平坦化が走っていた) - transactionFilter は登録の逆順に適用される事実に合わせ、配列順を [cursorFilter, materialize] に修正(実行順 materialize → cursorFilter。 gap 入力初回の tr.state 強制評価が書き換えで捨てられる無駄を解消)。 旧コメントは適用順を逆に説明していた - exitTableUp の手動退避計算(startLinePos - 1)を exitTableDown と対称の filter 委譲に統一 - gapAt に文書端の早期 return を追加(全 update で呼ばれるパスの無駄な decoration 走査を除去) - gap cursor layer の座標計算を RectangleMarker.forRange からの導出に変更 (getBase 相当の手動複製と RTL 分岐の欠落を解消) - 巨大キャレット抑制 CSS を specificity 競争(6 クラス)から display: none \!important に変更(upstream の baseTheme セレクタ構造への 暗黙結合を解消、.cm-selectionBackground と同じ手法) - keydown 229 採用理由のコメント補強(CM6 自身が composition 判定に使用) - e2e の openTableFile に content 引数を追加し BOF/EOF テストの重複を解消 Co-Authored-By: Claude Fable 5 <[email protected]> 文書先頭/末尾がテーブルのとき、セルを編集していても anchorEditorToTable (undo 復元先確保)が CM selection をテーブル先頭境界に置くため、selection だけを見る gap 判定が真になり続け、gap cursor バーと .cm-table-gap-active が出ていた。 - セルの focusin / focusout を setCellFocusEffect として CM に流し込み、 tableCellFocusField で追跡。gap 描画(layer / editorAttributes)は field が true の間抑制する - 描画時に document.activeElement を直接読む案は、エディタ未フォーカスから セルを直接クリックした場合に CM の update が起きず再評価されないため不採用 (field の JSDoc に明記) - focusout は既存 handleFocusOut の rAF 確認に統合し、view destroy 後の dispatch を isConnected で防御 - unit 2 件 + e2e 1 件(レビュー再現手順: セルクリックでバー 0 個 → ArrowUp×2 で gap へ抜けると 1 個復活)を追加 実装: Claude Opus 4.6 subagent / 設計・レビュー: Fable 5 Co-Authored-By: Claude Fable 5 <[email protected]> レビューは「gap cursor 上での貼り付け」として報告されたが、調査の結果 gap 固有ではなく通常行でも再現する一般バグだった。コンテキストメニューの 貼り付けが selection を明示せず dispatch しており、挿入位置ちょうどの カーソルは CM デフォルト(assoc=-1)で挿入前に留まる。 - pasteItem の dispatch に selection(貼り付けテキスト直後)と userEvent: "input.paste" を明示。BOF/EOF gap では tr.selection の存在が tableGapMaterialize の selection マップ経路を有効にし、補った改行の 手前へカーソルが進む - tableGapMaterialize の JSDoc に「changes-only dispatch は CM デフォルト に従う / UI 経路は selection を明示する」契約を追記 - e2e: 通常行の右クリック貼り付け(修正前は XPASTED になり fail)と、 BOF gap への Cmd+V 貼り付け(右クリックは handleEditorContextMenu が クリック位置へカーソルを移すため gap 検証は native paste 経路で行う) 実装: Claude Opus 4.6 subagent / 調査・設計・レビュー: Fable 5 Co-Authored-By: Claude Fable 5 <[email protected]> There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsUh oh!
There was an error while loading. Please reload this page.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reviewers
Copilot code review
Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Uh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. テーブル境界に gap cursor を導入し、配置時の自動改行補填を入力時に行う テーブル右側の余白クリックで左端に巨大キャレットが表示されるUh oh!
There was an error while loading. Please reload this page. 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. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |