void EditorModel::addNewLineInMiddle(){
	// Initialize variables concerning text
	const int currentColumnNum = cursorColumn()-1;
	const int currentLineNum = cursorLine();

	const std::string& currentString = text.at(currentLineNum);
	const int currentLineLen = currentString.length();

	std::string beforeCursor = currentString.substr(0, currentColumnNum);			  // This is the string left behind
	std::string afterCursor = currentString.substr(currentColumnNum, currentLineLen); // This is the string that gets put in new line

	// Sets line position to add new line
	std::vector<std::string>::iterator linePosition;
	linePosition = text.begin()+cursorLine()+1;

	// Assign new line to text
	text.at(currentLineNum) = beforeCursor;
	text.insert(linePosition, afterCursor);
}
void MetaInfo::save( KConfig * conf )
{
	conf->writeEntry( "Bookmarks", bookmarks() );
	conf->writeEntry( "Breakpoints", breakpoints() );
	conf->writeEntry( "OutputMethod", toID(outputMethodInfo().method()) );
	conf->writePathEntry( "OutputPath", outputMethodInfo().outputFile().prettyURL() );
	conf->writeEntry( "OutputPicID", outputMethodInfo().picID() );
	conf->writeEntry( "CursorLine", cursorLine() );
	conf->writeEntry( "CursorColumn", cursorColumn() );
}
void EditorModel::deleteNewLineInMiddle(){
	// Initialize variables concerning text
	const int currentLineNum = cursorLine();

	// Gets line of text to be removed from the middle
	const std::string& currentString = text.at(currentLineNum);

	// Add line of text to previous line, delete current one from the middle
	text.at(currentLineNum-1) += currentString;
	text.erase(text.begin() + currentLineNum);
}
// DELETE HANDLING FUNCTIONS
void EditorModel::deleteNewLine(){
	// Initialize variables concerning text
	const int currentLineNum = cursorLine();

	// Gets line of text to be removed
	const std::string& currentString = text.at(currentLineNum);

	// Add line of text to previous line, delete current one
	text.at(currentLineNum-1) += currentString;
	text.pop_back();
}
void EditorModel::deleteChar(){
	// Initialize variables concerning text
	const int currentColumnNum = cursorColumn()-1;
	const int currentLineNum = cursorLine();

	// Get current line of string to be worked with
	const std::string& currentString = text.at(currentLineNum);
	const int currentLineLen = currentString.length();

	// Get two strings of text from before and after cursor
	std::string beforeCursor = currentString.substr(0, currentColumnNum-1);
	std::string afterCursor = currentString.substr(currentColumnNum, currentLineLen);

	// Assign line of text to new string without deleted character
	text.at(currentLineNum) = beforeCursor + afterCursor;
}
void EditorModel::insertNewLine(){
	// Initialize variables concerning text
	const int currentColumnNum = cursorColumn()-1;
	const int currentLineNum = cursorLine();

	const std::string& currentString = text.at(currentLineNum);
	const int currentLineLen = currentString.length();

	// String of text before cursor
	std::string beforeCursor = currentString.substr(0, currentColumnNum);
	// String of text after cursor
	std::string afterCursor = currentString.substr(currentColumnNum, currentLineLen);

	// Assigns previous line to string of text before cursor, adds text after cursor to new line
	text.at(currentLineNum) = beforeCursor;
	text.push_back(afterCursor);
}
// INSERT HANDLING FUNCTIONS
void EditorModel::insert(const char c){

	// Initialize variables concerning text
	const int currentColumnNum = cursorColumn()-1;
	const int currentLineNum = cursorLine();

	const std::string& currentString = text.at(currentLineNum);
	const int currentLineLen = currentString.length();


	// String of text before cursor
	std::string beforeCursor = currentString.substr(0, currentColumnNum);
	// String of text after cursor
	std::string afterCursor = currentString.substr(currentColumnNum, currentLineLen);
	// New string created from inserting new character
	std::string newString = beforeCursor + c + afterCursor;

	// Assign line of text to new string created
	text.at(currentLineNum) = newString;
}