Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make column:copy(int) copy any printFormatters set on the original #1166

Open
TWiStErRob opened this issue Nov 7, 2022 · 0 comments
Open

Comments

@TWiStErRob
Copy link

#1068/#1073 missed the emptyCopy(int) overloads. Only half of the columns keep their printFormatter when copied with a pre-allocated size.

Here's a repro:

	val table = Table.create(
		TextColumn.create("Name", listOf("b", "c", "a")),
		BooleanColumn.create("Projects", listOf(false, true, true)).apply {
			printFormatter = BooleanFormatter("+", "-")
		},
	)
	println(table.printAll())
	println()
	val sorted = table
		.sortOn(Sort.create(table, "Name"))
	println(sorted.printAll())

Actual:

 Name  |  Projects  |
---------------------
    b  |         -  |
    c  |         +  |
    a  |         +  |

 Name  |  Projects  |
---------------------
    a  |      true  |
    b  |     false  |
    c  |      true  |

Expected:

 Name  |  Projects  |
---------------------
    b  |         -  |
    c  |         +  |
    a  |         +  |

 Name  |  Projects  |
---------------------
    a  |         +  |
    b  |         -  |
    c  |         +  |

The issue is not only BooleanColumn, others too, but it's the simples example.

@TWiStErRob TWiStErRob changed the title make column:copy() copy any printFormatters set on the original make column:copy(int) copy any printFormatters set on the original Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant