提交 f37884c2 编写于 作者: A Alex Dima

Fixes #34826: write character before cursor to the textarea on OSX to allow...

Fixes #34826: write character before cursor to the textarea on OSX to allow the "long-press" composition to work
上级 0f78fdcd
......@@ -7,6 +7,7 @@
import 'vs/css!./textAreaHandler';
import * as platform from 'vs/base/common/platform';
import * as browser from 'vs/base/browser/browser';
import * as strings from 'vs/base/common/strings';
import { TextAreaInput, ITextAreaInputHost, IPasteData, ICompositionData } from 'vs/editor/browser/controller/textAreaInput';
import { ISimpleModel, ITypeData, TextAreaState, PagedScreenReaderStrategy } from 'vs/editor/browser/controller/textAreaState';
import { Range } from 'vs/editor/common/core/range';
......@@ -164,6 +165,20 @@ export class TextAreaHandler extends ViewPart {
if (this._accessibilitySupport === platform.AccessibilitySupport.Disabled) {
// We know for a fact that a screen reader is not attached
// On OSX, we write the character before the cursor to allow for "long-press" composition
if (platform.isMacintosh) {
const selection = this._selections[0];
if (selection.isEmpty()) {
const position = selection.getStartPosition();
if (position.column > 1) {
const lineContent = this._context.model.getLineContent(position.lineNumber);
const charBefore = lineContent.charAt(position.column - 2);
if (!strings.isHighSurrogate(charBefore.charCodeAt(0))) {
return new TextAreaState(charBefore, 1, 1, position, position);
}
}
}
}
return TextAreaState.EMPTY;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册