Files
Upsilon/apps/code/console_edit_cell.h
Léa Saviot 2456c7eeba [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
2017-11-17 11:59:50 +01:00

38 lines
891 B
C++

#ifndef CODE_EDIT_CELL_H
#define CODE_EDIT_CELL_H
#include <escher/responder.h>
#include <escher/highlight_cell.h>
#include <escher/text_field.h>
#include <escher/text_field_delegate.h>
#include <escher/message_text_view.h>
namespace Code {
class ConsoleEditCell : public HighlightCell, public Responder {
public:
ConsoleEditCell(Responder * parentResponder = nullptr, TextFieldDelegate * delegate = nullptr);
// View
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
// Responder
void didBecomeFirstResponder() override;
// Edit cell
void setEditing(bool isEditing, bool reinitDraftBuffer = false);
void setText(const char * text);
bool insertText(const char * text);
private:
char m_textBuffer[TextField::maxBufferSize()];
MessageTextView m_promptView;
TextField m_textField;
};
}
#endif