AkelPad Forum Index AkelPad
Support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Format plugin
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
 
Post new topic   Reply to topic    AkelPad Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
Infocatcher



Joined: 06 Aug 2007
Posts: 1765

PostPosted: Sat Jan 15, 2011 11:05 pm    Post subject: Reply with quote

KDJ
I think, for remove/extracts lines and reverse order should used buttons.
Back to top
View user's profile Send private message Visit poster's website
KDJ



Joined: 06 Mar 2010
Posts: 1928
Location: Poland

PostPosted: Sun Jan 16, 2011 7:07 pm    Post subject: Reply with quote

Infocatcher wrote:
I think, for remove/extracts lines and reverse order should used buttons.

I did LinesSort.js, but buttons instead of boxes were not good.
Back to top
View user's profile Send private message
Instructor
Site Admin


Joined: 06 Jul 2006
Posts: 6232

PostPosted: Mon Jan 17, 2011 3:13 pm    Post subject: Reply with quote

KDJ wrote:
Well, actually in Format plugin is not option "case sensitive".
May partially solve the problem ColumnsSort.js script.
It is possible via external call with code 1.
Back to top
View user's profile Send private message Send e-mail
KDJ



Joined: 06 Mar 2010
Posts: 1928
Location: Poland

PostPosted: Mon Jan 17, 2011 6:49 pm    Post subject: Reply with quote

Instructor wrote:
It is possible via external call with code 1.

Indeed. Sorry, I had not noticed this before.
Back to top
View user's profile Send private message
cnnnc



Joined: 12 Jan 2008
Posts: 118
Location: Shantou, China

PostPosted: Tue Jan 18, 2011 5:26 am    Post subject: Seperator by any character(s) instead of "\r" only Reply with quote

How about make Seperator by any character(s) instead of "\r" only?
Example - Seperator ";" for following:
Code:
*.rar;*.zip;*.ace;*.arc;*.arj;*.jar;*.cab;*.7z;*.lzh;*.tar;*.bz2;*.gz;*.uha;*.sqx;*.kgb;*.dir;*.uue;*.xxe;*.deb;*.gzip;*.uc2;*.sbc;*.pak;*.tgz;*.bgz

Sort by StringAscending, and then I get:
Code:
*.7z;*.ace;*.arc;*.arj;*.bgz;*.bz2;*.cab;*.deb;*.dir;*.gz;*.gzip;*.jar;*.kgb;*.lzh;*.pak;*.rar;*.sbc;*.sqx;*.tar;*.tgz;*.uc2;*.uha;*.uue;*.xxe;*.zip
Back to top
View user's profile Send private message Send e-mail
KDJ



Joined: 06 Mar 2010
Posts: 1928
Location: Poland

PostPosted: Tue Jan 18, 2011 6:37 pm    Post subject: Re: Seperator by any character(s) instead of "\r" Reply with quote

cnnnc wrote:
How about make Seperator by any character(s) instead of "\r" only?

I think you should use Replace.
Main menu -> Edit -> Replace...
What: \n
With: ;
Select Esc-sequences, and then press Replace all.
All line-end characters will be replaced by a semicolon.
Back to top
View user's profile Send private message
cnnnc



Joined: 12 Jan 2008
Posts: 118
Location: Shantou, China

PostPosted: Wed Jan 19, 2011 5:43 am    Post subject: Re: Seperator by any character(s) instead of "\r" Reply with quote

KDJ wrote:
I think you should use Replace.
...

You get me wrong.
As you mean if I want to sort my string, I have to replace ";" with "\r", and then sort it, finally replace "\r" back to ";".
But my string only in one line, and I just want to get a "aTxt" like this:
Code:
    var pSeperator = ";";
    // ...
    aTxt  = AkelPad.GetSelText(1 /*\r*/).split(pSeperator);

and then sort "aTxt", in this way I can do it easily, not:
Code:
    aTxt  = AkelPad.GetSelText(1 /*\r*/).split("\r");

Your LinesSort.js is Great, but it's only used to deal with the situation of seperator is "\r".
Back to top
View user's profile Send private message Send e-mail
Fr0sT



Joined: 24 Jul 2007
Posts: 876

PostPosted: Wed Jan 19, 2011 7:51 am    Post subject: Reply with quote

Quite useful suggestion IMHO
Back to top
View user's profile Send private message
KDJ



Joined: 06 Mar 2010
Posts: 1928
Location: Poland

PostPosted: Wed Jan 19, 2011 6:41 pm    Post subject: Re: Seperator by any character(s) instead of "\r" Reply with quote

cnnnc wrote:
You get me wrong...

LinesSort.js script is designed to sort lines, and not to sort the words contained between any separators.
Therefore, as separator of strings used newline character (\r or \n).
Maybe, on the basis of LinesSort.js, I'll write a script to sort words (eg. WordsSort.js).
Meanwhile, you can deal with, replacing semicolons with end-line characters and vice versa.
Original string:
Code:
*.zip;*.arj;*.7z;*.rar

Replace ";" with "\n":
Code:
*.zip
*.arj
*.7z
*.rar

Sort lines using Format plugin or LinesSort.js script:
Code:
*.7z
*.arj
*.rar
*.zip

Replace "\n" with ";":
Code:
*.7z;*.arj;*.rar;*.zip
Back to top
View user's profile Send private message
KDJ



Joined: 06 Mar 2010
Posts: 1928
Location: Poland

PostPosted: Wed Jan 19, 2011 7:43 pm    Post subject: Re: Seperator by any character(s) instead of "\r" Reply with quote

Well, the script is almost ready.
Sorting strings contained between the semicolons:
Code:
AkelPad.ReplaceSel(AkelPad.GetSelText().replace(/;/g, "\r"), 1);
AkelPad.Call("Format::LineSortStrAsc");
AkelPad.ReplaceSel(AkelPad.GetSelText().replace(/\r/g, ";"), 1);
Back to top
View user's profile Send private message
Fr0sT



Joined: 24 Jul 2007
Posts: 876

PostPosted: Thu Jan 20, 2011 12:46 pm    Post subject: Reply with quote

cnnnc
you can easily modify the script yourself, just add separator as parameter or do the query for it in the beginning of the script
Back to top
View user's profile Send private message
cnnnc



Joined: 12 Jan 2008
Posts: 118
Location: Shantou, China

PostPosted: Fri Jan 21, 2011 12:09 am    Post subject: Reply with quote

KDJ
It's work. Thank you.
Back to top
View user's profile Send private message Send e-mail
KDJ



Joined: 06 Mar 2010
Posts: 1928
Location: Poland

PostPosted: Thu Jan 27, 2011 6:59 pm    Post subject: Reply with quote

cnnnc
I wrote ListSort.js script that sorts lists separated with any separator, in each line, by using Format plugin.
Back to top
View user's profile Send private message
cnnnc



Joined: 12 Jan 2008
Posts: 118
Location: Shantou, China

PostPosted: Fri Jan 28, 2011 3:05 am    Post subject: Reply with quote

KDJ
I test it. It works very well if I needn't to undo/redo. Its undo/redo is not convenient, because they are a new operation, not just like Akelpad as.
After all it has been quite good. Thank you.
Back to top
View user's profile Send private message Send e-mail
KDJ



Joined: 06 Mar 2010
Posts: 1928
Location: Poland

PostPosted: Sat Jan 29, 2011 10:12 pm    Post subject: Reply with quote

cnnnc
In ListSort.js I changed the action of Undo/Redo. Now it is compatible with AkelPad.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AkelPad Forum Index -> Plugins All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Page 4 of 8

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


SourceForge.net Logo Powered by phpBB © 2001, 2005 phpBB Group