fix(vcs): the inline blame label can be made not clickable (#3810)

The inline blame label was always a button that swallowed its events, so a click past the end of a line could open the commit instead of placing the caret. A new setting, vcs.git.inlineBlameClickable (Settings › Version Control › Git, on by default), makes the label plain text when off: no role, tab stop or handlers, and its events go to the editor. The uncommitted-changes label, which has no commit to open, now hands its events to the editor too. Open editors update without another git blame.

Closes #3802

Co-authored-by: bertyhell <[email protected]>
Цей коміт міститься в:
Bert Verhelstтаbertyhell authored and GitHub committed 2026-11-17 02:27:28 +08:00
1 джерело 3f3ad03d7c
коміт 245679cef8
12 files changed
+127 -9

No files matched your search

+1
Переглянути файл
@@ -90,6 +90,7 @@ export const CLIENT_SETTINGS_KEYS = [
"externalDiff",
"vcs.showDirtyDirectories",
"vcs.git.inlineBlame",
"vcs.git.inlineBlameClickable",
"vcs.git.showBranchInProjectView",
"vcs.git.showPushDialog",
"vcs.git.pushDialogOnlyProtected",
+2 -1
Переглянути файл
@@ -2293,5 +2293,6 @@
"Choose Directory Archive…": "Choose Directory Archive…",
"This is a MySQL dump: restore it into a MySQL data source.": "This is a MySQL dump: restore it into a MySQL data source.",
"This is a pg_dump archive: restore it with pg_restore.": "This is a pg_dump archive: restore it with pg_restore.",
"This is a plain SQL dump: restore it with psql.": "This is a plain SQL dump: restore it with psql."
"This is a plain SQL dump: restore it with psql.": "This is a plain SQL dump: restore it with psql.",
"Open the commit when the inline blame is clicked": "Open the commit when the inline blame is clicked"
}
+2 -1
Переглянути файл
@@ -8678,5 +8678,6 @@
"Choose Directory Archive…": "选择目录归档…",
"This is a MySQL dump: restore it into a MySQL data source.": "这是 MySQL 转储:请恢复到 MySQL 数据源。",
"This is a pg_dump archive: restore it with pg_restore.": "这是 pg_dump 归档:请使用 pg_restore 恢复。",
"This is a plain SQL dump: restore it with psql.": "这是纯 SQL 转储:请使用 psql 恢复。"
"This is a plain SQL dump: restore it with psql.": "这是纯 SQL 转储:请使用 psql 恢复。",
"Open the commit when the inline blame is clicked": "点击内联 Git Blame 时打开提交"
}
+8
Переглянути файл
@@ -9,6 +9,14 @@ describe("validateWorkflow", () => {
expect(validateWorkflow({ vcs: { git: { inlineBlame: "true" } } }).vcs.git.inlineBlame).toBe(false);
});
it("keeps the inline blame label clickable unless switched off", () => {
const clickable = (inlineBlameClickable: unknown) =>
validateWorkflow({ vcs: { git: { inlineBlameClickable } } }).vcs.git.inlineBlameClickable;
expect(DEFAULT_WORKFLOW.vcs.git.inlineBlameClickable).toBe(true);
expect(clickable(false)).toBe(false);
expect(clickable("no")).toBe(true);
});
it("keeps the double-click choice unset until it is made", () => {
expect(DEFAULT_WORKFLOW.vcs.commit.doubleClickOpensDiff).toBeNull();
expect(validateWorkflow(undefined).vcs.commit.doubleClickOpensDiff).toBeNull();
+3
Переглянути файл
@@ -19,6 +19,7 @@ export interface IssueLinkValid {
export interface GitSettingsValid {
inlineBlame: boolean;
inlineBlameClickable: boolean;
showBranchInProjectView: boolean;
executable: string;
updateMethod: UpdateMethod;
@@ -234,6 +235,7 @@ export const DEFAULT_WORKFLOW: WorkflowSettings = {
historyLimit: 1000,
git: {
inlineBlame: false,
inlineBlameClickable: true,
showBranchInProjectView: false,
executable: "",
updateMethod: "merge",
@@ -391,6 +393,7 @@ export function validateVcs(raw: unknown): VcsSettingsValid {
historyLimit: num(v.historyLimit, d.historyLimit, L.historyLimit, true),
git: {
inlineBlame: bool(g.inlineBlame, d.git.inlineBlame),
inlineBlameClickable: bool(g.inlineBlameClickable, d.git.inlineBlameClickable),
showBranchInProjectView: bool(g.showBranchInProjectView, d.git.showBranchInProjectView),
executable: text(g.executable, d.git.executable).trim(),
updateMethod: oneOf(g.updateMethod, ["merge", "rebase"] as const, d.git.updateMethod),