Skip to content

Commit

Permalink
Merge pull request #97 from FionaQY/fix-command-bug
Browse files Browse the repository at this point in the history
Fix issue where incorrect format error is shown when cursor is not at end of command
  • Loading branch information
FionaQY authored Oct 18, 2024
2 parents ea27dd6 + 91e392a commit 3ee1011
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class AddressBookParser {
* @throws ParseException if the user input does not conform the expected format
*/
public Command parseCommand(String userInput) throws ParseException {
userInput = userInput.replace("\n", "");
final Matcher matcher = BASIC_COMMAND_FORMAT.matcher(userInput.trim());
if (!matcher.matches()) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, HelpCommand.MESSAGE_USAGE));
Expand Down

0 comments on commit 3ee1011

Please sign in to comment.