git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Better visual separation of hunks in `git add -p`

From
DSDragan Simic <dsimic@manjaro.org>
Date
Mar 28, 2024, 19:16 UTC
Message-ID
<de182310842ea3ff04c171a271587ca1@manjaro.org>
In-Reply-To
<CAHfn=+s5_hvV1osP1HFjWs4wxRfr9YUW-9=WkXbgSp-8sPZ-Qg@mail.gmail.com>
On 2024-03-28 20:08, Eugenio Bargiacchi wrote:
Show 7 quoted lines
> But then each can configure it specifically for their terminal, no? Or
> are you afraid that a user may use different terminals at the same
> time, so the same config would be applied, so it would not work? In
> any case, my suggestion was aiming mainly to avoid having to add
> multiple options while allowing to freely customize the separators,
> but if that will not work in general to clear, that makes sense as
> well.

Of course, users could pick the right escape sequences for their terminals, but as you already noted, the same configurations could end up being used on different terminals. For example, even SSHing into a machine using a different SSH client could lead to a mess.

Show 37 quoted lines
> On Thu, 28 Mar 2024 at 20:04, Dragan Simic <dsimic@manjaro.org> wrote:
>> 
>> On 2024-03-28 20:01, Eugenio Bargiacchi wrote:
>> >> Here's a possible solution, or better said a new configuration option,
>> >> which I've been thinking about for a while...  When running "add -p",
>> >> displayed chunks can sometimes become confusing or a bit hard on the
>> >> eyes, but simply clearing the screen _before_ displaying any new step
>> >> (i.e. a new chunk, interactive help, etc.) could make it much easier
>> >> on the eyes.  It would be a new option, of course.
>> >
>> > In my head, an option to print an arbitrary string would be amazing,
>> > since then if wanted one can print a special character that clears the
>> > screen, or simply add some space, or something else.
>> 
>> Huh, letting the users handle screen clearing that way could be rather
>> problematic, because different terminals may do it differently.
>> 
>> > On Thu, 28 Mar 2024 at 19:29, Dragan Simic <dsimic@manjaro.org> wrote:
>> >>
>> >> On 2024-03-28 19:21, Junio C Hamano wrote:
>> >> > Dragan Simic <dsimic@manjaro.org> writes:
>> >> >
>> >> >> Here's a possible solution, or better said a new configuration option,
>> >> >> which I've been thinking about for a while...  When running "add -p",
>> >> >> displayed chunks can sometimes become confusing or a bit hard on the
>> >> >> eyes, but simply clearing the screen _before_ displaying any new step
>> >> >> (i.e. a new chunk, interactive help, etc.) could make it much easier
>> >> >> on the eyes.  It would be a new option, of course.
>> >> >
>> >> > Or your 'p' option can have a 'P' variant that clears before prints.
>> >> > I have this feeling that even those who want clearing of the screen,
>> >> > they do not want it always on, when many of their hunks are 7 lines
>> >> > long.
>> >>
>> >> That would be even better.  Though, would adding new short
>> >> command-line
>> >> option to git-add be frowned upon?
Previous: Eugenio BargiacchiNext: Junio C Hamano
Message 10 of 14 in “Better visual separation of hunks in `git add -p`”
  1. Eugenio BargiacchiMar 28, 2024
  2. Junio C HamanoMar 28, 2024
  3. Eugenio BargiacchiMar 28, 2024
  4. Dragan SimicMar 28, 2024
  5. Junio C HamanoMar 28, 2024
  6. Dragan SimicMar 28, 2024
  7. Eugenio BargiacchiMar 28, 2024
  8. Dragan SimicMar 28, 2024
  9. Eugenio BargiacchiMar 28, 2024
  10. Dragan SimicMar 28, 2024
  11. Junio C HamanoMar 28, 2024
  12. Dragan SimicMar 28, 2024
  13. Eugenio BargiacchiMar 28, 2024
  14. Dragan SimicMar 28, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.