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 version diff word detection #2124

Merged
merged 3 commits into from
Apr 27, 2023

Conversation

tchaudhry91
Copy link
Contributor

Attempted Fix for #1961

The core problem is the checkWords function.
e.g while traversing through arch, it finds rc as well. Thereby goes off by 1.
I have added some tests and changed the checkWords to return true only if the current character is not a Letter (i.e not part of a bigger word).
Other tests are also passing.

@tchaudhry91 tchaudhry91 requested a review from Jguer as a code owner April 18, 2023 04:49
"github.com/Jguer/yay/v12/pkg/text"
)

func TestVersionDiff(t *testing.T) {
Copy link
Owner

Choose a reason for hiding this comment

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

I think you have to force text.Color = true and then unset it at the end of the test to stop the automatic tty detection from turning off colors.

One of the unfortunate places where we haven't gotten rid of globals

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the change.

Copy link
Owner

@Jguer Jguer left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution, awesome to see this fixed

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.

2 participants