diff --git a/Sources/Buffer/Buffer.cpp b/Sources/Buffer/Buffer.cpp index aec5091..6e79b00 100644 --- a/Sources/Buffer/Buffer.cpp +++ b/Sources/Buffer/Buffer.cpp @@ -474,4 +474,14 @@ int32_t Buffer::AnchorRealId(int32_t anchorID) } } return -1; -} \ No newline at end of file +} + +int32_t Buffer::AnchorCurrentId(void) +{ + for(int32_t iii=0; iii < m_AnchorList.Size(); iii++) { + if (m_AnchorList[iii].m_curent == true) { + return iii; + } + } + return 0; +} diff --git a/Sources/Buffer/Buffer.h b/Sources/Buffer/Buffer.h index 4085180..ecdc8cb 100644 --- a/Sources/Buffer/Buffer.h +++ b/Sources/Buffer/Buffer.h @@ -151,6 +151,7 @@ class Buffer { int32_t m_lineWidth; int32_t m_lineHeight; int32_t AnchorRealId(int32_t anchorID); + int32_t AnchorCurrentId(void); Edn::VectorType m_AnchorList; //!< list of all line anchor in the current buffer int32_t m_uniqueID; diff --git a/Sources/Buffer/BufferText.cpp b/Sources/Buffer/BufferText.cpp index 8967257..d12f3ca 100644 --- a/Sources/Buffer/BufferText.cpp +++ b/Sources/Buffer/BufferText.cpp @@ -397,9 +397,8 @@ void BufferText::GetMousePosition(int32_t width, int32_t height, int32_t &x, int if (x < 0) { x = 0; } -// TODO : REWORK - //x += m_displayStart.x; - //y += m_displayStart.y; + x += m_AnchorList[AnchorCurrentId()].m_displayStart.x; + y += m_AnchorList[AnchorCurrentId()].m_displayStart.y; //EDN_DEBUG("BufferText::GetMousePosition(" << width << "," << height << "); ==> (" << x << "," << y << ")" ); } @@ -578,29 +577,26 @@ void BufferText::ScrollUp(void) */ void BufferText::MoveUpDown(int32_t ofset) { - for (int32_t iii=0; iii < m_AnchorList.Size() ; iii++) { - if (true == m_AnchorList[iii].m_curent) { - if (ofset >= 0) { - int32_t nbLine = m_EdnBuf.NumberOfLines(); - if (m_AnchorList[iii].m_displayStart.y+ofset+3 > nbLine) { - m_AnchorList[iii].m_displayStart.y = nbLine-3; - } else { - m_AnchorList[iii].m_displayStart.y += ofset; - } - m_AnchorList[iii].m_bufferPos = m_EdnBuf.CountForwardNLines(0, m_AnchorList[iii].m_displayStart.y); - m_AnchorList[iii].m_lineId = m_AnchorList[iii].m_displayStart.y; - } else { - ofset *= -1; - if (m_AnchorList[iii].m_displayStart.y < ofset) { - m_AnchorList[iii].m_displayStart.y = 0; - m_AnchorList[iii].m_bufferPos = 0; - m_AnchorList[iii].m_lineId = 0; - } else { - m_AnchorList[iii].m_displayStart.y -= ofset; - m_AnchorList[iii].m_bufferPos = m_EdnBuf.CountForwardNLines(0, m_AnchorList[iii].m_displayStart.y); - m_AnchorList[iii].m_lineId = m_AnchorList[iii].m_displayStart.y; - } - } + int32_t iii=AnchorCurrentId(); + if (ofset >= 0) { + int32_t nbLine = m_EdnBuf.NumberOfLines(); + if (m_AnchorList[iii].m_displayStart.y+ofset+3 > nbLine) { + m_AnchorList[iii].m_displayStart.y = nbLine-3; + } else { + m_AnchorList[iii].m_displayStart.y += ofset; + } + m_AnchorList[iii].m_bufferPos = m_EdnBuf.CountForwardNLines(0, m_AnchorList[iii].m_displayStart.y); + m_AnchorList[iii].m_lineId = m_AnchorList[iii].m_displayStart.y; + } else { + ofset *= -1; + if (m_AnchorList[iii].m_displayStart.y < ofset) { + m_AnchorList[iii].m_displayStart.y = 0; + m_AnchorList[iii].m_bufferPos = 0; + m_AnchorList[iii].m_lineId = 0; + } else { + m_AnchorList[iii].m_displayStart.y -= ofset; + m_AnchorList[iii].m_bufferPos = m_EdnBuf.CountForwardNLines(0, m_AnchorList[iii].m_displayStart.y); + m_AnchorList[iii].m_lineId = m_AnchorList[iii].m_displayStart.y; } } } @@ -788,8 +784,7 @@ void BufferText::cursorMove(int32_t gtkKey) case GDK_Page_Up: # endif //EDN_INFO("keyEvent : "); - // TODO : REWORK - TextDMoveUp(m_AnchorList[1].m_displaySize.x); + TextDMoveUp(m_AnchorList[AnchorCurrentId()].m_displaySize.x); break; # ifdef USE_GTK_VERSION_3_0 case GDK_KEY_Page_Down: @@ -797,8 +792,7 @@ void BufferText::cursorMove(int32_t gtkKey) case GDK_Page_Down: # endif //EDN_INFO("keyEvent : "); - // TODO : REWORK - TextDMoveDown(m_AnchorList[1].m_displaySize.x); + TextDMoveDown(m_AnchorList[AnchorCurrentId()].m_displaySize.x); break; # ifdef USE_GTK_VERSION_3_0 case GDK_KEY_Begin: @@ -1304,10 +1298,11 @@ bool BufferText::AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor) anchor.m_selectionPosStart = -1; anchor.m_selectionPosStop = -1; } else { - anchor.m_selectionPosStart = selStart; - anchor.m_selectionPosStop = selEnd; + anchor.m_selectionPosStart = selStart+1; + anchor.m_selectionPosStop = selEnd+1; } EDN_DEBUG("Request display : line=" << anchor.m_lineNumber << " (" << anchor.m_posStart << "," << anchor.m_posStop << ")"); + EDN_DEBUG(" ==> select : (" << anchor.m_selectionPosStart << "," << anchor.m_selectionPosStop << ")"); return true; } else { return false; diff --git a/Sources/tools/Display/Display.cpp b/Sources/tools/Display/Display.cpp index e5bf719..c6d35f5 100644 --- a/Sources/tools/Display/Display.cpp +++ b/Sources/tools/Display/Display.cpp @@ -159,6 +159,8 @@ DrawerManager::DrawerManager(GtkWidget * widget, int32_t x, int32_t y) cairo_scale(m_cairo, 1.0, 1.0); + m_nbElement = 0; + // http://cairographics.org/FAQ/#clear_a_surface // http://gtk.developpez.com/faq/?page=gtkwidget#GTK_WIDGET_transparent //cairo_set_source_rgba(m_cairo, 1, 1, 1, 0); @@ -289,9 +291,8 @@ void DrawerManager::Flush(void) int32_t letterHeight = Display::GetFontHeight(); if (true == m_selectColor->HaveBg() ) { int32_t letterWidth = Display::GetFontWidth(); - int32_t stringLen = m_nbElement; // generate Clean BG: - DirectRectangle(m_selectColor, m_pos.x, m_pos.y, letterWidth*stringLen, letterHeight); + DirectRectangle(m_selectColor, m_pos.x, m_pos.y, letterWidth*m_nbElement, letterHeight); } cairo_move_to(m_cairo, m_pos.x, m_pos.y+letterHeight-4); m_selectColor->ApplyFG(m_cairo); @@ -350,9 +351,10 @@ void DrawerManager::DirectRectangle(Colorize *SelectColor, int32_t x, int32_t y, // flush cairo_fill(m_cairo); } + + void DrawerManager::DirectRectangle(color_ts &SelectColor, int32_t x, int32_t y, int32_t width, int32_t height) { - cairo_set_source_rgb(m_cairo, SelectColor.red, SelectColor.green, SelectColor.blue); // set postion cairo_rectangle(m_cairo, x, y, width, height); diff --git a/Sources/tools/charset/charset.cpp b/Sources/tools/charset/charset.cpp index f2e3ddc..3069b74 100644 --- a/Sources/tools/charset/charset.cpp +++ b/Sources/tools/charset/charset.cpp @@ -422,7 +422,11 @@ static uint32_t Utf8_GetValue(UTF8Element_ts &Element) int32_t strUtf8Len(const char *input_UTF8) { int32_t count = 0; - int32_t size = strlen(input_UTF8); + int32_t sizeInput = strlen(input_UTF8); + int32_t size = sizeInput; + if (size>20) { + EDN_DEBUG("check SIZE..."); + } uint8_t tmpSize; bool baseValid; while (size > 0) { diff --git a/avancement.boo b/avancement.boo index c1aec8d..c601d46 100644 --- a/avancement.boo +++ b/avancement.boo @@ -10,7 +10,6 @@ - sys : replace TAB with space when Tab is pressed - sys : Catch F[1-12] ==> for user personal event - 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. ==> regarder après avoir fait le display ligne par ligne... - BUG : de copier coller sur les éàè ... - BUG : les caractère multiples type chapot ... - BUG : italique non généré