mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
use new windowsPty xterm option
This commit is contained in:
parent
1daf594e4b
commit
11c923842a
6 changed files with 22 additions and 3 deletions
|
|
@ -106,6 +106,7 @@ class TermGroup_ extends React.PureComponent<TermGroupProps> {
|
||||||
macOptionSelectionMode: this.props.macOptionSelectionMode,
|
macOptionSelectionMode: this.props.macOptionSelectionMode,
|
||||||
disableLigatures: this.props.disableLigatures,
|
disableLigatures: this.props.disableLigatures,
|
||||||
screenReaderMode: this.props.screenReaderMode,
|
screenReaderMode: this.props.screenReaderMode,
|
||||||
|
windowsPty: this.props.windowsPty,
|
||||||
uid
|
uid
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import 'xterm/css/xterm.css';
|
||||||
|
|
||||||
const SearchBox = decorate(_SearchBox, 'SearchBox');
|
const SearchBox = decorate(_SearchBox, 'SearchBox');
|
||||||
|
|
||||||
const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(navigator.platform);
|
const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(navigator.platform) || process.platform === 'win32';
|
||||||
|
|
||||||
// map old hterm constants to xterm.js
|
// map old hterm constants to xterm.js
|
||||||
const CURSOR_STYLES = {
|
const CURSOR_STYLES = {
|
||||||
|
|
@ -59,6 +59,7 @@ const getTermOptions = (props: TermProps): ITerminalOptions => {
|
||||||
allowTransparency: needTransparency,
|
allowTransparency: needTransparency,
|
||||||
macOptionClickForcesSelection: props.macOptionSelectionMode === 'force',
|
macOptionClickForcesSelection: props.macOptionSelectionMode === 'force',
|
||||||
windowsMode: isWindows,
|
windowsMode: isWindows,
|
||||||
|
...(isWindows && props.windowsPty && {windowsPty: props.windowsPty}),
|
||||||
theme: {
|
theme: {
|
||||||
foreground: props.foregroundColor,
|
foreground: props.foregroundColor,
|
||||||
background: backgroundColor,
|
background: backgroundColor,
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ export default class Terms extends React.Component<TermsProps> {
|
||||||
macOptionSelectionMode: this.props.macOptionSelectionMode,
|
macOptionSelectionMode: this.props.macOptionSelectionMode,
|
||||||
disableLigatures: this.props.disableLigatures,
|
disableLigatures: this.props.disableLigatures,
|
||||||
screenReaderMode: this.props.screenReaderMode,
|
screenReaderMode: this.props.screenReaderMode,
|
||||||
|
windowsPty: this.props.windowsPty,
|
||||||
parentProps: this.props
|
parentProps: this.props
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,8 @@ const mapStateToProps = (state: HyperState) => {
|
||||||
webLinksActivationKey: state.ui.webLinksActivationKey,
|
webLinksActivationKey: state.ui.webLinksActivationKey,
|
||||||
macOptionSelectionMode: state.ui.macOptionSelectionMode,
|
macOptionSelectionMode: state.ui.macOptionSelectionMode,
|
||||||
disableLigatures: state.ui.disableLigatures,
|
disableLigatures: state.ui.disableLigatures,
|
||||||
screenReaderMode: state.ui.screenReaderMode
|
screenReaderMode: state.ui.screenReaderMode,
|
||||||
|
windowsPty: state.ui.windowsPty
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
5
lib/hyper.d.ts
vendored
5
lib/hyper.d.ts
vendored
|
|
@ -38,7 +38,7 @@ export type ITermState = Immutable<{
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type cursorShapes = 'BEAM' | 'UNDERLINE' | 'BLOCK';
|
export type cursorShapes = 'BEAM' | 'UNDERLINE' | 'BLOCK';
|
||||||
import {FontWeight, Terminal} from 'xterm';
|
import {FontWeight, IWindowsPty, Terminal} from 'xterm';
|
||||||
import {ColorMap} from './config';
|
import {ColorMap} from './config';
|
||||||
|
|
||||||
export type uiState = Immutable<{
|
export type uiState = Immutable<{
|
||||||
|
|
@ -103,6 +103,7 @@ export type uiState = Immutable<{
|
||||||
updateVersion: string | null;
|
updateVersion: string | null;
|
||||||
webGLRenderer: boolean;
|
webGLRenderer: boolean;
|
||||||
webLinksActivationKey: 'ctrl' | 'alt' | 'meta' | 'shift' | '';
|
webLinksActivationKey: 'ctrl' | 'alt' | 'meta' | 'shift' | '';
|
||||||
|
windowsPty?: IWindowsPty;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type session = {
|
export type session = {
|
||||||
|
|
@ -308,6 +309,7 @@ export type TermGroupOwnProps = {
|
||||||
| 'uiFontFamily'
|
| 'uiFontFamily'
|
||||||
| 'webGLRenderer'
|
| 'webGLRenderer'
|
||||||
| 'webLinksActivationKey'
|
| 'webLinksActivationKey'
|
||||||
|
| 'windowsPty'
|
||||||
>;
|
>;
|
||||||
|
|
||||||
import {TermGroupConnectedProps} from './components/term-group';
|
import {TermGroupConnectedProps} from './components/term-group';
|
||||||
|
|
@ -382,6 +384,7 @@ export type TermProps = {
|
||||||
url: string | null;
|
url: string | null;
|
||||||
webGLRenderer: boolean;
|
webGLRenderer: boolean;
|
||||||
webLinksActivationKey: 'ctrl' | 'alt' | 'meta' | 'shift' | '';
|
webLinksActivationKey: 'ctrl' | 'alt' | 'meta' | 'shift' | '';
|
||||||
|
windowsPty?: IWindowsPty;
|
||||||
ref_: (uid: string, term: Term | null) => void;
|
ref_: (uid: string, term: Term | null) => void;
|
||||||
} & extensionProps;
|
} & extensionProps;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@ import {
|
||||||
} from '../constants/sessions';
|
} from '../constants/sessions';
|
||||||
import {UPDATE_AVAILABLE} from '../constants/updater';
|
import {UPDATE_AVAILABLE} from '../constants/updater';
|
||||||
import {uiState, Mutable, IUiReducer} from '../hyper';
|
import {uiState, Mutable, IUiReducer} from '../hyper';
|
||||||
|
import {release} from 'os';
|
||||||
|
|
||||||
|
const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(navigator.platform) || process.platform === 'win32';
|
||||||
|
|
||||||
const allowedCursorShapes = new Set(['BEAM', 'BLOCK', 'UNDERLINE']);
|
const allowedCursorShapes = new Set(['BEAM', 'BLOCK', 'UNDERLINE']);
|
||||||
const allowedCursorBlinkValues = new Set([true, false]);
|
const allowedCursorBlinkValues = new Set([true, false]);
|
||||||
|
|
@ -269,6 +272,15 @@ const reducer: IUiReducer = (state = initial, action) => {
|
||||||
ret.screenReaderMode = config.screenReaderMode;
|
ret.screenReaderMode = config.screenReaderMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const buildNumber = parseInt(release().split('.').at(-1) || '0', 10);
|
||||||
|
if (isWindows && !Number.isNaN(buildNumber) && buildNumber > 0) {
|
||||||
|
const useConpty = typeof config.useConpty === 'boolean' ? config.useConpty : buildNumber >= 18309;
|
||||||
|
ret.windowsPty = {
|
||||||
|
backend: useConpty ? 'conpty' : 'winpty',
|
||||||
|
buildNumber
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
ret._lastUpdate = now;
|
ret._lastUpdate = now;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue