public static final ArrayList<String> extractLines(String data, int tabWidth) {
		int length = data.length();
		StringBuilder buffer = new StringBuilder(length);
		char ignoreCh = 0;
		ArrayList<String> lines = new ArrayList<>();
		int column = 0;

		for (int i = 0; i < length; i++) {
			char ch = data.charAt(i);

			if (ch == ignoreCh) {
				ignoreCh = 0;
			} else if (ch == '\r') {
				ignoreCh = '\n';
				column = 0;
				lines.add(buffer.toString());
				buffer.setLength(0);
			} else if (ch == '\n') {
				ignoreCh = '\r';
				column = 0;
				lines.add(buffer.toString());
				buffer.setLength(0);
			} else if (ch == '\t' && tabWidth > 0) {
				int spaces = tabWidth - column % tabWidth;

				ignoreCh = 0;
				while (--spaces >= 0) {
					buffer.append(' ');
					column++;
				}
			} else {
				ignoreCh = 0;
				column++;
				buffer.append(ch);
			}
		}
		if (buffer.length() > 0) {
			lines.add(buffer.toString());
		}

		return lines;
	}