How to select next contiguous range?


#1

Hi there,

I am trying to create a package for grammar check that submit each sentence to a web service for correction.

I’ve got it working for the line I am on :

    editor = atom.workspace.getActiveTextEditor()
    cursor = editor.getCursors()[0]
    range = cursor.getCurrentLineBufferRange()
    line = cursor.getBufferRow()
    oldText = editor.getTextInBufferRange(range)

Then, I can call the webservice (Ginger) for grammar correction with oldText and do editor.setTextInBufferRange(range, result) to replace the text in the buffer.

Now, what I would like to do is to select the next contiguous range in order to process the whole text.

Do you have any idea how this can be done ?

Thanks,
M.


#2

What does next contiguous range means in this context ?
Where does it start, where does it end ?


#3

Hi @jeancroy,

Thanks for your answer.

I was looking to select the next sentence in latex file. I managed to do it by moving the cursor as follows:

cursor.moveToEndOfLine()
cursor.moveToBeginningOfNextWord()

M.