Opened 14 years ago
Closed 12 years ago
#1861 closed Bug (Fixed)
_ArrayDisplay: Bug when data contains separator and $sHeader is used
Reported by: | Thomas Rupp <thomas.rupp@…> | Owned by: | guinness |
---|---|---|---|
Milestone: | 3.3.9.5 | Component: | Standard UDFs |
Version: | 3.3.6.1 | Severity: | None |
Keywords: | Cc: |
Description (last modified by trancexx)
If the table to display contains the default GUIDataSeparatorChar ("|") and you use $sHeader the resulting display is wrong.
Example:
#include <array.au3> Global $aTestArray1[1] = ["Test|Row 1"] _ArrayDisplay($aTestArray1, "Test Array 1", -1, 0, "", "|", "Rows|Column0")
should result in:
Rows Column0
[0] Test|Row 1
but you get:
Rows|Column0
[0]
[0]
Suggested solution:
Replace (starting with line 362):
; Set header up If $sHeader = "" Then $sHeader = "Row " ; blanks added to adjust column size for big number of rows For $i = 0 To $iSubMax $sHeader &= $sSeparator & "Col " & $i Next EndIf
with:
; Set header up If $sHeader = "" Then $sHeader = "Row " ; blanks added to adjust column size for big number of rows For $i = 0 To $iSubMax $sHeader &= $sSeparator & "Col " & $i Next ElseIf $sDataSeparatorChar <> $sSeparator Then $sHeader = StringReplace($sHeader, $sDataSeparatorChar, $sSeparator) EndIf
Attachments (0)
Change History (4)
comment:1 Changed 14 years ago by mvg
comment:2 Changed 14 years ago by mvg
First problem I see here is that at [1] the default Chr(124) delimiter is activly skipped as part of the array data checkup part, or if will never fail if the delimiter character is used/present in the array data.
A second (general) problem ... is that if the function allouws to set the used delimiter it should either be used onconditionally. And not be addjusted to a free delimiter character.
The point here in my mind is that if you adjust the used delimiter ... there seems to be no use for it as a supported parameter. (as the delimiter only purpuse is to make the array display not to get mangled up by a inappropriate used delimiter-char.)
... that makes any sense ?
Func _ArrayDisplay(Const ByRef $avArray, $sTitle = "Array: ListView Display", $iItemLimit = -1, $iTranspose = 0, $sSeparator = "", $sReplace = "|", $sHeader = "") ;; <snip> ; Separator handling ;~ If $sSeparator = "" Then $sSeparator = Chr(1) If $sSeparator = "" Then $sSeparator = Chr(124) ; Check the separator to make sure it's not used literally in the array If _ArraySearch($avArray, $sSeparator, 0, 0, 0, 1) <> -1 Then For $x = 1 To 255 [1] If $x >= 32 And $x <= 127 Then ContinueLoop Local $sFind = _ArraySearch($avArray, Chr($x), 0, 0, 0, 1) If $sFind = -1 Then $sSeparator = Chr($x) ExitLoop EndIf Next EndIf ;; <snip>
comment:3 Changed 13 years ago by trancexx
- Description modified (diff)
comment:4 Changed 12 years ago by guinness
- Milestone set to 3.3.9.5
- Owner changed from Gary to guinness
- Resolution set to Fixed
- Status changed from new to closed
Fixed by revision [7212] in version: 3.3.9.5
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Please (redo and) use correct and runnable example code.
| Global $aTestArray1[1] = Test|Row 1?