Skip to content
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

Fix bug causing cursor to not move on paste #55689

Merged
merged 1 commit into from
Aug 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,12 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
this.searchBox.setModel(this.modelService.createModel('', null, uri.parse('extensions:searchinput'), true));

this.disposables.push(this.searchBox.onDidPaste(() => {
this.searchBox.setValue(this.searchBox.getValue().replace(/\s+/g, ' '));
let trimmed = this.searchBox.getValue().replace(/\s+/g, ' ');
this.searchBox.setValue(trimmed);
this.searchBox.setScrollTop(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need a scroll top if we ever only expect this to be a single line editor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A weird shadow appears above the editor when you try to past multiline text otherwise. I think its becuase we technically paste the multiline, then change it to single line, so internally it thinks its multiline for a bit and tries to render the shadow to show there's more above?

this.searchBox.setPosition(new Position(1, trimmed.length + 1));
}));

this.disposables.push(this.searchBox.onDidFocusEditorText(() => addClass(this.monacoStyleContainer, 'synthetic-focus')));
this.disposables.push(this.searchBox.onDidBlurEditorText(() => removeClass(this.monacoStyleContainer, 'synthetic-focus')));

Expand Down