{"thread":{"id":"58242","subject":"[BUG] \"git log\" command wraps lines not correctly while terminal width changed","startedAt":"2022-07-29T14:35:34Z","lastAt":"2022-07-29T21:12:17Z","messageCount":3,"participants":["Sergey Grunenko","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"460218","messageId":"CAFRNrRYs5tkTq_Dz3qX+jZ_PJLdUwT4NgabavYeHsGOEtMTq5w@mail.gmail.com","threadId":"58242","inReplyTo":null,"subject":"[BUG] \"git log\" command wraps lines not correctly while terminal width changed","fromName":"Sergey Grunenko","fromEmail":"grunenko.serg@gmail.com","sentAt":"2022-07-29T14:35:20Z","receivedAt":"2022-07-29T14:35:34Z","isPatch":false,"sender":{"key":"grunenko.serg@gmail.com","avatar":null},"body":"Hi, developers. I met some small bug in console report of \"git log\" command\n\nShort description:\ngit log --graph command wraps lines incorrectly while I change the\nwidth of terminal. It remember the initial width of terminal and wraps\nlines according to the initial width.\n\nHow to reproduce:\n1. Open terminal\n2. go to existing repository with some branches\n3. Change terminal width to 50 characters (or less, to be sure, that\nfirst line wraps)\n4. process command \"git log --graph\" and be sure, that a few lines is wrapping\n5. Increase terminal width until line breaks stop\n6. Lines wrapping is changing and is correct\n7. Click <up> <down> buttons or rotate mouse scroll to scroll text two\nscreens next and back\nIncorrect behavior:\n8. You'll see that the wrapping behavior is like terminal width didn't changed.\n9. But if you touch the terminal width again, wrapping will be correct\nAwaited behavior:\n8a. Lines wrapping is like terminal has changed value\n\n------------------------------------\nmailto: grunenko.serg@gmail.com\n------------------------------------\nKind regards, Sergey Grunenko\n"},{"id":"460270","messageId":"YuRF7rSskqT2YkMs@coredump.intra.peff.net","threadId":"58242","inReplyTo":"CAFRNrRYs5tkTq_Dz3qX+jZ_PJLdUwT4NgabavYeHsGOEtMTq5w@mail.gmail.com","subject":"Re: [BUG] \"git log\" command wraps lines not correctly while terminal width changed","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2022-07-29T20:41:18Z","receivedAt":"2022-07-29T20:41:24Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jul 29, 2022 at 06:35:20PM +0400, Sergey Grunenko wrote:\n\n> Hi, developers. I met some small bug in console report of \"git log\" command\n\nI don't think this is a bug in git, because git isn't actually doing any\nwrapping.\n\n> How to reproduce:\n> 1. Open terminal\n> 2. go to existing repository with some branches\n> 3. Change terminal width to 50 characters (or less, to be sure, that\n> first line wraps)\n> 4. process command \"git log --graph\" and be sure, that a few lines is wrapping\n\nIn your example here, any line breaking is not done by \"git log\", but\neither by the pager (\"less\", by default) or by the terminal.\n\n> 5. Increase terminal width until line breaks stop\n> 6. Lines wrapping is changing and is correct\n\nOK, so it sounds like you're probably seeing \"less\" get told by the\nterminal that the window size has changed, and it adapts.\n\n> 7. Click <up> <down> buttons or rotate mouse scroll to scroll text two\n> screens next and back\n> Incorrect behavior:\n> 8. You'll see that the wrapping behavior is like terminal width didn't changed.\n> 9. But if you touch the terminal width again, wrapping will be correct\n> Awaited behavior:\n> 8a. Lines wrapping is like terminal has changed value\n\nThe mouse scroll wheel is presumably telling the terminal to move\nthrough its back-scroll. How it handles re-rendering of content that's\nonly in the back-scroll is up to it, and totally outside the control of\neither git or the pager. It behaves as your 8a for me, using urxvt on\nLinux. You probably need to file a report with the provider of your\nterminal emulator.\n\n-Peff\n"},{"id":"460273","messageId":"xmqq4jyz62u0.fsf@gitster.g","threadId":"58242","inReplyTo":"YuRF7rSskqT2YkMs@coredump.intra.peff.net","subject":"Re: [BUG] \"git log\" command wraps lines not correctly while terminal width changed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-07-29T21:12:07Z","receivedAt":"2022-07-29T21:12:17Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Fri, Jul 29, 2022 at 06:35:20PM +0400, Sergey Grunenko wrote:\n>\n>> Hi, developers. I met some small bug in console report of \"git log\" command\n>\n> I don't think this is a bug in git, because git isn't actually doing any\n> wrapping.\n\nWe do measure the terminal width when we start and adjust the length\nof --stat and other things, but it does not affect the overall\ncorrectness of what you said.  We just draw once, and never go back\nto redraw with updated width in response to SIGWINCH.  After we emit\nour output, it is up to the pager and the terminal.\n\n> OK, so it sounds like you're probably seeing \"less\" get told by the\n> terminal that the window size has changed, and it adapts.\n> ...\n> The mouse scroll wheel is presumably telling the terminal to move\n> through its back-scroll. How it handles re-rendering of content that's\n> only in the back-scroll is up to it, and totally outside the control of\n> either git or the pager. It behaves as your 8a for me, using urxvt on\n> Linux. You probably need to file a report with the provider of your\n> terminal emulator.\n\n"}]}