FIX: Don't copy last LineEnding when copy file names to clipboard

This commit is contained in:
Alexander Koblov 2010-01-25 11:25:33 +00:00
commit aab2d027f8
2 changed files with 19 additions and 1 deletions

View file

@ -612,7 +612,7 @@ begin
end;
Clipboard.Clear; // prevent multiple formats in Clipboard (specially synedit)
Clipboard.AsText := sl.Text;
Clipboard.AsText:= TrimRightLineEnding(sl.Text, sl.TextLineBreakStyle);
end;
finally

View file

@ -251,6 +251,12 @@ function RemoveQuotation(const Str: String): String;
@param(CmdLine Command line)
}
procedure SplitArgs(var Args: TOpenStringArray; CmdLine: String);
{en
Remove last line ending in text
@param(sText Text)
@param(TextLineBreakStyle Text line break style)
}
function TrimRightLineEnding(const sText: UTF8String; TextLineBreakStyle: TTextLineBreakStyle): UTF8String;
procedure ParseLineToList(sLine: String; ssItems: TStrings);
procedure InsertFirstItem(sLine: String; comboBox: TCustomComboBox);
@ -894,6 +900,18 @@ begin
end;
end;
function TrimRightLineEnding(const sText: UTF8String;
TextLineBreakStyle: TTextLineBreakStyle): UTF8String;
const
TextLineBreakArray: array[TTextLineBreakStyle] of Integer = (1, 2, 1);
var
I, L: Integer;
begin
L:= Length(sText);
I:= TextLineBreakArray[TextLineBreakStyle];
Result:= Copy(sText, 1, L - I); // Copy without last line ending
end;
procedure ParseLineToList(sLine: String; ssItems: TStrings);
var
xPos: Integer;