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

TextEditorEdit.delete() across multiple lines does not shrink the selection when word wraps #41573

Closed
Jasonlhy opened this issue Jan 13, 2018 · 1 comment
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug editor-core Editor basic functionality verified Verification succeeded
Milestone

Comments

@Jasonlhy
Copy link
Contributor

  • VSCode Version: 1.19
  • OS Version: I have tested on Windows 10, Window 7 and macOS 10.12

Steps to Reproduce:

  1. Set the editor with word wrap
"editor.wordWrapColumn": 100,
"editor.wordWrap": "wordWrapColumn",
  1. Write an extension with a testing function like this,

It aims to delete the first selection range.

export function smartBackspace(): Thenable<Boolean> {
    const editor = window.activeTextEditor;
    const returned = editor.edit(editorBuilder => {
        editorBuilder.delete(new Range(editor.selection.start, editor.selection.end));
    });

    return returned;
}

function registerSmartBackspace() {
    // The command has been defined in the package.json file
    // Now provide the implementation of the command with  registerCommand
    // The commandId parameter must match the command field in package.json
    let disposable = commands.registerCommand('extension.smartBackspace', smartBackspace);

    return disposable;
}
  1. Run the extension and paste the testing sample on a new page
Authorization: 'Bearer YnzgPsmz_avev-9lx47q8TlNHnONvREoftEwtU14lJ9x-Z3R1Ut6pv3DYOGnIojS93uU_DiKyfu0Dez2lbEJVy_ftxydQw-ZEzqZID5V7rBCIGKPaTn5I1sraktowXKT6Z4Kg8sdTXvavV6Q5jwlgMZ-VB-t9TzI7-eKLcgOkGx750bCZU7fyAQIrCD73ceZRRJjDdP3aScj-ZmlcmAVVA',
  1. Execute the testing function and the selection still is here

word_wrap

However, this problem doesn't appear when word wrap is turned off.
no_word_wrap

Does this issue occur when all extensions are disabled?: No, the original delete button works fine.

I also tested it in vscode 1.12 on Ubuntu, this problem doesn't appear.

@vscodebot vscodebot bot added editor editor-contrib Editor collection of extras labels Jan 13, 2018
@alexdima
Copy link
Member

Great find, thank you!

@alexdima alexdima added editor-core Editor basic functionality bug Issue identified by VS Code Team member as probable bug and removed editor editor-contrib Editor collection of extras labels Jan 18, 2018
@alexdima alexdima added this to the January 2018 milestone Jan 18, 2018
@gushuro gushuro added the verified Verification succeeded label Feb 2, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug editor-core Editor basic functionality verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants