rsk82 wrote:What is the function to get line length in which cursor exists.
rg = view.line( view.sel() )
length_of_rg = rg.b - rg.a
rsk82 wrote:And second how to get cursor position, that is line number and column number ?
rowcol(point) (int, int) Calculates the 0 based line and column numbers of the point.
is_cursor_at_the_end_of_the_line = view.classify(view.sel().a) & sublime.CLASS_LINE_END != 0
lunixbochs wrote:The actual "cursor" for a selection is sel.b, not sel.a: view.sel().b
This matters if you do an area selection.
sapphirehamster wrote:This is not correct, as randy3k said just above. The "cursor" is at region.end().
print(view.size(), view.sel().b, view.sel().end())
lunixbochs wrote:sapphirehamster wrote:This is not correct, as randy3k said just above. The "cursor" is at region.end().
Wrong. region.end() gives you the side of the region closest to the end of the buffer. region.b is the cursor.
Users browsing this forum: Majestic-12 [Bot], Yahoo [Bot] and 4 guests