On 22/11/2022 00:57, Junio C Hamano wrote: > Philip Oakley <philipoakley@iee.email> writes: > >>> As a design question, what should "Trunc" do in such a case now? I >>> do not think we can still call it "hard truncate" if the feature >>> gives "[][]" (i.e. fill only 4 display columns, resulting in a >>> string that is not wide enough) or "[][][]" (i.e. exceed 5 columns >>> that are given), but of course chomping a letter in the middle is >>> not acceptable behaviour, so ... >> The design had already covered those cases. The author already had those >> thoughts > Sorry, I was saying that none of > > * giving only [][] to fill only 4 display columns, without filling > the given 5 display columns, > > * giving [][][] to fill 6 display columns, exceeding the given 5 > display columns, > > * giving [][][ that chomps a letter in the middle, in a failed > attempt to fill exactly 5 displya columns. > > would be a sensible design of the behaviour for "Trunc", so I am not > sure what "had already covered" really mean... > I'm still unsure what you are trying to say here. Is this a question about the prior `trunc`, `mtrunc`, and `ltrunc` design and tests? e.g. how complete are their tests? Is it looking for an extended explanation of the 'fit in N-columns' design approaches that they all have? I'm happy to add a paragraph saying that an `Mtrunc`, i.e. miss out the middle characters to fit the set column width, without using the two dot ellipsis (`..`), was considered a non starter because of potential confusion when looking at such output when tabulated. The existing code (and tests) already covers the need to hide the characters those two dots (ellipsis) consumed win the N-column tabulated output. The tests also include utf8-encoded characters. All the previous tests for `trunc` and `'ltrunc` (i.e. with ellipsis) have been repeated for the `Trunc` and `Ltrunc` (without ellipsis) hard truncation commands, and their expected outputs updated, including the use of the qz_to_tab_space for those case where trailing spaces are now present. Does that cover your questions? -- Philip