Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: CodeEditor, Assist++, Topic++ » How to duplicate line.
How to duplicate line. [message #43582] Sun, 07 September 2014 00:41 Go to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

It's very useful to press Ctrl+D to duplicate line in codeeditor.

Maybe one of next release TheIde You can add this hot key?


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: How to duplicate line. [message #43663 is a reply to message #43582] Thu, 18 September 2014 13:10 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I do not know, as Ctrl+C copies the line when there is not selection, it is matter of pressing Ctrl+C, Ctrl+V.... (or, perhaps Ctrl+C, Home, Ctrl+V)

Mirek
Re: How to duplicate line. [message #43671 is a reply to message #43663] Fri, 19 September 2014 07:05 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Thanks.
(I use many an ide at the same time (for Java, js, a python... ) and it is very convenient to have the single hot key as Ctrl+D or Ctrl+2
to copy a line. Possibly we to make the hot keys similar? )

Thanks. I will try to use.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: How to duplicate line. [message #43679 is a reply to message #43671] Fri, 19 September 2014 21:19 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello sergeynikitin ,

Current line duplication in U++ is similar to M$ Visual Studio. So, I think we shouldn't change this behavior, but we can imrpove one thing "CTRL+C" could copy additional new line symbol to put "CTRL+V" product to new line (This implementetion will be exactly the same like this in Visual Studio and probably other editors).

Personally, I think that Netbeans/Eclipse solution is optimal, because you can decide where to copy new line on the top or on the bottom Smile

Links:
http://stackoverflow.com/questions/2279000/visual-studio-sho rt-cut-key-duplicate-line (Line duplication shortcut for various IDEs)

Sincerely,
Klugier

[Updated on: Fri, 19 September 2014 22:44]

Report message to a moderator

Re: How to duplicate line. [message #43681 is a reply to message #43679] Fri, 19 September 2014 22:22 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Mirek,

I think that current implementetion dosen't work as good as it can. So correct implementation should look like this (Pleace notice that I don't know that it dosen't break rectangular selection):

void TextCtrl::Copy()
{
	WString txt;

	int l, h;
	if(!GetSelection(l, h) && !IsAnySelection()) {
		int i = GetLine(cursor);
		l = GetPos(i);
		h = l + line[i].GetLength();
		txt = "\n";
	}
	if(IsRectSelection())
		txt = CopyRectSelection();
	else
		txt += GetW(l, h - l);
	ClearClipboard();
	AppendClipboardUnicodeText(txt);
	AppendClipboardText(txt.ToString());
}


// File CtrlLib/Text.cpp

New line is genereting by adding simply assignment. One thing is important here, we cannot add + 1 to h local variable, beacuse we don't want to copy line ending new line!!! Can you check this and review this code?

P.S.
It seems that Text.cpp file needs code standarization, because all function opening brakets beggining in the same line where the function name is. More in diff... This implementation works exactly the same like this in Notepad++ (CTRL+D) or Visual Studio(CTRL+C + CTRL+V).

Sincerely,
Klugier


U++ - one framework to rule them all.

[Updated on: Sat, 20 September 2014 12:46]

Report message to a moderator

Re: How to duplicate line. [message #43688 is a reply to message #43681] Sun, 21 September 2014 17:26 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I do not know, Klugier. I think the original behavior is more logical to me, with your patch, I would always needed to place cursor at the end of line after which I wand to insert a duplicate. Original version requires me to place it at the beginning of line before which I want to place it...

Mirek
Re: How to duplicate line. [message #43691 is a reply to message #43671] Sun, 21 September 2014 17:56 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
sergeynikitin wrote on Fri, 19 September 2014 07:05
Thanks.
(I use many an ide at the same time (for Java, js, a python... ) and it is very convenient to have the single hot key as Ctrl+D or Ctrl+2


Well, Ctrl+D is available, so be it Smile

Implemented.

Mirek
Re: How to duplicate line. [message #43697 is a reply to message #43691] Mon, 22 September 2014 18:58 Go to previous message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Thank you!!!

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Previous Topic: CodeEditor: K_F3 does not set the cursor to the search field
Next Topic: Replace in Files removes lines
Goto Forum:
  


Current Time: Fri Mar 29 14:16:33 CET 2024

Total time taken to generate the page: 0.01075 seconds