From d96a133c6a1df11f41f40c9437b716337f79d317 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Tue, 9 Aug 2011 14:28:58 +0200 Subject: [PATCH] HL : Correction of a bug of reparsing the buffer betwwen 2 element Erase was not implemented as std::vector ==> I might change this ... --- Sources/Highlight/Highlight.cpp | 7 ++-- Sources/tools/EdnBuf/EdnBuf_HighLight.cpp | 35 +++++++++++++--- Sources/tools/NameSpaceEdn/VectorType.h | 2 - avancement.boo | 1 - test2.c | 50 +---------------------- 5 files changed, 35 insertions(+), 60 deletions(-) diff --git a/Sources/Highlight/Highlight.cpp b/Sources/Highlight/Highlight.cpp index 067d618..e5cbc23 100644 --- a/Sources/Highlight/Highlight.cpp +++ b/Sources/Highlight/Highlight.cpp @@ -186,9 +186,10 @@ void Highlight::Display(void) //m_listHighlightPass2[i]->Display(); } } +// 13h 46min 22s | (l= 214) Highlight::Parse | [II] Find Pattern in the Buffer : (2457,2479) -// TODO : Celui qui appelle suprime des element pour rien ... Enfin c'est pas tr\Uffffffffgrave... Il suffirait juste de suprimer celuis d'avant si il n'est pas terminer... +// TODO : Celui qui appelle suprime des element pour rien ... Enfin c'est pas trègrave... Il suffirait juste de suprimer celuis d'avant si il n'est pas terminer... void Highlight::Parse(int32_t start, int32_t stop, Edn::VectorType &metaData, @@ -205,8 +206,7 @@ void Highlight::Parse(int32_t start, while (elementStartGetName(); + } + EDN_DEBUG("HighLight (previous) element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp ); + } + */ int32_t posEnd = pos + nbDeleted; // search position of the old element to reparse IT... int32_t startId; @@ -79,15 +88,29 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd } else if(-1 == startId) { if (0 == stopId){ m_HLDataPass1.Erase(0); + //EDN_DEBUG("1 * Erase 0"); } else { m_HLDataPass1.Erase(0,stopId); + //EDN_DEBUG("2 * Erase 0->" << stopId); } } else if(-1 == stopId) { - m_HLDataPass1.Erase(startId+1, m_HLDataPass1.Size()); + //EDN_DEBUG("3 * Erase " << startId+1 << "-> end"); + m_HLDataPass1.Erase(startId+1, m_HLDataPass1.Size() - startId); + stopId = -1; } else { - m_HLDataPass1.Erase(startId+1, stopId); + //EDN_DEBUG("4 * Erase " << startId+1 << "->" << stopId); + m_HLDataPass1.Erase(startId+1, stopId - startId); } - EDN_DEBUG("new size=" << (int32_t)m_HLDataPass1.Size()-1); + //EDN_DEBUG("new size=" << (int32_t)m_HLDataPass1.Size()-1); + /* + for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) { + Edn::String ploppp; + if (NULL != m_HLDataPass1[i].patern ) { + ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName(); + } + EDN_DEBUG("HighLight (Middle) element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp ); + } + */ // update position after the range position : int32_t elemStart; if(-1 == startId) { @@ -123,13 +146,15 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd //GenerateHighLightAt(pos, nbAdded); GenerateHighLightAt(0, m_data.Size()); } + /* for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) { Edn::String ploppp; if (NULL != m_HLDataPass1[i].patern ) { ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName(); } - //EDN_DEBUG("HighLight element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp.c_str() ); + EDN_DEBUG("HighLight (end) element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp ); } + */ GTimeVal timeStop; g_get_current_time(&timeStop); EDN_DEBUG("HL General = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s"); diff --git a/Sources/tools/NameSpaceEdn/VectorType.h b/Sources/tools/NameSpaceEdn/VectorType.h index c09a760..8d32998 100644 --- a/Sources/tools/NameSpaceEdn/VectorType.h +++ b/Sources/tools/NameSpaceEdn/VectorType.h @@ -36,8 +36,6 @@ * * @tparam[in] SIZE Size of the current element. * - * @todo : Need to add : popBack / Assign / Insert / Erase / Swap / Clear - * * m_data * <------------ m_dataSize ------------> * ---------------------------------------- diff --git a/avancement.boo b/avancement.boo index acca70d..6bdb0a9 100644 --- a/avancement.boo +++ b/avancement.boo @@ -17,7 +17,6 @@ - Project manager phase 1 # action a faire (ordonner) : - - HL : Parsing caracter/caractère et plus section par section ... - ctags : Back simple et multiple - ctags : Multiple files - sys : search complet, replace complet diff --git a/test2.c b/test2.c index 7993bf8..bd99f89 100644 --- a/test2.c +++ b/test2.c @@ -19,54 +19,6 @@ #include "tools_globals.h" #include "EdnBuf.h" - -#undef __class__ -#define __class__ "EdnBuf" - -static void addPadding(char *string, int32_t startIndent, int32_t toIndent, int32_t tabDist, int32_t useTabs, int32_t *charsAdded); -static int32_t textWidth(EdnVectorBin &text, int32_t tabDist); - - -/** - * @brief convertion table for non printable control caracters - */ -static const char *ControlCodeTable[32] = { - "NUL", "soh", "stx", "etx", "eot", "enq", "ack", "bel", "bs", "ht", "nl", "vt", "np", "cr", "so", "si", - "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb", "can", "em", "sub", "esc", "fs", "gs", "rs", "us"}; - -#endif - -/** - * @brief Constructor of the Edn buffer Text : - * - * Create an empty text buffer of a pre-determined size - * - * @param[in] requestedSize use this to avoid unnecessary re-allocation if you know exactly how much the buffer will need to hold - * - */ -EdnBuf::EdnBuf(void) -{ - m_tabDist = 4; - m_useTabs = true; - - // Current selection - m_selectionList[SELECTION_PRIMARY].selected = false; - m_selectionList[SELECTION_PRIMARY].zeroWidth = false; - m_selectionList[SELECTION_PRIMARY].rectangular = false; - m_selectionList[SELECTION_PRIMARY].start = m_selectionList[SELECTION_PRIMARY].end = 0; - m_selectionList[SELECTION_SECONDARY].selected = false; - m_selectionList[SELECTION_SECONDARY].zeroWidth = false; - m_selectionList[SELECTION_SECONDARY].rectangular = false; - m_selectionList[SELECTION_SECONDARY].start = m_selectionList[SELECTION_SECONDARY].end = 0; - m_selectionList[SELECTION_HIGHTLIGHT].selected = false; - m_selectionList[SELECTION_HIGHTLIGHT].zeroWidth = false; - m_selectionList[SELECTION_HIGHTLIGHT].rectangular = false; - m_selectionList[SELECTION_HIGHTLIGHT].start = m_selectionList[SELECTION_HIGHTLIGHT].end = 0; - - // charset : - m_isUtf8 = false; - m_charsetType = EDN_CHARSET_ISO_8859_1; - m_isUndoProcessing = false; m_isRedoProcessing = false; @@ -77,4 +29,4 @@ EdnBuf::EdnBuf(void) //m_Highlight = NULL; m_nbLine = 1; m_HLDataSequence = 0; -} +