mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[code] Improved console command editing.
When the user scrolls the history, the draft command is not erased. When pasting a previous command, the text is inserted at the cursor location. Change-Id: I1cd9645de74f34fad4ed0898203e05bd3352456a
This commit is contained in:
@@ -10,9 +10,8 @@ ConsoleEditCell::ConsoleEditCell(Responder * parentResponder, TextFieldDelegate
|
||||
HighlightCell(),
|
||||
Responder(parentResponder),
|
||||
m_textBuffer{0},
|
||||
m_draftTextBuffer{0},
|
||||
m_promptView(ConsoleController::k_fontSize, I18n::Message::ConsolePrompt, 0, 0.5),
|
||||
m_textField(this, m_textBuffer, m_draftTextBuffer, TextField::maxBufferSize(), delegate, true, ConsoleController::k_fontSize)
|
||||
m_textField(this, m_textBuffer, m_textBuffer, TextField::maxBufferSize(), delegate, false, ConsoleController::k_fontSize)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -47,4 +46,11 @@ void ConsoleEditCell::setText(const char * text) {
|
||||
m_textField.setText(text);
|
||||
}
|
||||
|
||||
bool ConsoleEditCell::insertText(const char * text) {
|
||||
bool didCopy = m_textField.insertTextAtLocation(text, m_textField.cursorLocation());
|
||||
if (didCopy) {
|
||||
m_textField.setCursorLocation(m_textField.cursorLocation() + strlen(text));
|
||||
}
|
||||
return didCopy;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user