CudaText: Code Tree tracking is not always correct for C++

I was experimenting with a big C++ file (350 kB) in CudaText - with this one: https://github.com/d0vgan/nppexec/blob/master/NppExec/src/NppExecEngine.cpp

File: NppExecEngine.zip

For example, if I go to line 5433 (it’s within the method CScriptEngine::DoNpeNoEmptyVars), the Code Tree activates an item “fx _T” as if it corresponds to the line 5433. When I double-click this “fx _T” in the Code Tree, it jumps to the line 5210 that corresponds to case _T('S') within a method CScriptEngine::DoNpeCmdAlias. Then, if I go to line 5093 within the same method (it’s under case _T('V')) and double-click the active item in the Code Tree, it jumps to line 5031 (case _T('I')). Another example: when I go to line 4627 (it’s within the method CScriptEngine::DoNpeCmdAlias), the Code Tree activates an item “appendExecText” that is actually a different static function. As we can see, in these cases the active item in the Code Tree does not correspond to the actual code in the editor.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 55 (55 by maintainers)

Commits related to this issue

Most upvoted comments

The latest lexer does exceptional job even with STL headers: https://github.com/microsoft/STL/blob/main/stl/inc/map https://github.com/microsoft/STL/blob/main/stl/inc/algorithm this is amazing!

When it comes to madness, though, such as within https://github.com/microsoft/STL/blob/main/stl/inc/utility it is extremely hard for a human to define the proper complex rules and keep one’s mind 😃 So I think this is the point where it makes sense to stop.

Added this, seems. c++6a.zip

Made the change, seems it’s fixed. c++5d.zip

Wow, the majority of C++ syntax is supported now!

Can something be done to support constructors? (As far as I understand, the problem for the lexer is that they don’t have a return type).

template <class T> CStrT<T>::CStrT() : 
  m_pData(NULL), 
  m_nLength(0), 
  m_nMemSize(0)
{
}

template <class T> CStrT<T>::CStrT(const T* pStr, int nLength) :
  m_pData(NULL),
  m_nLength(0), 
  m_nMemSize(0)
{
    if (pStr && (nLength != 0))  Append(pStr, nLength);
}

Was easy to fix (one regex). c++5c.zip

op2

inline CStringT<T>::operator const T*() const

Yes, you are right - in this case the operator is const T*, where “const” is a part of the operator’s name. Good catch!

You are right, alas, and it’s very hard for me to support the CListT.h. I think I stop here. I just fixed 2 of 5 items from my previous msg. And merged to Git.

Indeed, the “C++_3d.zip” is significantly better! You rock!