git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] "git log" command wraps lines not correctly while terminal width changed
@ 2022-07-29 14:35 Sergey Grunenko
  2022-07-29 20:41 ` Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Grunenko @ 2022-07-29 14:35 UTC (permalink / raw)
  To: git

Hi, developers. I met some small bug in console report of "git log" command

Short description:
git log --graph command wraps lines incorrectly while I change the
width of terminal. It remember the initial width of terminal and wraps
lines according to the initial width.

How to reproduce:
1. Open terminal
2. go to existing repository with some branches
3. Change terminal width to 50 characters (or less, to be sure, that
first line wraps)
4. process command "git log --graph" and be sure, that a few lines is wrapping
5. Increase terminal width until line breaks stop
6. Lines wrapping is changing and is correct
7. Click <up> <down> buttons or rotate mouse scroll to scroll text two
screens next and back
Incorrect behavior:
8. You'll see that the wrapping behavior is like terminal width didn't changed.
9. But if you touch the terminal width again, wrapping will be correct
Awaited behavior:
8a. Lines wrapping is like terminal has changed value

------------------------------------
mailto: grunenko.serg@gmail.com
------------------------------------
Kind regards, Sergey Grunenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] "git log" command wraps lines not correctly while terminal width changed
  2022-07-29 14:35 [BUG] "git log" command wraps lines not correctly while terminal width changed Sergey Grunenko
@ 2022-07-29 20:41 ` Jeff King
  2022-07-29 21:12   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2022-07-29 20:41 UTC (permalink / raw)
  To: Sergey Grunenko; +Cc: git

On Fri, Jul 29, 2022 at 06:35:20PM +0400, Sergey Grunenko wrote:

> Hi, developers. I met some small bug in console report of "git log" command

I don't think this is a bug in git, because git isn't actually doing any
wrapping.

> How to reproduce:
> 1. Open terminal
> 2. go to existing repository with some branches
> 3. Change terminal width to 50 characters (or less, to be sure, that
> first line wraps)
> 4. process command "git log --graph" and be sure, that a few lines is wrapping

In your example here, any line breaking is not done by "git log", but
either by the pager ("less", by default) or by the terminal.

> 5. Increase terminal width until line breaks stop
> 6. Lines wrapping is changing and is correct

OK, so it sounds like you're probably seeing "less" get told by the
terminal that the window size has changed, and it adapts.

> 7. Click <up> <down> buttons or rotate mouse scroll to scroll text two
> screens next and back
> Incorrect behavior:
> 8. You'll see that the wrapping behavior is like terminal width didn't changed.
> 9. But if you touch the terminal width again, wrapping will be correct
> Awaited behavior:
> 8a. Lines wrapping is like terminal has changed value

The mouse scroll wheel is presumably telling the terminal to move
through its back-scroll. How it handles re-rendering of content that's
only in the back-scroll is up to it, and totally outside the control of
either git or the pager. It behaves as your 8a for me, using urxvt on
Linux. You probably need to file a report with the provider of your
terminal emulator.

-Peff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] "git log" command wraps lines not correctly while terminal width changed
  2022-07-29 20:41 ` Jeff King
@ 2022-07-29 21:12   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2022-07-29 21:12 UTC (permalink / raw)
  To: Jeff King; +Cc: Sergey Grunenko, git

Jeff King <peff@peff.net> writes:

> On Fri, Jul 29, 2022 at 06:35:20PM +0400, Sergey Grunenko wrote:
>
>> Hi, developers. I met some small bug in console report of "git log" command
>
> I don't think this is a bug in git, because git isn't actually doing any
> wrapping.

We do measure the terminal width when we start and adjust the length
of --stat and other things, but it does not affect the overall
correctness of what you said.  We just draw once, and never go back
to redraw with updated width in response to SIGWINCH.  After we emit
our output, it is up to the pager and the terminal.

> OK, so it sounds like you're probably seeing "less" get told by the
> terminal that the window size has changed, and it adapts.
> ...
> The mouse scroll wheel is presumably telling the terminal to move
> through its back-scroll. How it handles re-rendering of content that's
> only in the back-scroll is up to it, and totally outside the control of
> either git or the pager. It behaves as your 8a for me, using urxvt on
> Linux. You probably need to file a report with the provider of your
> terminal emulator.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-29 21:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-29 14:35 [BUG] "git log" command wraps lines not correctly while terminal width changed Sergey Grunenko
2022-07-29 20:41 ` Jeff King
2022-07-29 21:12   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).