fix: column size with special char (ugly)
This commit is contained in:
parent
672d530f13
commit
82af876560
@ -30,9 +30,12 @@ class WeatherDisplayBasic implements WeatherDisplay {
|
||||
double max = 0;
|
||||
for (WeatherDataAPI api: weatherDataAPIArrayListHashMap.keySet()) {
|
||||
for (WeatherData w: weatherDataAPIArrayListHashMap.get(api)){
|
||||
max = Math.max(max, w.toString().length());
|
||||
// real str len with special chars
|
||||
int strLen = w.toString().codePointCount(0, w.toString().length());
|
||||
max = Math.max(max, strLen);
|
||||
}
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
|
||||
@ -83,14 +86,16 @@ class WeatherDisplayBasic implements WeatherDisplay {
|
||||
|
||||
double sourceColumnSize = dayColumnSize;
|
||||
|
||||
double dayColumnSizeSeparator = dayColumnSize - 1; // because arrows change string len but not display len TODO
|
||||
|
||||
// Header
|
||||
displayHeader(days, sourceColumnSize, dayColumnSize);
|
||||
this.displaySeparatorLine(days, sourceColumnSize, dayColumnSize);
|
||||
this.displaySeparatorLine(days, sourceColumnSize, dayColumnSizeSeparator);
|
||||
|
||||
// Apis
|
||||
for (WeatherDataAPI api: weatherDataAPIArrayListHashMap.keySet()) {
|
||||
displayWeatherDatas(api.getAPIName(), weatherDataAPIArrayListHashMap.get(api), startColumnString, sourceColumnSize, dayColumnSize);
|
||||
this.displaySeparatorLine(days, sourceColumnSize, dayColumnSize);
|
||||
this.displaySeparatorLine(days, sourceColumnSize, dayColumnSizeSeparator);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user