From 2a28d39b3e7053b64b35e7fcc53e9dda906ce4b7 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Fri, 7 Apr 2023 10:32:49 +0200 Subject: [PATCH] Do not cut trailing zeros in scientific values like 2.0e30 => 2.0e3. Closes #1793 --- source/main.pas | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/main.pas b/source/main.pas index 3e4acb7a..319e1f24 100644 --- a/source/main.pas +++ b/source/main.pas @@ -10134,7 +10134,7 @@ end; procedure TMainForm.AnyGridGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; var CellText: string); var - EditingAndFocused: Boolean; + EditingAndFocused, IsScientific: Boolean; RowNumber: PInt64; Results: TDBQuery; Timestamp: Int64; @@ -10178,10 +10178,12 @@ begin end else begin CellText := Results.Col(Column); - // Keep only wanted trailing zeros directly after decimal separator + // Keep only wanted number of trailing zeros after decimal separator + // Bug fixed: Do not cut trailing zeros in scientific values like 2.0e30 => 2.0e3 if (Results.DataType(Column).Category = dtcReal) and (AppSettings.ReadInt(asRealTrailingZeros) >= 0) then begin DotPos := Pos('.', CellText); - if DotPos > 0 then begin + IsScientific := ContainsText(CellText, 'e'); + if (not IsScientific) and (DotPos > 0) then begin NumZeros := 0; NumDecimals := 0; for i:=DotPos+1 to Length(CellText) do begin