EmEditor (text editor) Forum Index
   EmEditor Core Enhancement Suggestions
     Please add the ability to swap lines
Register To Post

Threaded | Oldest First Previous Topic | Next Topic | Bottom
Poster Thread
TommyMills
Posted on: 1/27/2013 11:28 pm
Just popping in
Joined: 12/12/2008
From:
Posts: 6
Re: Please add the ability to swap lines
I would also love this feature. I, too, have created a one line macro to do this in the meantime, but it doesn't work perfectly with "auto indent" enabled. It'd be nice to have this and multi line support too.
ArthurZ
Posted on: 1/25/2013 12:25 pm
Just can't stay away
Joined: 1/26/2012
From:
Posts: 78
Re: Please add the ability to swap lines
Hi Steven,

no, the macro even does not run on highlighted lines.
shx
Posted on: 1/25/2013 9:28 am
Just can't stay away
Joined: 2/18/2009
From:
Posts: 77
Re: Please add the ability to swap lines
Thanks Stefan,

Is it possible to have it move numerous lines if preselected?


----------------
Steven

ArthurZ
Posted on: 1/23/2013 5:59 am
Just can't stay away
Joined: 1/26/2012
From:
Posts: 78
Re: Please add the ability to swap lines
This is an excellent idea and the Macros, too; thank you for supplying them!

Besides, are you the same Stefan who is the moderator on the HippoEdit forum?
Stefan
Posted on: 1/22/2013 8:50 pm
Home away from home
Joined: 7/14/2008
From: Germany, EU
Posts: 259
Re: Please add the ability to swap lines
.

You can extend EmEditor yourself.
Just save a macro, add to My Macros, add an shortcut.
(or use Snippet plugin)


A macro could look like:

SwapWithLineAbove.jsee

document.selection.SelectLine(); //select line with cursor
cLine = document.selection.text; //store line to var
if(cLine.indexOf("\n") < 0){cLine = cLine + "\r\n";}
document.selection.Delete();     //delete line
document.selection.LineUp();     //move cursor up one line
document.write(cLine);           //paste line from var


or

MoveLineUp_(on-and-on).jsee
(assign to Shift+Alt+U)

document.selection.SelectLine(); //select line with cursor
cLine = document.selection.text; //store line to var
if(cLine.indexOf("\n") < 0){cLine = cLine + "\r\n";}
document.selection.Delete();     //delete line
document.selection.LineUp();     //move cursor up on line
document.write(cLine);           //paste line from var
document.selection.LineUp();     //move cursor up one line


and

MoveLineDown_(on-and-on).jsee
(assign to Shift+Alt+D)

document.selection.SelectLine(); //select line with cursor
cLine = document.selection.text; //store line to var
if(cLine.indexOf("\n") < 0){cLine = cLine + "\r\n";}
document.selection.Delete();     //delete line
document.selection.LineDown();   //move cursor down one line
document.write(cLine);           //paste line from var
document.selection.LineUp();     //move cursor up one line



- - -

Swap Lines UpSideDown.jsee

FROM:
1 - x
2 - Y
3 - Z
TO:
3 - Z
2 - Y
1 - x

Sel    = document.selection.text;
SelArr = Sel.split("\r\n"); SelArr.reverse();
for(i=0,L=SelArr.length; i<L; i++){
  document.selection.text = SelArr[i];
  if(i<L-1){document.selection.text ="\r\n";}
}


.
ArthurZ
Posted on: 1/22/2013 1:01 pm
Just can't stay away
Joined: 1/26/2012
From:
Posts: 78
Re: Please add the ability to swap lines
I would disagree with you on this comment Meir,

Such functionality exists in many editors EE has to compete against.
For example Sublime Text can swap lines with Ctrl-Shift-ArrowUp.
And it is one of its most used features: http://bit.ly/VYn8xW

Does it add slowness? I doubt that. Yet, people who shell $50 for an editor probably are on a 2-3 year hardware refresh cycle. For the rest, slowness is in each app.

On the contrary, it adds productivity.

Dragging is not going to do that in one hit, and for example not possible if you want to position a line at the top.

I think most EE users work on platforms as say Unix and use Windows as merely a window into their OS editing files quickly on the Win side. For them using keyboard is more natural and unintuitive than the mouse and they pick new commands naturally.
mguttman
Posted on: 1/22/2013 11:53 am
Just can't stay away
Joined: 11/14/2009
From: Ashdod, Israel
Posts: 76
Re: Please add the ability to swap lines

Oh no! Please no!

EE is a lightning fast, full featured great editor. Why do you need such a "feature"? It requires learning, remembering, a shortcut, configuring GUI, etc., etc. Why can't you select a line and drag it up one line?

Even as it is, there are numerous functions people, including me, are not aware of. These forums are replete with questions about this and that and poor Yutaka has so much work just pointing people in the right direction (meaning the right menus path.)

Please do not burden EE and make it a big footprint, slow monster. We have those and I hate them!

Thumbs down, absolutely, totally!!!


----------------
Regards,
Meir

ArthurZ
Posted on: 1/22/2013 8:57 am
Just can't stay away
Joined: 1/26/2012
From:
Posts: 78
Please add the ability to swap lines
Please add the ability to swap lines

E.g. when we have several lines like

Quote:
int main () {
ofstream myfile;
myfile.open ("example.txt");
myfile.close();
myfile << "Writing this to a file.\n";
return 0; }


May want to swap to
Quote:
int main () {
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();
return 0; }


using a simply keystroke while standing within myfile.close (w/o the need to highlight the line).

Thank You!
Threaded | Oldest First Previous Topic | Next Topic | Top


Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文