public void insertString(int offset, String str, AttributeSet a)
			throws BadLocationException {
		if (str.length() == 1 && str.charAt(0) == '\n' && offset > 0) {// New
																		// line
			String s = getText();
			// Locating previous line
			int lineStart = offset - 1;
			for (; lineStart >= 0; lineStart--) {
				if (s.charAt(lineStart) == '\n') {
					break;
				}
			}
			lineStart++;
			int added;
			for (added = 0; lineStart + added < offset; added++) {
				char c = s.charAt(lineStart + added);
				if (c != ' ' && c != '\t') {
					break;
				}
			}
			if (added > 0) {
				str += s.substring(lineStart, lineStart + added);
			}
		}
		super.insertString(offset, str, a);
	}