Home Download Buy Blog Forum Support

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

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

Postby edanm on Sun May 16, 2010 6:37 am

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?
edanm
 
Posts: 131
Joined: Thu Mar 04, 2010 11:05 pm

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

Postby guillermooo on Sun May 16, 2010 10:57 am

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

Code: Select all
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)]
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

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

Postby edanm on Sun May 16, 2010 11:30 am

Oh yeah that makes sense.
Thanks!
edanm
 
Posts: 131
Joined: Thu Mar 04, 2010 11:05 pm


Return to Plugin Development

Who is online

Users browsing this forum: buzzsawddog and 8 guests