дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 17:21:13 +02:00
feat(editor): Increase / Decrease Font Size in All Editors actions (#6350)
Adds Increase / Decrease Font Size in All Editors actions that change the editor font size setting for every open editor, next to the existing single-editor zoom actions. The default keymaps bind Alt+Shift+. / Alt+Shift+, (Ctrl+Shift+. / Ctrl+Shift+, on macOS) to the All Editors actions; the single-editor actions stay available from Find Action and can be bound in Keymap settings. Docs and keymap tests updated. Closes #6349 Co-authored-by: mansur-akhmadi <[email protected]>
Цей коміт міститься в:
1 джерело
df07073886
коміт
9b63aa9526
24 files changed
+213
-54
No files matched your search
@@ -152,8 +152,8 @@ With tabs placed left or right, the tab column is as wide as its longest name, u
|
||||
|
||||
| Action | macOS | Windows / Linux |
|
||||
| ------------------------------------- | ----- | --------------- |
|
||||
| **Increase Font Size** | `⌥⇧.` | `Alt+Shift+.` |
|
||||
| **Decrease Font Size** | `⌥⇧,` | `Alt+Shift+,` |
|
||||
| **Increase Font Size in All Editors** | `⌃⇧.` | `Alt+Shift+.` |
|
||||
| **Decrease Font Size in All Editors** | `⌃⇧,` | `Alt+Shift+,` |
|
||||
| **Scroll to Center** | `⌃L` | `Ctrl+M` |
|
||||
| **Scroll Up** | — | `Ctrl+Up` |
|
||||
| **Scroll Down** | — | `Ctrl+Down` |
|
||||
@@ -169,7 +169,7 @@ With tabs placed left or right, the tab column is as wide as its longest name, u
|
||||
**Scroll Up** and **Scroll Down** move the view by one line and leave the caret where it is, even when it scrolls out of sight; **Scroll Left** and **Scroll Right** do the same sideways, by one column. **Scroll Up and Move if Necessary** and **Scroll Down and Move if Necessary** also move the view by one line, but bring a caret the view doesn't show to its first or last line. **Move Up and Scroll** and **Move Down and Scroll** move the caret one line and the view with it, so the caret stays in the same place on screen; their **with Selection** variants select as they go. **Scroll to Top** and **Scroll to Bottom** show the start and the end of the file; the caret stays where it is too. They have no default shortcut: run them from Find Action or assign one in **Settings › Keymap**.
|
||||
|
||||
- **View › Active Editor › Soft-Wrap** wraps long lines in the current editor. To wrap some file types by default, use **Settings › Editor › General**, section **Soft Wraps**.
|
||||
- **View › Reset Font Size** undoes font zoom in the active editor or focused surface (**View › Reset Font Size in All Editors** resets every open editor). Changing the font size with `⌘` / `Ctrl` + mouse wheel (scoped to **Active editor** by default, or **All editors**) can be turned on in **Settings › Editor › General**, section **Mouse Control**.
|
||||
- **View › Reset Font Size** undoes font zoom in the active editor or focused surface (**View › Reset Font Size in All Editors** resets every open editor). **Increase Font Size in All Editors** and **Decrease Font Size in All Editors** resize every open editor together, starting from the active one, and have no default shortcut. Changing the font size with `⌘` / `Ctrl` + mouse wheel (scoped to **Active editor** by default, or **All editors**) can be turned on in **Settings › Editor › General**, section **Mouse Control**.
|
||||
- **View › Appearance › Enter Distraction Free Mode** hides tool windows, tabs, the status bar and the gutter and centres the text. Run the same command again to leave.
|
||||
- **View › Appearance › Enter Zen Mode** turns on Distraction Free Mode and full screen together; **Exit Zen Mode** turns both off.
|
||||
- **Show Line Numbers**, **Show Indent Guides**, **Show Sticky Lines** and **Show Whitespaces** turn these on or off in every editor. Run them from Find Action, or right-click the gutter and open **Appearance**.
|
||||
|
||||
@@ -64,7 +64,7 @@ To create a theme or icon theme, see [Themes](/en/plugins/guides/themes) and [Ic
|
||||
- **Enable ligatures** for fonts with programming ligatures.
|
||||
- **Typography Settings**: **Main font weight**, **Bold font weight**, and a **Fallback font** for characters the main font lacks.
|
||||
|
||||
To change the size temporarily in the active editor, use **Increase Font Size** (`⌥⇧.` / `Alt+Shift+.`) and **Decrease Font Size** (`⌥⇧,` / `Alt+Shift+,`); **View › Reset Font Size** (or **View › Reset Font Size in All Editors**) goes back. In **Settings › Editor › General**, **Change font size with Ctrl/Command+Mouse Wheel** enables wheel zoom for the **Active editor** (default) or **All editors**.
|
||||
To change the size temporarily, use **Increase Font Size in All Editors** (`⌃⇧.` / `Alt+Shift+.`) and **Decrease Font Size in All Editors** (`⌃⇧,` / `Alt+Shift+,`), or **Increase Font Size** / **Decrease Font Size** from Find Action for the active editor only; **View › Reset Font Size** (or **View › Reset Font Size in All Editors**) goes back. In **Settings › Editor › General**, **Change font size with Ctrl/Command+Mouse Wheel** enables wheel zoom for the **Active editor** (default) or **All editors**.
|
||||
|
||||
### UI font and zoom
|
||||
|
||||
|
||||
@@ -188,19 +188,19 @@ Some shortcuts depend on where the focus is. For example `⌘N` / `Alt+Insert` i
|
||||
|
||||
## Files, tabs and view
|
||||
|
||||
| Action | macOS | Windows / Linux |
|
||||
| -------------------- | ------------ | ----------------------- |
|
||||
| Settings… | `⌘,` | `Ctrl+Alt+S` |
|
||||
| Project Structure… | `⌘;` | `Ctrl+Alt+Shift+S` |
|
||||
| Save All | `⌘S` | `Ctrl+S` |
|
||||
| New Scratch File… | `⇧⌘N` | `Ctrl+Alt+Shift+Insert` |
|
||||
| Close Tab | `⌘W` | `Ctrl+F4` |
|
||||
| Select Next Tab | `⌃→` / `⇧⌘]` | `Alt+Right` |
|
||||
| Select Previous Tab | `⌃←` / `⇧⌘[` | `Alt+Left` |
|
||||
| Quick Switch Scheme… | `` ⌃` `` | `` Ctrl+` `` |
|
||||
| Zoom In IDE | `⌃⌥=` | `Alt+Shift+=` |
|
||||
| Zoom Out IDE | `⌃⌥-` | `Alt+Shift+-` |
|
||||
| Reset IDE Zoom | `⌃⌥0` | `Alt+Shift+0` |
|
||||
| Increase Font Size | `⌥⇧.` | `Alt+Shift+.` |
|
||||
| Decrease Font Size | `⌥⇧,` | `Alt+Shift+,` |
|
||||
| Toggle Full Screen | `⌃⌘F` | — |
|
||||
| Action | macOS | Windows / Linux |
|
||||
| --------------------------------- | ------------ | ----------------------- |
|
||||
| Settings… | `⌘,` | `Ctrl+Alt+S` |
|
||||
| Project Structure… | `⌘;` | `Ctrl+Alt+Shift+S` |
|
||||
| Save All | `⌘S` | `Ctrl+S` |
|
||||
| New Scratch File… | `⇧⌘N` | `Ctrl+Alt+Shift+Insert` |
|
||||
| Close Tab | `⌘W` | `Ctrl+F4` |
|
||||
| Select Next Tab | `⌃→` / `⇧⌘]` | `Alt+Right` |
|
||||
| Select Previous Tab | `⌃←` / `⇧⌘[` | `Alt+Left` |
|
||||
| Quick Switch Scheme… | `` ⌃` `` | `` Ctrl+` `` |
|
||||
| Zoom In IDE | `⌃⌥=` | `Alt+Shift+=` |
|
||||
| Zoom Out IDE | `⌃⌥-` | `Alt+Shift+-` |
|
||||
| Reset IDE Zoom | `⌃⌥0` | `Alt+Shift+0` |
|
||||
| Increase Font Size in All Editors | `⌃⇧.` | `Alt+Shift+.` |
|
||||
| Decrease Font Size in All Editors | `⌃⇧,` | `Alt+Shift+,` |
|
||||
| Toggle Full Screen | `⌃⌘F` | — |
|
||||
@@ -150,8 +150,8 @@ description: "多光标与选区、行编辑、剪贴板历史、代码折叠、
|
||||
|
||||
| 操作 | macOS | Windows / Linux |
|
||||
| ------------------------------ | ----- | --------------- |
|
||||
| **增大字体** | `⌥⇧.` | `Alt+Shift+.` |
|
||||
| **减小字体** | `⌥⇧,` | `Alt+Shift+,` |
|
||||
| **增大所有编辑器中的字体** | `⌃⇧.` | `Alt+Shift+.` |
|
||||
| **减小所有编辑器中的字体** | `⌃⇧,` | `Alt+Shift+,` |
|
||||
| **滚动到中央** | `⌃L` | `Ctrl+M` |
|
||||
| **向上滚动** | — | `Ctrl+Up` |
|
||||
| **向下滚动** | — | `Ctrl+Down` |
|
||||
@@ -167,7 +167,7 @@ description: "多光标与选区、行编辑、剪贴板历史、代码折叠、
|
||||
**向上滚动** 和 **向下滚动** 把视图移动一行,光标保持原位,即使它因此移出可见区域;**向左滚动** 和 **向右滚动** 以同样方式横向移动一列。**向上滚动并在必要时移动光标** 和 **向下滚动并在必要时移动光标** 同样把视图移动一行,但会把不在视图中的光标移到视图的第一行或最后一行。**向上移动并滚动** 和 **向下移动并滚动** 把光标移动一行,视图随之滚动同样的距离,光标在屏幕上的位置保持不变;对应的 **并选择** 版本边移动边选择。**滚动到顶部** 和 **滚动到底部** 显示文件的开头和结尾;光标同样保持原位。它们默认没有快捷键:在查找操作中运行,或在 **设置 › 按键映射** 中指定。
|
||||
|
||||
- **视图 › 活动编辑器 › 软换行** 让当前编辑器的长行自动折行。想让某些文件类型默认软换行,在 **设置 › 编辑器 › 常规** 的 **软换行** 一节中设置。
|
||||
- **视图 › 重置字体大小** 撤销当前编辑器或焦点区域的字体缩放(**视图 › 重置所有编辑器中的字体大小** 会重置所有打开的编辑器)。用 `⌘` / `Ctrl` + 鼠标滚轮调整字号的功能默认关闭,可在 **设置 › 编辑器 › 常规** 的 **鼠标控制** 一节中打开,并可选择作用于 **当前编辑器**(默认)或 **所有编辑器**。
|
||||
- **视图 › 重置字体大小** 撤销当前编辑器或焦点区域的字体缩放(**视图 › 重置所有编辑器中的字体大小** 会重置所有打开的编辑器)。**增大所有编辑器中的字体** 和 **减小所有编辑器中的字体** 以当前编辑器为起点同时调整所有打开的编辑器,默认没有快捷键。用 `⌘` / `Ctrl` + 鼠标滚轮调整字号的功能默认关闭,可在 **设置 › 编辑器 › 常规** 的 **鼠标控制** 一节中打开,并可选择作用于 **当前编辑器**(默认)或 **所有编辑器**。
|
||||
- **视图 › 外观 › 进入无干扰模式** 隐藏工具窗口、标签页、状态栏和装订区域,并让正文居中。再执行一次即可退出。
|
||||
- **视图 › 外观 › 进入 Zen 模式** 同时开启无干扰模式和全屏;**退出 Zen 模式** 同时关闭两者。
|
||||
- **显示行号**、**显示缩进参考线**、**显示粘滞行** 和 **显示空白** 在所有编辑器中打开或关闭对应显示。可从查找操作运行,或右键单击装订区域并打开 **外观**。
|
||||
|
||||
@@ -64,7 +64,7 @@ OpenIDEA 会把主题(以及其中附带的编辑器配色方案)转换为
|
||||
- **启用连字**:用于带编程连字的字体。
|
||||
- **排版设置**:**主字重**、**粗体字重**,以及主字体缺少字符时使用的 **备用字体**。
|
||||
|
||||
在当前编辑器中临时调整字号可以用 **增大字体**(`⌥⇧.` / `Alt+Shift+.`)和 **减小字体**(`⌥⇧,` / `Alt+Shift+,`),用 **视图 › 重置字体大小**(或 **视图 › 重置所有编辑器中的字体大小**)恢复。在 **设置 › 编辑器 › 常规** 中开启 **使用 Ctrl/Command+鼠标滚轮更改字体大小** 后可以用滚轮缩放,并可选择作用于 **当前编辑器**(默认)或 **所有编辑器**。
|
||||
临时调整字号可以用 **增大所有编辑器中的字体**(`⌃⇧.` / `Alt+Shift+.`)和 **减小所有编辑器中的字体**(`⌃⇧,` / `Alt+Shift+,`),只调当前编辑器可在查找操作中运行 **增大字体** / **减小字体**;用 **视图 › 重置字体大小**(或 **视图 › 重置所有编辑器中的字体大小**)恢复。在 **设置 › 编辑器 › 常规** 中开启 **使用 Ctrl/Command+鼠标滚轮更改字体大小** 后可以用滚轮缩放,并可选择作用于 **当前编辑器**(默认)或 **所有编辑器**。
|
||||
|
||||
### 界面字体与缩放
|
||||
|
||||
|
||||
@@ -188,19 +188,19 @@ macOS 符号:`⌘` Command、`⌥` Option、`⌃` Control、`⇧` Shift、`↵
|
||||
|
||||
## 文件、标签页与视图
|
||||
|
||||
| 操作 | macOS | Windows / Linux |
|
||||
| ---------------- | ------------ | ----------------------- |
|
||||
| 设置… | `⌘,` | `Ctrl+Alt+S` |
|
||||
| 项目结构… | `⌘;` | `Ctrl+Alt+Shift+S` |
|
||||
| 全部保存 | `⌘S` | `Ctrl+S` |
|
||||
| 新建临时文件… | `⇧⌘N` | `Ctrl+Alt+Shift+Insert` |
|
||||
| 关闭标签页 | `⌘W` | `Ctrl+F4` |
|
||||
| 选择下一个标签页 | `⌃→` / `⇧⌘]` | `Alt+Right` |
|
||||
| 选择上一个标签页 | `⌃←` / `⇧⌘[` | `Alt+Left` |
|
||||
| 快速切换方案… | `` ⌃` `` | `` Ctrl+` `` |
|
||||
| 放大 IDE | `⌃⌥=` | `Alt+Shift+=` |
|
||||
| 缩小 IDE | `⌃⌥-` | `Alt+Shift+-` |
|
||||
| 重置 IDE 缩放 | `⌃⌥0` | `Alt+Shift+0` |
|
||||
| 增大字体 | `⌥⇧.` | `Alt+Shift+.` |
|
||||
| 减小字体 | `⌥⇧,` | `Alt+Shift+,` |
|
||||
| 切换全屏 | `⌃⌘F` | — |
|
||||
| 操作 | macOS | Windows / Linux |
|
||||
| ---------------------- | ------------ | ----------------------- |
|
||||
| 设置… | `⌘,` | `Ctrl+Alt+S` |
|
||||
| 项目结构… | `⌘;` | `Ctrl+Alt+Shift+S` |
|
||||
| 全部保存 | `⌘S` | `Ctrl+S` |
|
||||
| 新建临时文件… | `⇧⌘N` | `Ctrl+Alt+Shift+Insert` |
|
||||
| 关闭标签页 | `⌘W` | `Ctrl+F4` |
|
||||
| 选择下一个标签页 | `⌃→` / `⇧⌘]` | `Alt+Right` |
|
||||
| 选择上一个标签页 | `⌃←` / `⇧⌘[` | `Alt+Left` |
|
||||
| 快速切换方案… | `` ⌃` `` | `` Ctrl+` `` |
|
||||
| 放大 IDE | `⌃⌥=` | `Alt+Shift+=` |
|
||||
| 缩小 IDE | `⌃⌥-` | `Alt+Shift+-` |
|
||||
| 重置 IDE 缩放 | `⌃⌥0` | `Alt+Shift+0` |
|
||||
| 增大所有编辑器中的字体 | `⌃⇧.` | `Alt+Shift+.` |
|
||||
| 减小所有编辑器中的字体 | `⌃⇧,` | `Alt+Shift+,` |
|
||||
| 切换全屏 | `⌃⌘F` | — |
|
||||
@@ -127,6 +127,7 @@ import {
|
||||
resetAllEditorsFontZoom,
|
||||
resetConfiguredEditorsFontZoom,
|
||||
stepConfiguredEditorsFontZoom,
|
||||
stepEveryEditorFontZoom,
|
||||
} from "./cm/prefs";
|
||||
import { useProject } from "@/platform/project";
|
||||
import { call, commands } from "@/platform/ipc";
|
||||
@@ -1369,6 +1370,22 @@ export function registerEditorActions(): () => void {
|
||||
when: "projectOpen",
|
||||
run: resetAllFontSize,
|
||||
},
|
||||
{
|
||||
id: "editor.increaseFontSizeAll",
|
||||
title: "Increase Font Size in All Editors",
|
||||
category: "View",
|
||||
keywords: ["zoom", "font size"],
|
||||
when: "projectOpen",
|
||||
run: () => stepEveryEditorFontZoom(focusedCellEditor() ?? activeSlot()?.view ?? null, 1),
|
||||
},
|
||||
{
|
||||
id: "editor.decreaseFontSizeAll",
|
||||
title: "Decrease Font Size in All Editors",
|
||||
category: "View",
|
||||
keywords: ["zoom", "font size"],
|
||||
when: "projectOpen",
|
||||
run: () => stepEveryEditorFontZoom(focusedCellEditor() ?? activeSlot()?.view ?? null, -1),
|
||||
},
|
||||
{
|
||||
id: "editor.increaseFontSize",
|
||||
title: "Increase Font Size",
|
||||
|
||||
@@ -475,10 +475,15 @@ export function stepAllEditorsFontZoom(origin: EditorView, delta: number): void
|
||||
if (current === undefined) return;
|
||||
const next = Math.max(-6, Math.min(36, current + delta));
|
||||
if (next === current) return;
|
||||
sharedFontZoom = next;
|
||||
setEveryEditorFontZoom(next);
|
||||
}
|
||||
|
||||
/** Sets the font zoom of every open editor, and the value new editors start from. */
|
||||
function setEveryEditorFontZoom(zoom: number): void {
|
||||
sharedFontZoom = zoom;
|
||||
for (const ed of useEditorRegistry.getState().editors) {
|
||||
if (ed.view.state.field(fontZoom, false) === undefined) continue;
|
||||
if (ed.view.state.field(fontZoom) !== next) ed.view.dispatch({ effects: setFontZoom.of(next) });
|
||||
if (ed.view.state.field(fontZoom) !== zoom) ed.view.dispatch({ effects: setFontZoom.of(zoom) });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,6 +508,29 @@ export function stepConfiguredEditorsFontZoom(origin: EditorView, delta: number)
|
||||
const before = origin.state.field(fontZoom, false);
|
||||
if (editorPrefs().general.wheelZoomScope === "all") stepAllEditorsFontZoom(origin, delta);
|
||||
else stepFontZoom(origin, delta);
|
||||
showFontZoom(origin, before);
|
||||
}
|
||||
|
||||
/**
|
||||
* Increase / Decrease Font Size in All Editors: sets every open editor, whatever `wheelZoomScope`
|
||||
* says, to `origin`'s zoom stepped by `delta`, or to the zoom new editors start with stepped by
|
||||
* `delta` when `origin` has none.
|
||||
*/
|
||||
export function stepEveryEditorFontZoom(origin: EditorView | null, delta: number): void {
|
||||
const before = origin?.state.field(fontZoom, false);
|
||||
const next = Math.max(-6, Math.min(36, (before ?? sharedFontZoom) + delta));
|
||||
// A notebook cell is not in the registry.
|
||||
if (before !== undefined && before !== next) origin!.dispatch({ effects: setFontZoom.of(next) });
|
||||
setEveryEditorFontZoom(next);
|
||||
if (origin && before !== undefined && fontZoomListeners.has(origin)) showFontZoom(origin, before);
|
||||
else {
|
||||
activeFontZoomListener?.(null);
|
||||
activeFontZoomListener = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/** Shows `origin`'s zoom in its indicator after a step from `before`, hiding the one shown elsewhere. */
|
||||
function showFontZoom(origin: EditorView, before: number | undefined): void {
|
||||
const zoom = origin.state.field(fontZoom, false);
|
||||
const listener = fontZoomListeners.get(origin);
|
||||
if (zoom === undefined || zoom === before || !listener) return;
|
||||
|
||||
@@ -3,7 +3,13 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { act, cleanup, render, screen } from "@testing-library/react";
|
||||
import { EditorState } from "@codemirror/state";
|
||||
import { EditorView } from "@codemirror/view";
|
||||
import { _addEditor, _removeEditor, editorContributions, type EditorDocContext } from "@/editor/api";
|
||||
import {
|
||||
_addEditor,
|
||||
_removeEditor,
|
||||
_setFocusedCellEditor,
|
||||
editorContributions,
|
||||
type EditorDocContext,
|
||||
} from "@/editor/api";
|
||||
import { fontZoom, resetAllEditorsFontZoom, setFontZoom } from "@/editor/core/cm/prefs";
|
||||
import { fontExtension } from "@/editor/core/cm/setup";
|
||||
import type { EditorSlot } from "@/editor/core/model/slot";
|
||||
@@ -118,6 +124,72 @@ describe("editor font size actions", () => {
|
||||
expect(zoom(md)).toBe(0);
|
||||
});
|
||||
|
||||
it("zooms every open editor with Increase / Decrease Font Size in All Editors, whatever wheelZoomScope says", async () => {
|
||||
const md = open(mdCtx);
|
||||
const ts = open(tsCtx);
|
||||
activate(md);
|
||||
await executeAction("editor.increaseFontSize");
|
||||
await executeAction("editor.increaseFontSize");
|
||||
expect(zoom(md)).toBe(2);
|
||||
expect(zoom(ts)).toBe(0);
|
||||
|
||||
// From the active editor's size, like ⌘/Ctrl+wheel with the "All editors" scope.
|
||||
await executeAction("editor.increaseFontSizeAll");
|
||||
expect(zoom(md)).toBe(3);
|
||||
expect(zoom(ts)).toBe(3);
|
||||
activate(ts);
|
||||
await executeAction("editor.decreaseFontSizeAll");
|
||||
expect(zoom(ts)).toBe(2);
|
||||
expect(zoom(md)).toBe(2);
|
||||
// Editors opened afterwards start from it; Increase Font Size still zooms only the active one.
|
||||
const later = open({ ...tsCtx, doc: 3, path: "/p/b.ts" });
|
||||
expect(zoom(later)).toBe(2);
|
||||
await executeAction("editor.increaseFontSize");
|
||||
expect(zoom(ts)).toBe(3);
|
||||
expect(zoom(md)).toBe(2);
|
||||
|
||||
await executeAction("editor.resetFontSizeAll");
|
||||
expect([zoom(md), zoom(ts), zoom(later)]).toEqual([0, 0, 0]);
|
||||
});
|
||||
|
||||
it("steps all editors from the shared size when no editor is active and stops at -6", async () => {
|
||||
const md = open(mdCtx);
|
||||
const ts = open(tsCtx);
|
||||
md.dispatch({ effects: setFontZoom.of(4) });
|
||||
activeSlot = null;
|
||||
await executeAction("editor.increaseFontSizeAll");
|
||||
expect(zoom(md)).toBe(1);
|
||||
expect(zoom(ts)).toBe(1);
|
||||
expect(zoom(open({ ...tsCtx, doc: 3, path: "/p/b.ts" }))).toBe(1);
|
||||
|
||||
md.dispatch({ effects: setFontZoom.of(-5) });
|
||||
activate(md);
|
||||
await executeAction("editor.decreaseFontSizeAll");
|
||||
expect(zoom(md)).toBe(-6);
|
||||
expect(zoom(ts)).toBe(-6);
|
||||
// At the limit the other editors still come to the same size.
|
||||
ts.dispatch({ effects: setFontZoom.of(1) });
|
||||
await executeAction("editor.decreaseFontSizeAll");
|
||||
expect(zoom(md)).toBe(-6);
|
||||
expect(zoom(ts)).toBe(-6);
|
||||
});
|
||||
|
||||
it("steps from the focused notebook cell, which is not in the editor registry", async () => {
|
||||
const md = open(mdCtx);
|
||||
activate(md);
|
||||
const cell = new EditorView({ state: EditorState.create({ extensions: [fontZoom] }) });
|
||||
views.push(cell);
|
||||
cell.dispatch({ effects: setFontZoom.of(5) });
|
||||
_setFocusedCellEditor(cell);
|
||||
try {
|
||||
await executeAction("editor.increaseFontSizeAll");
|
||||
expect(zoom(cell)).toBe(6);
|
||||
expect(zoom(md)).toBe(6);
|
||||
} finally {
|
||||
_setFocusedCellEditor(null);
|
||||
}
|
||||
});
|
||||
|
||||
it("scales only the focused Markdown preview tab (keyboard and ⌘/Ctrl+wheel) and resets with it", async () => {
|
||||
const otherMdCtx: EditorDocContext = {
|
||||
doc: 3,
|
||||
@@ -410,16 +482,21 @@ describe("editor font size actions", () => {
|
||||
});
|
||||
|
||||
it("leaves ⌘= / ⌘- to fold and unfold", () => {
|
||||
for (const km of [intellijMacos, intellijWindows]) {
|
||||
expect(km["editor.increaseFontSize"]).toEqual(["Alt+Shift+."]);
|
||||
expect(km["editor.decreaseFontSize"]).toEqual(["Alt+Shift+,"]);
|
||||
}
|
||||
expect(intellijWindows["editor.increaseFontSizeAll"]).toEqual(["Alt+Shift+."]);
|
||||
expect(intellijWindows["editor.decreaseFontSizeAll"]).toEqual(["Alt+Shift+,"]);
|
||||
expect(intellijMacos["editor.increaseFontSizeAll"]).toEqual(["Ctrl+Shift+."]);
|
||||
expect(intellijMacos["editor.decreaseFontSizeAll"]).toEqual(["Ctrl+Shift+,"]);
|
||||
expect(intellijMacos["code.fold"]).toEqual(["Meta+-"]);
|
||||
expect(intellijMacos["code.unfold"]).toEqual(["Meta+="]);
|
||||
expect(intellijWindows["code.fold"]).toEqual(["Ctrl+-"]);
|
||||
expect(intellijWindows["code.unfold"]).toEqual(["Ctrl+="]);
|
||||
for (const km of [intellijMacos, intellijWindows, vscodeMacos]) {
|
||||
const keys = [...(km["editor.increaseFontSize"] ?? []), ...(km["editor.decreaseFontSize"] ?? [])];
|
||||
const keys = [
|
||||
"editor.increaseFontSize",
|
||||
"editor.decreaseFontSize",
|
||||
"editor.increaseFontSizeAll",
|
||||
"editor.decreaseFontSizeAll",
|
||||
].flatMap((id) => km[id] ?? []);
|
||||
expect(keys.filter((k) => /^(Meta|Ctrl)\+(Shift\+)?[=-]$/.test(k))).toEqual([]);
|
||||
expect(Object.keys(km).filter((id) => id.startsWith("markdown.zoom"))).toEqual([]);
|
||||
}
|
||||
|
||||
@@ -122,6 +122,8 @@ export const IDEA_ACTIONS: Readonly<Record<string, string>> = {
|
||||
Unsplit: "editor.unsplit",
|
||||
ToggleDistractionFreeMode: "editor.toggleZen",
|
||||
ToggleZenMode: "view.toggleZenMode",
|
||||
EditorIncreaseFontSizeGlobal: "editor.increaseFontSizeAll",
|
||||
EditorDecreaseFontSizeGlobal: "editor.decreaseFontSizeAll",
|
||||
EditorScrollUp: "editor.scrollUp",
|
||||
EditorScrollDown: "editor.scrollDown",
|
||||
EditorScrollLeft: "editor.scrollLeft",
|
||||
|
||||
@@ -92,6 +92,15 @@ describe("IntelliJ IDEA keymap import", () => {
|
||||
expect(k.unknownActions).toEqual([]);
|
||||
});
|
||||
|
||||
it("maps Increase / Decrease Font Size in All Editors", () => {
|
||||
const k = parseIdeaKeymap(
|
||||
`<keymap name="F" parent="Mac OS X 10.5+"><action id="EditorIncreaseFontSizeGlobal"><keyboard-shortcut first-keystroke="shift meta EQUALS"/></action><action id="EditorDecreaseFontSizeGlobal"><keyboard-shortcut first-keystroke="shift meta MINUS"/></action></keymap>`,
|
||||
);
|
||||
expect(k.overrides["editor.increaseFontSizeAll"]).toEqual([normalizeBinding("Meta+Shift+=")]);
|
||||
expect(k.overrides["editor.decreaseFontSizeAll"]).toEqual([normalizeBinding("Meta+Shift+-")]);
|
||||
expect(k.unknownActions).toEqual([]);
|
||||
});
|
||||
|
||||
it("maps Scroll Left / Scroll Right", () => {
|
||||
const k = parseIdeaKeymap(
|
||||
`<keymap name="M" parent="Mac OS X 10.5+"><action id="EditorScrollLeft"><keyboard-shortcut first-keystroke="meta alt LEFT"/></action><action id="EditorScrollRight"><keyboard-shortcut first-keystroke="meta alt RIGHT"/></action></keymap>`,
|
||||
|
||||
@@ -13,8 +13,10 @@ describe("IDEA keymap parity", () => {
|
||||
["view.zoomIn", ["Ctrl+Alt+="], ["Alt+Shift+="]],
|
||||
["view.zoomOut", ["Ctrl+Alt+-"], ["Alt+Shift+-"]],
|
||||
["view.resetZoom", ["Ctrl+Alt+0"], ["Alt+Shift+0"]],
|
||||
["editor.increaseFontSize", ["Alt+Shift+."], ["Alt+Shift+."]],
|
||||
["editor.decreaseFontSize", ["Alt+Shift+,"], ["Alt+Shift+,"]],
|
||||
["editor.increaseFontSize", [], []],
|
||||
["editor.decreaseFontSize", [], []],
|
||||
["editor.increaseFontSizeAll", ["Ctrl+Shift+."], ["Alt+Shift+."]],
|
||||
["editor.decreaseFontSizeAll", ["Ctrl+Shift+,"], ["Alt+Shift+,"]],
|
||||
["vcs.changelist.move", ["Meta+Shift+M"], ["Alt+Shift+M"]],
|
||||
["vcs.changelist.edit", ["F2", "Shift+F6"], ["F2", "Shift+F6"]],
|
||||
["code.quickDocumentation", ["F1", "Ctrl+J"], ["Ctrl+Q"]],
|
||||
|
||||
@@ -407,8 +407,10 @@ export const intellijMacos: Record<string, string[]> = {
|
||||
"view.zoomIn": ["Ctrl+Alt+="],
|
||||
"view.zoomOut": ["Ctrl+Alt+-"],
|
||||
"view.resetZoom": ["Ctrl+Alt+0"],
|
||||
"editor.increaseFontSize": ["Alt+Shift+."],
|
||||
"editor.decreaseFontSize": ["Alt+Shift+,"],
|
||||
"editor.increaseFontSize": [],
|
||||
"editor.decreaseFontSize": [],
|
||||
"editor.increaseFontSizeAll": ["Ctrl+Shift+."],
|
||||
"editor.decreaseFontSizeAll": ["Ctrl+Shift+,"],
|
||||
// Diff viewer (after Debug: F7 / ⇧F7 / F4 / ⌘↓ there win while a diff is focused)
|
||||
"diff.nextDifference": ["F7"],
|
||||
"diff.prevDifference": ["Shift+F7"],
|
||||
|
||||
@@ -405,8 +405,10 @@ export const intellijWindows: Record<string, string[]> = {
|
||||
"view.zoomIn": ["Alt+Shift+="],
|
||||
"view.zoomOut": ["Alt+Shift+-"],
|
||||
"view.resetZoom": ["Alt+Shift+0"],
|
||||
"editor.increaseFontSize": ["Alt+Shift+."],
|
||||
"editor.decreaseFontSize": ["Alt+Shift+,"],
|
||||
"editor.increaseFontSize": [],
|
||||
"editor.decreaseFontSize": [],
|
||||
"editor.increaseFontSizeAll": ["Alt+Shift+."],
|
||||
"editor.decreaseFontSizeAll": ["Alt+Shift+,"],
|
||||
// Diff viewer (after Debug: F7 / ⇧F7 / F4 there win while a diff is focused)
|
||||
"diff.nextDifference": ["F7"],
|
||||
"diff.prevDifference": ["Shift+F7"],
|
||||
|
||||
@@ -417,6 +417,8 @@ export const vscodeMacos: Record<string, string[]> = {
|
||||
"view.resetZoom": [],
|
||||
"editor.increaseFontSize": [],
|
||||
"editor.decreaseFontSize": [],
|
||||
"editor.increaseFontSizeAll": [],
|
||||
"editor.decreaseFontSizeAll": [],
|
||||
// Editing extras, image viewer (keyWhen: image focused) and Markdown editor layouts
|
||||
"code.cyclicExpandWord": [],
|
||||
"code.cyclicExpandWordBackward": [],
|
||||
|
||||
@@ -2740,6 +2740,8 @@
|
||||
"Import…": "Importar…",
|
||||
"Reload All from Disk": "Recargar todo desde el disco",
|
||||
"Reset Font Size in All Editors": "Restablecer tamaño de fuente en todos los editores",
|
||||
"Increase Font Size in All Editors": "Aumentar tamaño de fuente en todos los editores",
|
||||
"Decrease Font Size in All Editors": "Disminuir tamaño de fuente en todos los editores",
|
||||
"Library source (read-only).": "Código fuente de biblioteca (solo lectura).",
|
||||
"Search In Selection": "Buscar en la selección",
|
||||
"Search Scope": "Ámbito de búsqueda",
|
||||
|
||||
@@ -2643,6 +2643,8 @@
|
||||
"Import…": "Importer…",
|
||||
"Reload All from Disk": "Tout recharger depuis le disque",
|
||||
"Reset Font Size in All Editors": "Réinitialiser la taille de police dans tous les éditeurs",
|
||||
"Increase Font Size in All Editors": "Augmenter la taille de police dans tous les éditeurs",
|
||||
"Decrease Font Size in All Editors": "Réduire la taille de police dans tous les éditeurs",
|
||||
"Library source (read-only).": "Source de bibliothèque (lecture seule).",
|
||||
"Search In Selection": "Rechercher dans la sélection",
|
||||
"Search Scope": "Portée de la recherche",
|
||||
|
||||
@@ -2790,6 +2790,8 @@
|
||||
"Import…": "가져오기…",
|
||||
"Reload All from Disk": "디스크에서 모두 다시 로드",
|
||||
"Reset Font Size in All Editors": "모든 편집기의 글꼴 크기 초기화",
|
||||
"Increase Font Size in All Editors": "모든 편집기의 글꼴 크기 크게",
|
||||
"Decrease Font Size in All Editors": "모든 편집기의 글꼴 크기 작게",
|
||||
"Library source (read-only).": "라이브러리 소스(읽기 전용).",
|
||||
"Search In Selection": "선택 영역에서 검색",
|
||||
"Search Scope": "검색 범위",
|
||||
|
||||
@@ -2716,6 +2716,8 @@
|
||||
"Import…": "Importuj…",
|
||||
"Reload All from Disk": "Przeładuj wszystko z dysku",
|
||||
"Reset Font Size in All Editors": "Zresetuj rozmiar czcionki we wszystkich edytorach",
|
||||
"Increase Font Size in All Editors": "Zwiększ rozmiar czcionki we wszystkich edytorach",
|
||||
"Decrease Font Size in All Editors": "Zmniejsz rozmiar czcionki we wszystkich edytorach",
|
||||
"Library source (read-only).": "Kod źródłowy biblioteki (tylko do odczytu).",
|
||||
"Search In Selection": "Szukaj w zaznaczeniu",
|
||||
"Search Scope": "Zakres wyszukiwania",
|
||||
|
||||
@@ -2717,6 +2717,8 @@
|
||||
"Import…": "Importar…",
|
||||
"Reload All from Disk": "Recarregar tudo do disco",
|
||||
"Reset Font Size in All Editors": "Redefinir tamanho da fonte em todos os editores",
|
||||
"Increase Font Size in All Editors": "Aumentar tamanho da fonte em todos os editores",
|
||||
"Decrease Font Size in All Editors": "Diminuir tamanho da fonte em todos os editores",
|
||||
"Library source (read-only).": "Código-fonte da biblioteca (somente leitura).",
|
||||
"Search In Selection": "Pesquisar na seleção",
|
||||
"Search Scope": "Escopo de pesquisa",
|
||||
|
||||
@@ -4077,6 +4077,8 @@
|
||||
"Import…": "Импорт…",
|
||||
"Reload All from Disk": "Перезагрузить всё с диска",
|
||||
"Reset Font Size in All Editors": "Сбросить размер шрифта во всех редакторах",
|
||||
"Increase Font Size in All Editors": "Увеличить размер шрифта во всех редакторах",
|
||||
"Decrease Font Size in All Editors": "Уменьшить размер шрифта во всех редакторах",
|
||||
"Library source (read-only).": "Исходный код библиотеки (только для чтения).",
|
||||
"Search In Selection": "Искать в выделенном",
|
||||
"Search Scope": "Область поиска",
|
||||
|
||||
@@ -5427,6 +5427,8 @@
|
||||
"Import…": "İçe Aktar…",
|
||||
"Reload All from Disk": "Tümünü Diskten Yeniden Yükle",
|
||||
"Reset Font Size in All Editors": "Tüm Düzenleyicilerin Yazı Tipi Boyutunu Sıfırla",
|
||||
"Increase Font Size in All Editors": "Tüm Düzenleyicilerde Yazı Tipi Boyutunu Artır",
|
||||
"Decrease Font Size in All Editors": "Tüm Düzenleyicilerde Yazı Tipi Boyutunu Azalt",
|
||||
"Library source (read-only).": "Kütüphane kaynağı (salt okunur).",
|
||||
"Search In Selection": "Seçimde Ara",
|
||||
"Search Scope": "Arama Kapsamı",
|
||||
|
||||
@@ -3646,6 +3646,8 @@
|
||||
"Import…": "匯入…",
|
||||
"Reload All from Disk": "從磁碟全部重新載入",
|
||||
"Reset Font Size in All Editors": "重設所有編輯器中的字型大小",
|
||||
"Increase Font Size in All Editors": "增大所有編輯器中的字型",
|
||||
"Decrease Font Size in All Editors": "減小所有編輯器中的字型",
|
||||
"Library source (read-only).": "庫原始碼(唯讀)。",
|
||||
"Search In Selection": "在所選內容中搜尋",
|
||||
"Search Scope": "搜尋範圍",
|
||||
|
||||
@@ -4225,6 +4225,8 @@
|
||||
"Import…": "导入…",
|
||||
"Reload All from Disk": "从磁盘全部重新加载",
|
||||
"Reset Font Size in All Editors": "重置所有编辑器中的字体大小",
|
||||
"Increase Font Size in All Editors": "增大所有编辑器中的字体",
|
||||
"Decrease Font Size in All Editors": "减小所有编辑器中的字体",
|
||||
"Library source (read-only).": "库源代码(只读)。",
|
||||
"Search In Selection": "在所选内容中搜索",
|
||||
"Search Scope": "搜索范围",
|
||||
|
||||
Reference in new issue
Заблокувати користувача