Sublime Forum

Difference between view.lines() and view.splitByNewLines()

#1

I’ve tried both and a few random inputs, and they seem to produce the same result (they return a list of regions which make up each line in my original region).

What am I missing?

0 Likes

#2

lines() spans the whole line no matter what while splitByNewLines() keeps the selection boundaries untouched.

[code]
this [is a line
this is] a line

…] denotes the visual selection

view.splitByNewlines(view.sel()[0])
(5, 14), (15, 20)]

view.lines(view.sel()[0])
(0, 14), (15, 29)][/code]

0 Likes

#3

Oh yeah that makes sense.
Thanks!

0 Likes