[DEV] Add the replace mode

This commit is contained in:
Edouard DUPIN 2013-09-30 22:32:36 +02:00
parent 7643f5a736
commit 211c253116
2 changed files with 13 additions and 7 deletions

View File

@ -220,7 +220,13 @@ bool appl::Buffer::OnEventEntry(const ewol::EventEntry& _event) // TODO : , vec2
// normal adding char ...
char output[5];
int32_t nbElement = _event.GetChar().GetUtf8(output);
m_data.Insert(m_cursorPos, (int8_t*)output, nbElement);
if (_event.GetSpecialKey().IsSetInsert() == false) {
m_data.Insert(m_cursorPos, (int8_t*)output, nbElement);
} else {
etk::UniChar value;
esize_t nbElementRemove = Get(m_cursorPos, value);
m_data.Replace(m_cursorPos, nbElementRemove, (int8_t*)output, nbElement);
}
m_cursorPos += nbElement;
}
return true;

View File

@ -486,7 +486,7 @@ int32_t BufferText::Display(ewol::Text& OOText,
OOText.SetPos(tmpCursorPosition);
OOText.SetColor(ColorizeManager::Get(COLOR_CODE_CURSOR));
OOText.SetColorBg(ColorizeManager::Get(COLOR_CODE_CURSOR));
OOText.PrintCursor(ewol::GetCurrentSpecialKeyStatus().IsSetInsert());
OOText.PrintCursor(false);
}
// Display the 80 colomn limit line :
@ -559,7 +559,7 @@ int32_t BufferText::GetMousePosition(vec2 pos)
// TODO : Simplify selection ....
void BufferText::MouseEvent(vec2 pos)
{
if (ewol::GetCurrentSpecialKeyStatus().IsSetShift() ) {
if (false) { //ewol::GetCurrentSpecialKeyStatus().IsSetShift() ) {
MouseSelectFromCursorTo(pos);
} else {
// Get the caracter mouse position
@ -713,11 +713,11 @@ void BufferText::SetInsertPosition(int32_t newPos, bool insertChar)
}
if( false == haveSelectionActive
&& true == ewol::GetCurrentSpecialKeyStatus().IsSetShift() )
&& true == false ) //ewol::GetCurrentSpecialKeyStatus().IsSetShift() )
{
// new selection
m_EdnBuf.Select(rememberCursorPos, m_cursorPos);
} else if( true == ewol::GetCurrentSpecialKeyStatus().IsSetShift()
} else if( true == false //ewol::GetCurrentSpecialKeyStatus().IsSetShift()
&& true == haveSelectionActive)
{
// update selection
@ -946,7 +946,7 @@ void BufferText::AddChar(uniChar_t unicodeData)
m_EdnBuf.ReplaceSelected(tmpVect);
SetInsertPosition(SelectionStart+tmpVect.Size(), true);
} else {
if (true == ewol::GetCurrentSpecialKeyStatus().IsSetShift() ) {
if (true == false ) { //ewol::GetCurrentSpecialKeyStatus().IsSetShift() ) {
m_cursorPos = m_EdnBuf.UnIndent();
} else {
m_cursorPos = m_EdnBuf.Indent();
@ -955,7 +955,7 @@ void BufferText::AddChar(uniChar_t unicodeData)
}
} else if (unicodeData == '\n') {
etk::Vector<int8_t> tmpVect;
if (true == ewol::GetCurrentSpecialKeyStatus().IsSetShift()) {
if (true == false ) { //ewol::GetCurrentSpecialKeyStatus().IsSetShift()) {
tmpVect.PushBack('\r');
} else {
tmpVect.PushBack('\n');