Home Download Buy Blog Forum Support

A preview of side by side compare package ... and questions

A preview of side by side compare package ... and questions

Postby erinata on Mon May 07, 2012 4:57 pm

I am writing a package for side by side comparison between files and clipboard content and more.

Here is a preview screenshot. I guess I do not need to explain too much on what it does. And in case anyone wonder, the 2 panes scroll together if you have a long document, I just cannot show it in screenshots.

Image
Image

I almost complete the basic features of this package but I am stucked at several points that I hope some of you may be able to help me out.

1. I know I can add a little icon next to the line number by using add_region. But can I use my custom png? I've tried that I can use any picture that's in the the "Theme - Default" folder. But is it a bad practice if I ask people to put new pictures in that folder? Or there are other ways to use my custom png that I am missing?

2. As you guys can see in the screen shot, I use a empty line for lines that appear in one document but not the others. But I still think that if I can make arbitrary spaces between lines that would be great. If jps is hearing this.....please please I need this api >_<

3. is there a way to get the end line char using in the document? (now I am assuming all files use \n)
erinata
 
Posts: 29
Joined: Wed Jan 25, 2012 12:19 pm

Re: A preview of side by side compare package ... and questions

Postby quarnster on Mon May 07, 2012 5:10 pm

1. I believe you can do "../MyPackageName/icon" and it'll load "icon.png" from your package.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: A preview of side by side compare package ... and questions

Postby agibsonsw on Mon May 07, 2012 5:25 pm

3. is there a way to get the end line char using in the document? (now I am assuming all files use \n)


View.line_endings()

Returns the line endings used by the current file (String)
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: A preview of side by side compare package ... and questions

Postby erinata on Mon May 07, 2012 5:28 pm

quarnster: Thanks for the trick! I will try it out.

agibsonsw: I tried the View.line_endings(). But in a windows system is gets me \r\n. Even if my whole file use \n ..................
erinata
 
Posts: 29
Joined: Wed Jan 25, 2012 12:19 pm

Re: A preview of side by side compare package ... and questions

Postby agibsonsw on Mon May 07, 2012 5:37 pm

@erinata

I believe you will need to account for \r being present on some systems (Windows) and not others. You can use Python .strip('\r\n') to remove it/them where necessary.

When writing to a view you can (I believe) ignore '\r', but you need to account for it when reading.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 6 guests