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

selectText() on TextEditor select wrong text when tabs are used for indention #96

Open
openscript opened this issue Dec 3, 2023 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@openscript
Copy link
Contributor

If tabs are used in a file, where selectText() is executed, the cursor will stop before the text, which should be selected. The reason for this, could be that columns and coordinates don't correspond in VSCode:

https://github.com/webdriverio-community/wdio-vscode-service/blob/88c7a47d041b126e84ae1703d04bc13d7648e4bf/src/pageobjects/editor/TextEditor.ts#L344C44-L344C50

If the tab size is two moving one tab to the right increases the column count by two.

@christian-bromann
Copy link
Contributor

Thanks for reporting!

We greatly appreciate any contributions that help resolve the bug. While we understand that active contributors have their own priorities, we kindly request your assistance if you rely on this bug being fixed. We encourage you to join our friendly Discord development server, where you can ask any questions you may have. Thank you for your support, and cheers!

@christian-bromann christian-bromann added bug Something isn't working help wanted Extra attention is needed labels Dec 3, 2023
@openscript
Copy link
Contributor Author

@christian-bromann I'm happy to fix this, but what would be the right way to do it?

I've been thinking if we can just read each character at the cursor and compare it to the to be selected text until it matches?

@seanpoulter
Copy link
Contributor

I don't think we know the right way to solve this @openscript. What are our options? You've already suggested one. I can think of another option to increment by the size of a tab if we find one. We should be able to check the TextEditorOptions.

I'm also curious what test cases we'd want to cover. I'm fairly confidence searching for whitespace at the end of a sentence won't work as expected due to a .trim(). 🤔

  • Spaces
  • Tabs (size 4)
  • A mix of spaces and tabs
  • Searching for text with trailing spaces at the end of the line (:bug:?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants