@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { getDefaultSettings } from './constants'
|
||||
import { getDefaultPrimarySelectionMiddleClickPaste, getDefaultSettings } from './constants'
|
||||
|
||||
describe('getDefaultSettings', () => {
|
||||
it('enables gitignored file decorations by default', () => {
|
||||
@@ -18,3 +18,14 @@ describe('getDefaultSettings', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('getDefaultPrimarySelectionMiddleClickPaste', () => {
|
||||
it('enables primary selection paste on Linux by default', () => {
|
||||
expect(getDefaultPrimarySelectionMiddleClickPaste('linux')).toBe(true)
|
||||
})
|
||||
|
||||
it('leaves primary selection paste opt-in on macOS and Windows', () => {
|
||||
expect(getDefaultPrimarySelectionMiddleClickPaste('darwin')).toBe(false)
|
||||
expect(getDefaultPrimarySelectionMiddleClickPaste('win32')).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -59,6 +59,10 @@ function defaultTerminalFontFamily(): string {
|
||||
}
|
||||
return 'SF Mono' // macOS default
|
||||
}
|
||||
|
||||
export const getDefaultPrimarySelectionMiddleClickPaste = (
|
||||
platform = typeof process !== 'undefined' ? process.platform : ''
|
||||
): boolean => platform === 'linux'
|
||||
/**
|
||||
* Why: ProseMirror builds an in-memory tree for the entire document, so large
|
||||
* markdown files cause noticeable typing lag in the rich editor. Files above
|
||||
@@ -168,6 +172,7 @@ export function getDefaultSettings(homedir: string): GlobalSettings {
|
||||
editorAutoSaveDelayMs: DEFAULT_EDITOR_AUTO_SAVE_DELAY_MS,
|
||||
editorMinimapEnabled: false,
|
||||
markdownReviewToolsEnabled: true,
|
||||
primarySelectionMiddleClickPaste: getDefaultPrimarySelectionMiddleClickPaste(),
|
||||
terminalFontSize: 14,
|
||||
terminalFontFamily: defaultTerminalFontFamily(),
|
||||
terminalFontWeight: DEFAULT_TERMINAL_FONT_WEIGHT,
|
||||
|
||||
@@ -1271,6 +1271,10 @@ export type GlobalSettings = {
|
||||
editorMinimapEnabled: boolean
|
||||
/** Whether local markdown review note controls and the review panel are shown. */
|
||||
markdownReviewToolsEnabled: boolean
|
||||
/** Why: mirrors X11 primary-selection muscle memory without mutating the
|
||||
* normal system clipboard; Linux enables it by default, other platforms
|
||||
* leave middle-click semantics unchanged unless the user opts in. */
|
||||
primarySelectionMiddleClickPaste?: boolean
|
||||
terminalFontSize: number
|
||||
terminalFontFamily: string
|
||||
terminalFontWeight: number
|
||||
|
||||
Reference in New Issue
Block a user