Adds a toggle to disable column selections on mac

This commit is contained in:
Viraj Sinha
2018-06-28 15:56:25 -07:00
parent 3202ddc96d
commit 2669576b6c
3 changed files with 16 additions and 2 deletions
+5 -1
View File
@@ -376,7 +376,11 @@ export class SelectionManager extends EventEmitter implements ISelectionManager
* @param event The mouse event.
*/
public shouldForceSelection(event: MouseEvent): boolean {
return Browser.isMac ? event.altKey : event.shiftKey;
if (Browser.isMac) {
return event.altKey && this._terminal.options.macOptionClickForcesSelection;
}
return event.shiftKey;
}
/**
+1
View File
@@ -98,6 +98,7 @@ const DEFAULT_OPTIONS: ITerminalOptions = {
screenReaderMode: false,
debug: false,
macOptionIsMeta: false,
macOptionClickForcesSelection: false,
cancelEvents: false,
disableStdin: false,
useFlowControl: false,
+10 -1
View File
@@ -124,6 +124,15 @@ declare module 'xterm' {
*/
macOptionIsMeta?: boolean;
/**
* Whether holding a modifier key will force normal selection behavior,
* regardless of whether the terminal is in mouse events mode. This will
* also prevent mouse events from being emitted by the terminal. For example,
* this allows you to use xterm.js' regular selection inside tmux with
* mouse mode enabled.
*/
macOptionClickForcesSelection?: boolean;
/**
* (EXPERIMENTAL) The type of renderer to use, this allows using the
* fallback DOM renderer when canvas is too slow for the environment. The
@@ -562,7 +571,7 @@ declare module 'xterm' {
* Retrieves an option's value from the terminal.
* @param key The option key.
*/
getOption(key: 'colors'): string[];
getOption(key: 'columnSelectModifiers' | 'colors'): string[];
/**
* Retrieves an option's value from the terminal.
* @param key The option key.