[code] Delete specific lines in the console history with backspace.

Change-Id: I9ed4709937f35c67aea0b958fabbad145b8c0c80
This commit is contained in:
Léa Saviot
2017-11-30 17:45:54 +01:00
parent 62fe441b7a
commit d05ca726b6
3 changed files with 50 additions and 0 deletions

View File

@@ -126,6 +126,14 @@ bool ConsoleController::handleEvent(Ion::Events::Event event) {
m_selectableTableView.reloadData();
m_selectableTableView.selectCellAtLocation(0, m_consoleStore.numberOfLines());
return true;
} else if (event == Ion::Events::Backspace) {
int selectedRow = m_selectableTableView.selectedRow();
assert(selectedRow >= 0 && selectedRow < m_consoleStore.numberOfLines());
m_selectableTableView.deselectTable();
int firstDeletedLineIndex = m_consoleStore.deleteCommandAndResultsAtIndex(selectedRow);
m_selectableTableView.reloadData();
m_selectableTableView.selectCellAtLocation(0, firstDeletedLineIndex);
return true;
}
return false;
}