[SOLVED] Line number: ?
Hi, just having a problem at the moment with my code. its only part of the code from the class
What im trying to do is, when i type in the command goto, it will print the line number in which i chose. example when i type goto, then press 3, it will print out line numbeer 3. but the problem im having is, when i type in goto, 0 which is the line number, it gives me an error.
public void execute()
buffer = new Buffer();
System.out.print("Line number: ");
int pos = Integer.parseInt(getInput());
buffer = editor.getCurrentBuffer();
System.out.println(pos +": " +buffer.getLines().get(pos-1));
how could i fix this so that when i type goto, 0 line, it print out the following
Line number: ?
added the following line
if(getCurrentBuffer().getPos() == 0)
System.out.println("Line Number: ?");