-
Hello, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Yes. The methods and fields you need are in static bool isWhiteSpace(char c)
{
return strchr("\t \n\r\0", c) == nullptr;
}
std::string TMyEditor::getWordUnderCursor()
{
std::string s;
uint wordEnd = nextWord(curPtr);
uint wordBegin = prevWord(wordEnd);
for (uint i = wordBegin; i < wordEnd; ++i)
{
char c = bufChar(i);
if (!isWhiteSpace(c))
s.push_back(c);
}
return s;
} Now, the word under the cursor may change whenever the cursor position changes or the editor's contents get modified. Therefore you will need to update the help context in these cases. One possible way is to do it in the |
Beta Was this translation helpful? Give feedback.
Yes. The methods and fields you need are in
TEditor
. For example, to get the word under the cursor using a customTMyEditor
class which inherits fromTEditor
:Now, the word under the cursor may change whenever the cursor position changes or the editor's contents get modified. Therefore you will need to up…