diff --git a/Sources/Buffer/Buffer.cpp b/Sources/Buffer/Buffer.cpp index cea16c9..6e3b4c3 100644 --- a/Sources/Buffer/Buffer.cpp +++ b/Sources/Buffer/Buffer.cpp @@ -137,7 +137,6 @@ void Buffer::SetLineDisplay(uint32_t lineNumber) // nothing to do } - /** * @brief * @@ -290,6 +289,21 @@ void Buffer::JumpAtLine(int32_t newLine) // nothing to do } + +/** + * @brief Get the current line (to know where to jump) + * + * @param --- + * + * @return Return the current line number + * + */ +int32_t Buffer::GetCurrentLine(void) +{ + return 0; +} + + /** * @brief request a copy of the selection in the named clipBoard ID * diff --git a/Sources/Buffer/Buffer.h b/Sources/Buffer/Buffer.h index b17b26e..fd78b3f 100644 --- a/Sources/Buffer/Buffer.h +++ b/Sources/Buffer/Buffer.h @@ -106,6 +106,7 @@ class Buffer { virtual void Replace(Edn::String &data); virtual int32_t FindLine(Edn::String &data); virtual void JumpAtLine(int32_t newLine); + virtual int32_t GetCurrentLine(void); protected: bool m_fileModify; //!< diff --git a/Sources/Buffer/BufferText.cpp b/Sources/Buffer/BufferText.cpp index 0aa8dd8..1272d59 100644 --- a/Sources/Buffer/BufferText.cpp +++ b/Sources/Buffer/BufferText.cpp @@ -229,8 +229,6 @@ void BufferText::SetLineDisplay(uint32_t lineNumber) } - - void BufferText::DrawLineNumber(DrawerManager &drawer,char *myPrint, int32_t lineNumber, int32_t positionY) { char tmpLineNumber[50]; @@ -1094,6 +1092,21 @@ void BufferText::JumpAtLine(int32_t newLine) UpdateWindowsPosition(true); } +/** + * @brief Get the current line (to know where to jump) + * + * @param --- + * + * @return Return the current line number + * + */ +int32_t BufferText::GetCurrentLine(void) +{ + return m_EdnBuf.CountLines(0, m_cursorPos); +} + + + void BufferText::Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp) { EDN_INFO("Search data : \"" << data << "\""); diff --git a/Sources/Buffer/BufferText.h b/Sources/Buffer/BufferText.h index 85bd5de..d3eb491 100644 --- a/Sources/Buffer/BufferText.h +++ b/Sources/Buffer/BufferText.h @@ -65,6 +65,8 @@ class BufferText : public Buffer { void Replace(Edn::String &data); int32_t FindLine(Edn::String &data); void JumpAtLine(int32_t newLine); + int32_t GetCurrentLine(void); + void RemoveLine(void); void SelectAll(void); void SelectNone(void); diff --git a/Sources/ctags/CTagsManager.cpp b/Sources/ctags/CTagsManager.cpp index 01b43dc..a89e01c 100644 --- a/Sources/ctags/CTagsManager.cpp +++ b/Sources/ctags/CTagsManager.cpp @@ -119,7 +119,22 @@ void CTagsManager::OnMessage(int32_t id, int32_t dataID) JumpTo(); break; case EDN_MSG__JUMP_BACK: - EDN_INFO("TODO .... jump back"); + if (m_historyList.Size() > 0) { + BufferManager *myBufferManager = BufferManager::getInstance(); + int32_t id = m_historyList.Size()-1; + if (false == myBufferManager->Exist(*m_historyList[id]) ) { + // need to open the file : + int32_t openID = myBufferManager->Open(*m_historyList[id]); + SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, openID); + } else { + SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(*m_historyList[id])); + } + SendMessage(EDN_MSG__CURRENT_GOTO_LINE, m_historyList[id]->GetLineNumber()); + // Remove element .... + delete(m_historyList[id]); + m_historyList[id]=NULL; + m_historyList.PopBack(); + } break; } @@ -169,10 +184,10 @@ enum CTAGS_NUM_COLS }; -void CTagsManager::cb_row (GtkTreeView *p_treeview, - GtkTreePath * p_path, - GtkTreeViewColumn * p_column, - gpointer data) +void CTagsManager::cb_row(GtkTreeView *p_treeview, + GtkTreePath * p_path, + GtkTreeViewColumn * p_column, + gpointer data) { EDN_DEBUG("event"); CTagsManager * self = reinterpret_cast(data); @@ -302,6 +317,15 @@ void CTagsManager::JumpAtID(int32_t selectID) { BufferManager *myBufferManager = BufferManager::getInstance(); Edn::File myFile = m_currentList[selectID].filename; + EDN_INFO("save curent filename and position : "); + int32_t currentSelected = myBufferManager->GetSelected(); + Buffer* tmpBuf = myBufferManager->Get(currentSelected); + if (NULL != tmpBuf) { + Edn::File * bufferFilename = new Edn::File(); + *bufferFilename = tmpBuf->GetFileName(); + bufferFilename->SetLineNumber(tmpBuf->GetCurrentLine()); + m_historyList.PushBack(bufferFilename); + } EDN_INFO(" OPEN the TAG file Destination : " << myFile ); if (false == myBufferManager->Exist(myFile) ) { // need to open the file : diff --git a/Sources/tools/NameSpaceEdn/File.cpp b/Sources/tools/NameSpaceEdn/File.cpp index d161c96..66e0ce7 100644 --- a/Sources/tools/NameSpaceEdn/File.cpp +++ b/Sources/tools/NameSpaceEdn/File.cpp @@ -212,6 +212,10 @@ int32_t Edn::File::GetLineNumber(void) return m_lineNumberOpen; } +void Edn::File::SetLineNumber(int32_t newline) +{ + m_lineNumberOpen = newline; +} bool Edn::File::HasExtention(void) { diff --git a/Sources/tools/NameSpaceEdn/File.h b/Sources/tools/NameSpaceEdn/File.h index ad8b191..28a355f 100644 --- a/Sources/tools/NameSpaceEdn/File.h +++ b/Sources/tools/NameSpaceEdn/File.h @@ -44,6 +44,7 @@ namespace Edn bool HasExtention(void); Edn::String GetExtention(void); int32_t GetLineNumber(void); + void SetLineNumber(int32_t newline); void SetCompleateName(Edn::String &newFilename); const Edn::File& operator= (const Edn::File &ednF );