Skip to content

feat(macos): 添加编辑器按行号跳转对话框 - #349

Closed
Wz58luck wants to merge 6 commits into
1lck:previewfrom
Wz58luck:feat/editor-go-to-line-v2
Closed

feat(macos): 添加编辑器按行号跳转对话框#349
Wz58luck wants to merge 6 commits into
1lck:previewfrom
Wz58luck:feat/editor-go-to-line-v2

Conversation

@Wz58luck

@Wz58luckWz58luck commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Closes#341

基于 #346feat/editor-find-replace)构建,合并前本 PR 的 diff 会包含该 PR 的内容(约 +1,092/−109);本功能本身的 diff 是 0314740e 之后的 4 个提交(19 个文件,+523/−13)。

概述

新增 "Go to Line:Column" 按行号跳转对话框——经典 IDE 风格的小型模态浮窗:单个 [Line] [:column]: 输入位,打开时预填当前光标的 1-based 位置并全选,附 Cancel / OK 按钮。

  • 三个鼠标可达入口(issue 明确要求):Navigate 菜单、编辑器右键菜单、状态栏的行:列指示(改为 plain 样式按钮,视觉保持不变)。无活动文档时禁用或为无操作。
  • Cmd+L 已注册进命令目录(go-to-line),可在 设置 → Keymap 中修改。
  • 输入:支持 120120:35,容忍空格;非法输入时 OK 按钮置灰,Return 不会跳转。越界行号收敛到最后一行,越界列号收敛到行尾(按 UTF-16 单元计),空文档只定位到文档开头。
  • 跳转行为:复用 navigateToEditorLocation——自动打开文档、进入导航历史(Cmd+[ 可回到跳转前的位置),并通过新增的 selectsWholeLine 标志整行选中目标行(默认 false,既有的符号/查找导航保持零长度光标不变)。
  • 主题:对话框应用与工作台窗口相同的 AppThemePreference 外观,在 system / light / dark 模式下都与编辑器保持一致。
  • 互斥:打开对话框会先关闭查找栏,反之亦然,逻辑收敛在 EditorChromeModel

测试

image

- Add FindInFileOptions/FindInFileMatcher with Match Case, Whole Words,
and Regular Expression matching aligned with project search semantics
- Extend FindBarView with an options menu, expandable replace row
(Replace / Replace All), and invalid-regex error state
- Replace-next routes through insertText for standard undo; replace-all
commits via shouldChangeText + textStorage as a single undo step
- Register replace-in-file (Cmd+R) in the command catalog, action
registry, Navigate menu, Keymap settings, and zh-Hans localization
Closes1lck#327
- Unify replacement template docs and comments on $n numeric capture
groups; ${name} named-group templates are not expanded by the current
SDK and return verbatim
- Bind replace notifications to the active document: notifications now
carry documentID and CodeTextView ignores mismatched targets so split
editors never replace the wrong file
- Recompute matches across the whole document for regex queries where
matches can span lines; keep the line-window incremental path for
single-line literal queries
- Add regression tests for cross-line regex matches and notification
document gating
Add three mouse-reachable entries for jumping to a line: the Navigate
menu, the editor context menu, and the status bar caret label, all
opening a shared go-to-line bar styled after the find bar. Input
accepts 1-based line or line:column, converges out-of-range values
against the live document, selects the target line through the
existing editorNavigationTarget pathway (now carrying
selectsWholeLine), and records navigation history so Cmd+[ returns
to the departure position. The bar and the find bar are mutually
exclusive; Cmd+L is registered in the command catalog and remappable
in Keymap settings.
Swap the in-editor go-to-line bar for a small modal "Go to Line:Column"
window: a single [Line] [:column]: input prefilled with the caret's
1-based position and fully selected, with Cancel/OK buttons. Return
and OK jump through the same parser and navigation pathway, invalid
input disables OK, and Esc, Cancel, or the close button dismiss
without side effects. Every entry point (Navigate menu, editor
context menu, status bar caret label, Cmd+L) funnels through the
chrome visibility flag via a shared presenter, so the workbench and
standalone editor windows both stay covered. Also unify all
go-to-line comments to English to match the surrounding files.
The dialog panel fell back to the system appearance and rendered light
inside a dark-themed editor. Apply the same AppThemePreference window
appearance the workbench windows use, so the dialog matches the editor
theme in system, light, and dark modes. Widen the private
AppThemePreference.windowAppearance helper for reuse.
…og count
The Simplified Chinese localization test requires every command catalog
entry to carry translated title and subtitle strings, and the keyboard
shortcut test pins the catalog size. Cover the new go-to-line command
and bump the expected count to 33.
@Wz58luck
Wz58luck requested a review from 1lck as a code ownerAugust 30, 2026 06:25
@Wz58luck

Copy link
Copy Markdown
ContributorAuthor

已取消:按约定改为基于上游最新 preview 分支重建(不包含 #346 内容)。

Sign up for freeto 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

@Wz58luck