LinesUnwrap?

English main discussion
Post Reply
  • Author
  • Message
Offline
Posts: 17
Joined: Mon Mar 25, 2013 7:38 am

LinesUnwrap?

Post by Hanging »

In newer versions, I don't find the old LinesUnwrap script. I would like to have that capability, e.g. to take the following...

My line
that is wrapped
with newlines

...select it, and have it automatically take out the newlines so that it becomes...

My line that is wrapped with newlines

...and it seems that the old LinesUnwrap could do this. Where is this capability in Akelpad now?

By the way, thanks very much for updating Akelpad for Windows 11. I was getting worried that we would fall too far behind. Now I only wish there were an Akelpad for Linux, as Windows 11 is so awful that I will never have another Windows computer after this. When Microsoft forces users to "upgrade" to Windows 12, I'll be jumping ship. I'm already learning Linux Mint which I installed on my old Windows 10 laptop. About the only program I miss is Akelpad!

Offline
Posts: 58
Joined: Sat Jul 05, 2008 11:30 am
Location: Odesa, Ukraine

Re: LinesUnwrap?

Post by ewild »

Hanging,
Feel free to try something as simple as this:
RemoveNewLines.js

Code: Select all

// RemoveNewLines.js
// 2026-03-02 by ewild
// Usage:
// "Remove NewLines" Call("Scripts::Main",1,"RemoveNewLines.js")

// get selection
start=AkelPad.GetSelStart();// initial selection start offset
end=AkelPad.GetSelEnd();// initial selection end offset

// if there's no selection, select the entire text
if (start == end)
AkelPad.SetSel(0,-1);

text=AkelPad.GetSelText();// select action

text=text.replace(/[\s]*\r+[\s]*/gm," ");// replace new lines (and the adjacent whitespaces, if any) with a single whitespace
text=text.replace(/^\s*|\s*$/g,"");// replace leading and trailing whitespaces and new lines (if any) with nothing

AkelPad.ReplaceSel(text); // replace action

AkelPad.SetSel(start,start);// restore initial cursor position

Offline
Site Admin
Posts: 6430
Joined: Thu Jul 06, 2006 7:20 am

Re: LinesUnwrap?

Post by Instructor »

Post Reply