diff --git a/src/TextLogik.java b/src/TextLogik.java index 3d6ab4f..ab0126e 100644 --- a/src/TextLogik.java +++ b/src/TextLogik.java @@ -27,13 +27,12 @@ public class TextLogik { break; case "DEL": - if (command.length == 1){ - text.del(TextInput.checkForInput().length); - }else if (isNumeric(command[1])){ + if (command.length == 1) { + text.del(); + } else if (isNumeric(command[1])) { int line = Integer.parseInt(command[1]); - - text.del(line, text.size () - 1); - }else { + text.del(line); + } else { textOutput.errorInvalidCommand(); } break; @@ -62,15 +61,15 @@ public class TextLogik { break; case "REPLACE": if (command.length == 1){ - text.replace(TextInput.getTextInput()); + text.replace(TextInput.getTextInput(), TextInput.getTextInput()); }else if(isNumeric(command[1])) { int line = Integer.parseInt(command[1]); - text.replace(line, text.size() - 1); + text.replace(line, TextInput.getTextInput(), TextInput.getTextInput()); }else { textOutput.errorInvalidCommand(); } - } + break; default: System.out.println("Command not found. Try again");