From 2714560c387ac24aac81d4382df450378e71f229 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Tue, 6 Sep 2011 09:11:51 +0200 Subject: [PATCH] SYS : Indent with TAB only when multiple line selected --- Sources/Buffer/BufferText.cpp | 16 ++++++++++++--- .../CustumWidget/BufferView/BufferView.cpp | 20 ++----------------- avancement.boo | 3 +-- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/Sources/Buffer/BufferText.cpp b/Sources/Buffer/BufferText.cpp index 56c10ea..c7f862f 100644 --- a/Sources/Buffer/BufferText.cpp +++ b/Sources/Buffer/BufferText.cpp @@ -968,10 +968,20 @@ void BufferText::AddChar(char * UTF8data) m_EdnBuf.Insert(m_cursorPos, tmpVect); SetInsertPosition(m_cursorPos+1, true); } else { - if (true == globals::IsSetShift() ) { - m_cursorPos = m_EdnBuf.UnIndent(SELECTION_PRIMARY); + // Indent depend of the multiline in the selection ... + // count the number of line : + int32_t nbSelectedLines = m_EdnBuf.CountLines(SelectionStart, SelectionEnd); + if (0 == nbSelectedLines) { + Edn::VectorType tmpVect; + tmpVect.PushBack(0x09); + m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, tmpVect); + SetInsertPosition(SelectionStart+tmpVect.Size(), true); } else { - m_cursorPos = m_EdnBuf.Indent(SELECTION_PRIMARY); + if (true == globals::IsSetShift() ) { + m_cursorPos = m_EdnBuf.UnIndent(SELECTION_PRIMARY); + } else { + m_cursorPos = m_EdnBuf.Indent(SELECTION_PRIMARY); + } } } actionDone = true; diff --git a/Sources/CustumWidget/BufferView/BufferView.cpp b/Sources/CustumWidget/BufferView/BufferView.cpp index ea44ba1..534bbc5 100644 --- a/Sources/CustumWidget/BufferView/BufferView.cpp +++ b/Sources/CustumWidget/BufferView/BufferView.cpp @@ -339,25 +339,8 @@ gint BufferView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, g //EDN_INFO(" plop %d / %d = %d ==> %d", (uint32_t)event->y, fontHeight, ((uint32_t)event->y / fontHeight), selectBuf); if ( 0 <= selectBuf) { self->SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, selectBuf); - /* - MainWindows *window = MainWindows::getInstance(); - EDN_INFO(" Event on Buffer " << selectBuf); - // set the new seected Buffer - window->SetSelected(selectBuf); - */ } - }/* else if (event->type == GDK_3BUTTON_PRESS) { - EDN_INFO("mouse-event BT1 ==> Triple Clicked"); - }else if (event->type == GDK_BUTTON_RELEASE) { - EDN_INFO("mouse-event BT1 ==> Realease"); - }*/ - } else if (event->button == 2) { - /* - if (event->type == GDK_BUTTON_PRESS) { - EDN_INFO("mouse-event BT2 PRESS"); - self->m_menuContext->Show(event->x, event->y, false); } - */ } else if (event->button == 3) { if (event->type == GDK_BUTTON_PRESS) { EDN_INFO("mouse-event BT3 PRESS"); @@ -368,7 +351,8 @@ gint BufferView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, g } } } else { - EDN_INFO("mouse-event BT? PRESS"); + // not usefull to redraw + return true; } gtk_widget_queue_draw( widget ); return true; diff --git a/avancement.boo b/avancement.boo index 6ae02b9..cd424b0 100644 --- a/avancement.boo +++ b/avancement.boo @@ -9,11 +9,10 @@ * SQL - sys : replace TAB with space when Tab is pressed - sys : Catch F[1-12] ==> for user personal event - - sys : replace when TAB pressed and the selection did not select more than one Line - BUG : Correction du bug des entré bizard tel que les chapot et les guillemets - BUG : de sélection quand la ligne est pleine et la première ligne séctionnée. - BUG : de copier coller sur les éàè ... - - BUG : sur le caplock et les caractère multiples type chapot ... + - BUG : les caractère multiples type chapot ... - BUG : italique non généré * 0.3.X : - SEARCH : get selected text in the search windows