8000 Revert "Call composition type handler when doing composition" by aiday-mar · Pull Request #251902 · microsoft/vscode · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Revert "Call composition type handler when doing composition" #251902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class NativeEditContext extends AbstractEditContext {
private _parent: HTMLElement | undefined;
private _decorations: string[] = [];
private _primarySelection: Selection = new Selection(1, 1, 1, 1);
private _isComposing: boolean = false;


private _targetWindowId: number = -1;
private _scrollTop: number = 0;
Expand Down Expand Up @@ -185,15 +185,13 @@ export class NativeEditContext extends AbstractEditContext {
this._emitTypeEvent(this._viewController, e);
}));
this._register(editContextAddDisposableListener(this._editContext, 'compositionstart', (e) => {
this._isComposing = true;
// Utlimately fires onDidCompositionStart() on the editor to notify for example suggest model of composition state
// Updates the composition state of the cursor controller which determines behavior of typing with interceptors
this._viewController.compositionStart();
// Emits ViewCompositionStartEvent which can be depended on by ViewEventHandlers
this._context.viewModel.onCompositionStart();
}));
this._register(editContextAddDisposableListener(this._editContext, 'compositionend', (e) => {
this._isComposing = false;
// Utlimately fires compositionEnd() on the editor to notify for example suggest model of composition state
// Updates the composition state of the cursor controller which determines behavior of typing with interceptors
this._viewController.compositionEnd();
Expand Down Expand Up @@ -408,7 +406,7 @@ export class NativeEditContext extends AbstractEditContext {
}

private _onType(viewController: ViewController, typeInput: ITypeData): void {
if (typeInput.replacePrevCharCnt || typeInput.replaceNextCharCnt || typeInput.positionDelta || this._isComposing) {
if (typeInput.replacePrevCharCnt || typeInput.replaceNextCharCnt || typeInput.positionDelta) {
viewController.compositionType(typeInput.text, typeInput.replacePrevCharCnt, typeInput.replaceNextCharCnt, typeInput.positionDelta);
} else {
viewController.type(typeInput.text);
Expand Down
3 changes: 1 addition & 2 deletions src/vs/editor/browser/widget/codeEditor/codeEditorWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1861,8 +1861,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
},
compositionType: (text: string, replacePrevCharCnt: number, replaceNextCharCnt: number, positionDelta: number) => {
// Try if possible to go through the existing `replacePreviousChar` command
const editContextEnabled = this.getOption(EditorOption.effectiveEditContext);
if (replaceNextCharCnt || positionDelta || editContextEnabled) {
if (replaceNextCharCnt || positionDelta) {
// must be handled through the new command
const payload: editorCommon.CompositionTypePayload = { text, replacePrevCharCnt, replaceNextCharCnt, positionDelta };
this._commandService.executeCommand(editorCommon.Handler.CompositionType, payload);
Expand Down
Loading
0