package com.biggestnerd.altviewer;

import java.util.ArrayList;
import java.util.List;

public class TabComplete {

	private String startString;
	private List<String> possibleOptions;
	int index = -1;
	
	public TabComplete(String startString) {
		this.startString = startString;
		possibleOptions = new ArrayList<String>();
	}
	
	public void addOptions(List<String> options) {
		for(String s : options) {
			if(s.toLowerCase().startsWith(startString.toLowerCase()) && !possibleOptions.contains(s)) {
				possibleOptions.add(s);
			}
		}
	}
	
	public void removeOptions(List<String> options) {
		possibleOptions.removeAll(options);
	}
	
	public String nextOption() {
		if(index == possibleOptions.size() - 1) {
			index = 0;
		} else {
			index++;
		}
		return possibleOptions.get(index);
	}
}

@@ -659,16 +659,106 @@
 ion() %7B%0A
+%09%09if(possibleOptions.size() == 0 %7C%7C possibleOptions == null) %7B%0A%09%09%09return startString;%0A%09%09%7D%0A
 %09%09if(ind

Update TabComplete.java