Line Sorting Feature in EmEditor: Arrange Based on Line Size for Improved Readability

Line Sorting Feature in EmEditor: Arrange Based on Line Size for Improved Readability

Charles Lv8

Line Sorting Feature in EmEditor: Arrange Based on Line Size for Improved Readability

Viewing 2 posts - 1 through 2 (of 2 total)

  • Author
    Posts
  • February 26, 2012 at 4:44 pm #10085
    user
    Participant
    hello
    in Emeditor, there is a feature to sort lines alphabetically or arithmetically, but how can I sort lines according to their length?
    thanks!
    February 27, 2012 at 4:25 am #10087
    zhouzh2
    Participant
    Hi user,
    I wrote this macro for you:
    document.selection.EndOfDocument(false);
    endOfDocu = document.selection.GetActivePointY(eePosView);
    document.selection.StartOfDocument(false);
    document.selection.EndOfLine(false,eeLineView);
    currentCursor = document.selection.GetActivePointY(eePosView);
    while (endOfDocu != currentCursor) {
    currentCursor = document.selection.GetActivePointY(eePosView);
    numberOfChar = document.selection.GetActivePointX(eePosLogical) - 1;
    document.selection.StartOfLine(false,eeLineView | eeLineHomeText);
    document.selection.Text=numberOfChar + “: “;
    document.selection.LineDown(false,1);
    document.selection.EndOfLine(false,eeLineView);
    This macro will add numbers which indicate the number of characters of the line to the start of lines.

After that,you can use the “sort” of emeditor.
Than replace “^d+?:s” with NULL to restore orginial line.
Hope it helps. :-)
Cheers,
angus.

  • Author
    Posts

Viewing 2 posts - 1 through 2 (of 2 total)

  • You must be logged in to reply to this topic.

Also read:

https://techidaily.com
  • Title: Line Sorting Feature in EmEditor: Arrange Based on Line Size for Improved Readability
  • Author: Charles
  • Created at : 2024-10-06 18:10:04
  • Updated at : 2024-10-14 09:05:44
  • Link: https://win-info.techidaily.com/line-sorting-feature-in-emeditor-arrange-based-on-line-size-for-improved-readability/
  • License: This work is licensed under CC BY-NC-SA 4.0.
On this page
Line Sorting Feature in EmEditor: Arrange Based on Line Size for Improved Readability