You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/07/05 10:14:13 UTC
[plc4x] 01/02: chore(asciibox): add note about mis-alignment
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit 52edd7092a00ea3bd8781e8c0063921fcf5c8fe2
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Jul 5 11:26:51 2022 +0200
chore(asciibox): add note about mis-alignment
---
plc4go/internal/spi/utils/asciiBox.go | 2 ++
.../main/java/org/apache/plc4x/java/spi/utils/ascii/AsciiBoxWriter.java | 1 +
2 files changed, 3 insertions(+)
diff --git a/plc4go/internal/spi/utils/asciiBox.go b/plc4go/internal/spi/utils/asciiBox.go
index 6fddaa6b8..bb03fd512 100644
--- a/plc4go/internal/spi/utils/asciiBox.go
+++ b/plc4go/internal/spi/utils/asciiBox.go
@@ -132,6 +132,7 @@ func (a *asciiBoxWriter) boxString(name string, data string, charWidth int) Asci
if linePadding < 0 {
linePadding = 0
}
+ // TODO: this distorts boxes...
frontPadding := math.Floor(linePadding / 2.0)
backPadding := math.Ceil(linePadding / 2.0)
boxedString.WriteString(a.verticalLine + strings.Repeat(a.emptyPadding, int(frontPadding)) + line + strings.Repeat(a.emptyPadding, int(backPadding)) + a.verticalLine)
@@ -284,6 +285,7 @@ func (m AsciiBox) String() string {
// BoxBox boxes a box
func (a *asciiBoxWriter) BoxBox(name string, box AsciiBox, charWidth int) AsciiBox {
+ // TODO: if there is a box bigger then others in that this will get distorted
return a.BoxString(name, box.data, charWidth)
}
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/utils/ascii/AsciiBoxWriter.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/utils/ascii/AsciiBoxWriter.java
index 69a9e5311..6ad510b4c 100644
--- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/utils/ascii/AsciiBoxWriter.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/utils/ascii/AsciiBoxWriter.java
@@ -84,6 +84,7 @@ public class AsciiBoxWriter {
* @return boxed data
*/
public AsciiBox boxBox(String name, AsciiBox box, int charWidth) {
+ // TODO: if there is a box bigger then others in that this will get distorted
return boxString(name, box.toString(), charWidth);
}