I have thought about this command a bit and all has came to mind so far is pretty straight forward. Grab from current cursor position to end of line and look for text then jump to next line and keep going. I wanted to use the as_str (aka it returns a Option<&str> to get the &str version of the line but I have had that fail before when a line should have returned a Some. It says in the docs that ropey can fail on this when the string is over lapping memory chunks. Just using the normal string.find really seems like a bad idea cause then you would need to turn the RopeSlice into a String. Although that seems undesirable, is it any worse then just iterating over each char on the line? Do we find all locations of this word and store them? Why would we store them? What if we want to highlight all the text on screen above the cursor or below? Seems better to just store the location but then that fails (or needs to be updated) when the user adds or removes text. I could most defiantly make a typical school boy algorithm that does the job but I am no master at any coding for sure.
I have thought about this command a bit and all has came to mind so far is pretty straight forward. Grab from current cursor position to end of line and look for text then jump to next line and keep going. I wanted to use the
as_str(aka it returns aOption<&str>to get the&strversion of the line but I have had that fail before when a line should have returned aSome. It says in the docs that ropey can fail on this when the string is over lapping memory chunks. Just using the normalstring.findreally seems like a bad idea cause then you would need to turn theRopeSliceinto aString. Although that seems undesirable, is it any worse then just iterating over each char on the line? Do we find all locations of this word and store them? Why would we store them? What if we want to highlight all the text on screen above the cursor or below? Seems better to just store the location but then that fails (or needs to be updated) when the user adds or removes text. I could most defiantly make a typical school boy algorithm that does the job but I am no master at any coding for sure.