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

Don't duplicate @-filenames when pressing tab if the whole string has been typed #2218

Merged
merged 2 commits into from
Dec 8, 2023

Conversation

DanTup
Copy link
Contributor

@DanTup DanTup commented Dec 8, 2023

This code was using input.lastIndexOf(fileDisplayText) to find the location of the text to compute the suffix, but it didn't take into account the length, so any time input contained fileDisplayText, the contents of fileDisplayText would become duplicated.

(@abeatrix the original code was added as part of a fix for #1973 - in my testing that still seems to work correctly with my change, but let me know if I've misunderstood).

Fixes #2200

Test plan

  • Run pnpm test:unit at-file or
  • Open the chat window
  • Type "@" followed by a complete filename including the very last character
  • Press <tab> to accept the file
  • Ensure the chat input does not contain the filename duplicated

Copy link
Contributor

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

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

Noice

@DanTup DanTup merged commit 747f152 into main Dec 8, 2023
13 checks passed
@DanTup DanTup deleted the dantup/fix-tab-end-of-file branch December 8, 2023 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: @-mentions, hitting tab at the end of a filename includes the filename twice
2 participants