Add an option for copying with trailing line break in STS (#2122)

This commit is contained in:
Hai Cao
2023-06-27 10:18:57 -07:00
committed by GitHub
parent 95a094438e
commit dbcb156816
2 changed files with 6 additions and 1 deletions

View File

@@ -27,6 +27,11 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
/// </summary> /// </summary>
public bool RemoveNewLines { get; set; } public bool RemoveNewLines { get; set; }
/// <summary>
/// Whether to avoid adding a line break between rows during row concatenation for copying result when the previous row already has a trailing line break.
/// </summary>
public bool AvoidNewLineAfterTailingLineBreak { get; set; }
/// <summary> /// <summary>
/// Whether to include the column headers. /// Whether to include the column headers.
/// </summary> /// </summary>

View File

@@ -789,7 +789,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
} }
} }
// Add line break if this is not the last row in all selections. // Add line break if this is not the last row in all selections.
if (rowIndex + pageStartRowIndex != lastRowIndex) if (rowIndex + pageStartRowIndex != lastRowIndex && (!builder.ToString().EndsWith(Environment.NewLine) || !requestParams.AvoidNewLineAfterTailingLineBreak))
{ {
builder.Append(Environment.NewLine); builder.Append(Environment.NewLine);
} }