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.
Re: How to duplicate line. [message #43681 is a reply to message #43679] Fri, 19 September 2014 22:22 Go to previous messageGo to previous message
Klugier is currently offline  Klugier
Messages: 1076
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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
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: Sun May 05 11:15:19 CEST 2024

Total time taken to generate the page: 0.01792 seconds