Skip to content

Code Improved and Bug Fixed #39

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

Merged
merged 4 commits into from
Nov 25, 2021
Merged

Code Improved and Bug Fixed #39

merged 4 commits into from
Nov 25, 2021

Conversation

TT-talhatariq
Copy link
Contributor

I improved the code readability by changing for loops and switch statements with enhanced for loops and switch statements respectively

Also, there is a bug in the Find.java class. If we replace a word of Text with another one, all the characters who're in Uppercase in NotePad, changed to LowerCase.

@pH-7
Copy link
Owner

pH-7 commented Nov 3, 2021

Thanks for this @TT-talhatariq!! Highly appreciated 👏

@pH-7
Copy link
Owner

pH-7 commented Nov 3, 2021

@TT-talhatariq Why have you added a bunch of images in bin/? And they don't seem to be used anywhere...

.idea/.gitignore Outdated
@@ -0,0 +1,8 @@
# Default ignored files
Copy link
Owner

Choose a reason for hiding this comment

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

.gitignore in the .idea folder...?

@TT-talhatariq
Copy link
Contributor Author

Actually, it was because of IntelliJ Idea. Once I opened this project in that IDE, and that IDE created some extra folders and files in it.
Anyways, I resolved these issues.

Copy link
Contributor Author

@TT-talhatariq TT-talhatariq left a comment

Choose a reason for hiding this comment

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

Review this now.

@pH-7
Copy link
Owner

pH-7 commented Nov 6, 2021

Actually, it was because of IntelliJ Idea. Once I opened this project in that IDE, and that IDE created some extra folders and files in it.
Anyways, I resolved these issues.

That looks much cleaner now. Thank you! To avoid that, it could be nice to add .idea to the root .gitignore file then.

Copy link
Owner

@pH-7 pH-7 left a comment

Choose a reason for hiding this comment

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

@TT-talhatariq Why did you remove all toLowerCase ?

@@ -175,7 +175,7 @@ public void replace() {
}

public void replaceAll() {
txt.setText(txt.getText().toLowerCase().replaceAll(textF.getText().toLowerCase(), textR.getText()));
txt.setText(txt.getText().replaceAll(textF.getText() , textR.getText()));
Copy link
Owner

@pH-7 pH-7 Nov 6, 2021

Choose a reason for hiding this comment

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

Was there a reason why you removed the case-insensitive selection.toLowerCase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because there is a bug in the replaceAll() method of Find.java class. If we replace the word of Text in NotePad with a word, all the characters who're in Uppercase in NotePad, changed to LowerCase.

Like, let's say there is "Talha is Here" in notePad and I replaced the name "Talha" with "Ali" by using the replace all field.
That statement will first change the text of NotePad "Talha is Here" into "talha is ali".

All Uppercase letters are converted into lower case.

You can Test that replaceAll() function.

@pH-7
Copy link
Owner

pH-7 commented Nov 6, 2021

@TT-talhatariq With what Java version did you test it?

Could you also update the SimpleJavaTextEditor.jar with your version and run it?
You can also generate easily a new jar file with the following command when you are in src/ directory jar cmvf ../manifest.mf ../SimpleJavaTextEditor.jar simplejavatexteditor/*.class

@pH-7 pH-7 assigned TT-talhatariq and unassigned TT-talhatariq Nov 9, 2021
@pH-7
Copy link
Owner

pH-7 commented Nov 9, 2021

@TT-talhatariq Once my concerns have been addressed, I will be happy to approve your work and merge it 😊

Copy link
Contributor Author

@TT-talhatariq TT-talhatariq left a comment

Choose a reason for hiding this comment

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

I explained replaceAll() bug above in detail. If you have further query let me Know.

Also, I updated the Jar file. And I'm using java version 17.

Now, there's no issue of cases. First It even replaces the word "talha" with "Talha" in notepad and vice-versa. But this is not possible now and also bug of all lowercase letters resolved.

@pH-7
Copy link
Owner

pH-7 commented Nov 21, 2021

I explained replaceAll() bug above in detail. If you have further query let me Know.

Also, I updated the Jar file. And I'm using java version 17.

Now, there's no issue of cases. First It even replaces the word "talha" with "Talha" in notepad and vice-versa. But this is not possible now and also bug of all lowercase letters resolved.

Yes, I've seen it now where you mentioned the bug.

Awesome, thanks very much for doing so @TT-talhatariq 😄

@pH-7
Copy link
Owner

pH-7 commented Nov 21, 2021

Also, I updated the Jar file. And I'm using java version 17.

Can you replace the current jar file of the project by yours?

@pH-7
Copy link
Owner

pH-7 commented Nov 21, 2021

Here :) Screenshot 2021-11-21 at 16 17 08

In the root directory of the project.

@TT-talhatariq
Copy link
Contributor Author

Also, I updated the Jar file. And I'm using java version 17.

Can you replace the current jar file of the project by yours?

pic
But, I have already replaced my own version of jar file with the jar file of the root directory of this project. Here is the picture of changes in project.

@TT-talhatariq
Copy link
Contributor Author

Yes, I've seen it now where you mentioned the bug.

Awesome, thanks very much for doing so @TT-talhatariq 😄

Thank you for your appreciation 😁

@pH-7
Copy link
Owner

pH-7 commented Nov 25, 2021

Also, I updated the Jar file. And I'm using java version 17.

Can you replace the current jar file of the project by yours?

pic

But, I have already replaced my own version of jar file with the jar file of the root directory of this project. Here is the picture of changes in project.

Oh, I see now 🙂 Somehow I missed it 😄 Thank you for your prompt reply @TT-talhatariq! You rock! 👌

@pH-7 pH-7 merged commit 6d9e330 into pH-7:master Nov 25, 2021
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