mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Issue #2083: use empty field delimiter and tab separator for new copy-lines feature
This commit is contained in:
@@ -6591,8 +6591,8 @@ begin
|
||||
actPreviousResult.Enabled := HasConnection and QueryTabs.HasActiveTab and Assigned(QueryTabs.ActiveTab.ActiveResultTab);
|
||||
actNextResult.Enabled := actPreviousResult.Enabled;
|
||||
|
||||
// Activate export-options if we're on Data- or Query-tab
|
||||
actExportData.Enabled := HasConnection and inDataOrQueryTabNotEmpty;
|
||||
// Activate export-options if we're in any list control
|
||||
actExportData.Enabled := HasConnection;
|
||||
actDataSetNull.Enabled := HasConnection and inDataOrQueryTab and Assigned(Results) and Assigned(Grid.FocusedNode);
|
||||
|
||||
// Help only supported on regular MySQL and MariaDB servers
|
||||
@@ -11832,6 +11832,7 @@ var
|
||||
Node: PVirtualNode;
|
||||
Col: TColumnIndex;
|
||||
Indent, NodesCopied: Integer;
|
||||
IsFirstCol: Boolean;
|
||||
begin
|
||||
// Copy tree nodes as CSV, from any VirtualTree, not only from data or result grids
|
||||
// See issue #2083
|
||||
@@ -11852,18 +11853,21 @@ begin
|
||||
Grid := TVirtualStringTree(SenderControl);
|
||||
// Grid.CopyToClipboard; // Does nothing (?)
|
||||
|
||||
Separator := ';';
|
||||
Encloser := '"';
|
||||
Separator := #9;
|
||||
Encloser := '';
|
||||
Terminator := SLineBreak;
|
||||
|
||||
Header := '';
|
||||
Col := Grid.Header.Columns.GetFirstVisibleColumn(True);
|
||||
IsFirstCol := True;
|
||||
while Col > NoColumn do begin
|
||||
Data := Grid.Header.Columns[Col].Text;
|
||||
Data := StringReplace(Data, Encloser, Encloser+Encloser, [rfReplaceAll]);
|
||||
if not Header.IsEmpty then
|
||||
//Data := StringReplace(Data, Encloser, Encloser+Encloser, [rfReplaceAll]);
|
||||
if not IsFirstCol then
|
||||
Header := Header + Separator;
|
||||
Header := Header + Encloser + Data + Encloser;
|
||||
IsFirstCol := False;
|
||||
//Header := Header + Encloser + Data + Encloser;
|
||||
Header := Header + Data;
|
||||
Col := Grid.Header.Columns.GetNextVisibleColumn(Col);
|
||||
end;
|
||||
Header := Header + Terminator;
|
||||
@@ -11873,23 +11877,30 @@ begin
|
||||
Node := Grid.GetFirstInitialized;
|
||||
while Assigned(Node) do begin
|
||||
if Grid.IsVisible[Node] then begin
|
||||
IsFirstCol := True;
|
||||
Line := '';
|
||||
|
||||
// One empty cell for each indentation level
|
||||
for Indent := 1 to Grid.GetNodeLevel(Node) do begin
|
||||
if not Line.IsEmpty then
|
||||
if not IsFirstCol then
|
||||
Line := Line + Separator;
|
||||
Line := Line + Encloser + Encloser;
|
||||
IsFirstCol := False;
|
||||
//Line := Line + Encloser + Encloser;
|
||||
end;
|
||||
|
||||
// Add data cells
|
||||
Col := Grid.Header.Columns.GetFirstVisibleColumn(True);
|
||||
while Col > NoColumn do begin
|
||||
Data := Grid.Text[Node, Col];
|
||||
Data := StringReplace(Data, Encloser, Encloser+Encloser, [rfReplaceAll]);
|
||||
if not Line.IsEmpty then
|
||||
//Data := StringReplace(Data, Encloser, Encloser+Encloser, [rfReplaceAll]);
|
||||
if not IsFirstCol then
|
||||
Line := Line + Separator;
|
||||
Line := Line + Encloser + Data + Encloser;
|
||||
IsFirstCol := False;
|
||||
//Line := Line + Encloser + Data + Encloser;
|
||||
Line := Line + Data;
|
||||
Col := Grid.Header.Columns.GetNextVisibleColumn(Col);
|
||||
end;
|
||||
|
||||
Body := Body + Line + Terminator;
|
||||
Inc(NodesCopied);
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user