I have the following function that searches forward relative to the cursor position.
It not found it performs another search from the begining of the whole text.
In this basically I have to add an extra parameter in this function to search forward or backwards relative to the cursor position.
Searching backward have exactly the inverse logic implemented in forwardSearch.
Please suggest to implement backward search .