From: René Scharfe Date: Wed, 06 May 2026 16:00:04 GMT Subject: Re: Git trims the last character of content from remotes Message-ID: <4d8aa86f-160a-4f01-beaf-e3f011f875cf@web.de> In-Reply-To: On 5/6/26 11:40 AM, Mikael Magnusson wrote: > On Wed, May 6, 2026 at 11:37 AM Mikael Magnusson wrote: >> >> On Tue, May 5, 2026 at 9:46 PM René Scharfe wrote: >>> >>> On 5/5/26 2:34 AM, Chris Torek wrote: >>>> On Mon, May 4, 2026 at 10:02 AM Hugo Osvaldo Barrera wrote: >>>> [snippage] >>>>> When the width of a whole line is the same as my terminal width ... >>>> [snippage] >>>>> ... sideband.c prints ANSI_SUFFIX = "\033[K", this escape >>>>> sequence being "clear the line from the current position until the end of the >>>>> line", and this is the root cause of the issue. >>> >>>> If you have a non-empty prefix >>>> string before this "clear to end of line" suffix, the solution is more >>>> obvious: print the ESC [ K as a *prefix* rather than a suffix, but >>>> that fails with the empty prefix. >>> We do have a non-empty prefix, but why would it be necessary? What's >>> wrong with clearing the full line starting from column 1? >>> >>> Anyway, do you mean something like this? >> >> If the purpose of the clear is to reset the background color on >> wrapped lines, this will not have any effect, since you clear before >> the new line is wrapped in. (This is a bit of an obscure edge case, if >> you set the background color, and wrap the line, the entire new line >> will be scrolled in with the active background color, then you write >> perhaps 10 more characters and send the sequence to reset the >> background color, but the entire rest of the line is still brown, or >> whatever it was set to when you wrapped). >> >> Example command to reproduce locally, >> % echo -e '\e[43maaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\e[0mhihi' >> (Add more aaaaaaa if necessary so that the line breaks before they end). > > Sorry for the double post, but I forgot an important thing, this only > happens if you *actually* scroll in a new line, ie if you open a new > terminal and run this, you won't see any problems until you get to the > bottom of the screen. The purpose of clearing here is to avoid leaving local progress line remnants after the remote line. Original discussion: https://lore.kernel.org/git/alpine.LFD.0.9999.0711032328490.21255@xanadu.home/ You're right that erasing before filling the whole line and then some is unnecessary. But it wouldn't hurt, either, no? René