{"thread":{"id":"61217","subject":"Better visual separation of hunks in `git add -p`","startedAt":"2024-03-28T13:36:24Z","lastAt":"2024-03-28T21:49:06Z","messageCount":14,"participants":["Eugenio Bargiacchi","Junio C Hamano","Dragan Simic"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"491748","messageId":"CAHfn=+snXChcPFiEgxvK=XFCq2uVMKQTyfrN9RNfAod18d0V=Q@mail.gmail.com","threadId":"61217","inReplyTo":null,"subject":"Better visual separation of hunks in `git add -p`","fromName":"Eugenio Bargiacchi","fromEmail":"svalorzen@gmail.com","sentAt":"2024-03-28T13:36:11Z","receivedAt":"2024-03-28T13:36:24Z","isPatch":false,"sender":{"key":"svalorzen@gmail.com","avatar":null},"body":"Hello,\n\nI'm looking for a way to print some sort of separator between hunks\nwhen running `git add -p`, as I have a bit of trouble detecting when\nthe previous hunk begins and the current one starts. Being able to\nprint an empty line or a couple lines filled with \"=======\" would\nreally help me out.\n\nThere seems to be a StackOverflow post with a similar request but\nunfortunately no answers:\nhttps://stackoverflow.com/questions/68534891/insert-blank-lines-between-git-add-patch-prompts\n\nThanks in advance for any help.\nBest,\nEugenio\n"},{"id":"491760","messageId":"xmqqo7ayuwpi.fsf@gitster.g","threadId":"61217","inReplyTo":"CAHfn=+snXChcPFiEgxvK=XFCq2uVMKQTyfrN9RNfAod18d0V=Q@mail.gmail.com","subject":"Re: Better visual separation of hunks in `git add -p`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-03-28T16:50:49Z","receivedAt":"2024-03-28T16:50:53Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eugenio Bargiacchi <svalorzen@gmail.com> writes:\n\n> I'm looking for a way to print some sort of separator between hunks\n> when running `git add -p`, as I have a bit of trouble detecting when\n> the previous hunk begins and the current one starts. Being able to\n> print an empty line or a couple lines filled with \"=======\" would\n> really help me out.\n\nHmph, my hope when I designed that particular UI was that the\ncommand prompt for the previous interaction followed by the hunk\nheader of the current hunk would give us clear enough separation.\n\nFor example, after answering \"n\" to the prompt for the previous\nhunk, we'd see\n\n    ...\n    +   (merge bff85a338c bl/doc-key-val-sep-fix later to maint).\n    +\n      * Other code cleanup, docfix, build fix, etc.\n        (merge f0e578c69c rs/use-xstrncmpz later to maint).\n        (merge 83e6eb7d7a ba/credential-test-clean-fix later to maint).\n    (1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? n\n    @@ -233,3 +245,6 @@ Fixes since v2.44\n        (merge 781fb7b4c2 as/option-names-in-messages later to maint).\n        (merge 51d41dc243 jk/doc-remote-helpers-markup-fix later to maint).\n        (merge e1aaf309db pb/ci-win-artifact-names-fix later to maint).\n    +   (merge ad538c61da jc/index-pack-fsck-levels later to maint).\n    +   (merge 67471bc704 ja/doc-formatting-fix later to maint).\n    ...\n    (2/2) Stage this hunk [y,n,q,a,d,K,g,/,e,?]?\n\nThe '@' (the first character of the hunk header line for the current\nhunk) and \"(1/2\" are surrounded by lines that begin with a space,\nand the hope was that it was sufficient \"separator\" already.\n\nThese days (long after I stopped mucking with the interactive add\ncode actively), the prompt line is painted in prompt_color (you can\ntweak it with the color.interactive.prompt configuration variable,\nit defaults to BOLD BLUE) while the first part of the hunk header\nline is painted in the fraginfo color (default CYAN), which should\ngive you even more visual distinction.\n\nPerhaps\n\n    [color \"interactive\"]\n\tprompt = bold red reverse\n\nwould be sufficient?  I dunno.\n\n"},{"id":"491763","messageId":"CAHfn=+sJotET-x7wZWZH0p4znR=o909qyV6wSDq_D0+VivT67w@mail.gmail.com","threadId":"61217","inReplyTo":"xmqqo7ayuwpi.fsf@gitster.g","subject":"Re: Better visual separation of hunks in `git add -p`","fromName":"Eugenio Bargiacchi","fromEmail":"svalorzen@gmail.com","sentAt":"2024-03-28T17:10:03Z","receivedAt":"2024-03-28T17:10:16Z","isPatch":false,"sender":{"key":"svalorzen@gmail.com","avatar":null},"body":"Thank you for the suggestion, it already helps a bit.\n\nThe problem only using indentations as a visual separator, for me, is\nthat if the code snipped already has indentations, then the ones added\nby 'git add' do not really stand up, and instead become part of a very\nlong uninterrupted stream of text. In addition to this, given that the\nsnippet is colored, the result is a very bright and flashy wall of\ntext that can be a bit much to sift through (were it all the same\ncolor it would be worse though). Being able to break up the hunks\nvisually with some whitespace would really go a long way.\n\nIn any case, for now I'll try to pick up the most obnoxious colors for\nthe prompt that I can :) Hopefully in the future this will be an\navailable option for difficult people like me.\n\nOn Thu, 28 Mar 2024 at 17:50, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Eugenio Bargiacchi <svalorzen@gmail.com> writes:\n>\n> > I'm looking for a way to print some sort of separator between hunks\n> > when running `git add -p`, as I have a bit of trouble detecting when\n> > the previous hunk begins and the current one starts. Being able to\n> > print an empty line or a couple lines filled with \"=======\" would\n> > really help me out.\n>\n> Hmph, my hope when I designed that particular UI was that the\n> command prompt for the previous interaction followed by the hunk\n> header of the current hunk would give us clear enough separation.\n>\n> For example, after answering \"n\" to the prompt for the previous\n> hunk, we'd see\n>\n>     ...\n>     +   (merge bff85a338c bl/doc-key-val-sep-fix later to maint).\n>     +\n>       * Other code cleanup, docfix, build fix, etc.\n>         (merge f0e578c69c rs/use-xstrncmpz later to maint).\n>         (merge 83e6eb7d7a ba/credential-test-clean-fix later to maint).\n>     (1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? n\n>     @@ -233,3 +245,6 @@ Fixes since v2.44\n>         (merge 781fb7b4c2 as/option-names-in-messages later to maint).\n>         (merge 51d41dc243 jk/doc-remote-helpers-markup-fix later to maint).\n>         (merge e1aaf309db pb/ci-win-artifact-names-fix later to maint).\n>     +   (merge ad538c61da jc/index-pack-fsck-levels later to maint).\n>     +   (merge 67471bc704 ja/doc-formatting-fix later to maint).\n>     ...\n>     (2/2) Stage this hunk [y,n,q,a,d,K,g,/,e,?]?\n>\n> The '@' (the first character of the hunk header line for the current\n> hunk) and \"(1/2\" are surrounded by lines that begin with a space,\n> and the hope was that it was sufficient \"separator\" already.\n>\n> These days (long after I stopped mucking with the interactive add\n> code actively), the prompt line is painted in prompt_color (you can\n> tweak it with the color.interactive.prompt configuration variable,\n> it defaults to BOLD BLUE) while the first part of the hunk header\n> line is painted in the fraginfo color (default CYAN), which should\n> give you even more visual distinction.\n>\n> Perhaps\n>\n>     [color \"interactive\"]\n>         prompt = bold red reverse\n>\n> would be sufficient?  I dunno.\n>\n"},{"id":"491771","messageId":"a9cffbe4aadd319760635ca6d5b4f465@manjaro.org","threadId":"61217","inReplyTo":"xmqqo7ayuwpi.fsf@gitster.g","subject":"Re: Better visual separation of hunks in `git add -p`","fromName":"Dragan Simic","fromEmail":"dsimic@manjaro.org","sentAt":"2024-03-28T18:14:22Z","receivedAt":"2024-03-28T18:14:24Z","isPatch":false,"sender":{"key":"dsimic@manjaro.org","avatar":null},"body":"On 2024-03-28 17:50, Junio C Hamano wrote:\n> Eugenio Bargiacchi <svalorzen@gmail.com> writes:\n> \n>> I'm looking for a way to print some sort of separator between hunks\n>> when running `git add -p`, as I have a bit of trouble detecting when\n>> the previous hunk begins and the current one starts. Being able to\n>> print an empty line or a couple lines filled with \"=======\" would\n>> really help me out.\n> \n> Hmph, my hope when I designed that particular UI was that the\n> command prompt for the previous interaction followed by the hunk\n> header of the current hunk would give us clear enough separation.\n> \n> For example, after answering \"n\" to the prompt for the previous\n> hunk, we'd see\n> \n>     ...\n>     +   (merge bff85a338c bl/doc-key-val-sep-fix later to maint).\n>     +\n>       * Other code cleanup, docfix, build fix, etc.\n>         (merge f0e578c69c rs/use-xstrncmpz later to maint).\n>         (merge 83e6eb7d7a ba/credential-test-clean-fix later to maint).\n>     (1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? n\n>     @@ -233,3 +245,6 @@ Fixes since v2.44\n>         (merge 781fb7b4c2 as/option-names-in-messages later to maint).\n>         (merge 51d41dc243 jk/doc-remote-helpers-markup-fix later to \n> maint).\n>         (merge e1aaf309db pb/ci-win-artifact-names-fix later to maint).\n>     +   (merge ad538c61da jc/index-pack-fsck-levels later to maint).\n>     +   (merge 67471bc704 ja/doc-formatting-fix later to maint).\n>     ...\n>     (2/2) Stage this hunk [y,n,q,a,d,K,g,/,e,?]?\n> \n> The '@' (the first character of the hunk header line for the current\n> hunk) and \"(1/2\" are surrounded by lines that begin with a space,\n> and the hope was that it was sufficient \"separator\" already.\n> \n> These days (long after I stopped mucking with the interactive add\n> code actively), the prompt line is painted in prompt_color (you can\n> tweak it with the color.interactive.prompt configuration variable,\n> it defaults to BOLD BLUE) while the first part of the hunk header\n> line is painted in the fraginfo color (default CYAN), which should\n> give you even more visual distinction.\n> \n> Perhaps\n> \n>     [color \"interactive\"]\n> \tprompt = bold red reverse\n> \n> would be sufficient?  I dunno.\n\nHere's a possible solution, or better said a new configuration option,\nwhich I've been thinking about for a while...  When running \"add -p\",\ndisplayed chunks can sometimes become confusing or a bit hard on the\neyes, but simply clearing the screen _before_ displaying any new step\n(i.e. a new chunk, interactive help, etc.) could make it much easier\non the eyes.  It would be a new option, of course.\n\nThoughts?\n"},{"id":"491772","messageId":"xmqq1q7uusin.fsf@gitster.g","threadId":"61217","inReplyTo":"a9cffbe4aadd319760635ca6d5b4f465@manjaro.org","subject":"Re: Better visual separation of hunks in `git add -p`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-03-28T18:21:20Z","receivedAt":"2024-03-28T18:21:26Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dragan Simic <dsimic@manjaro.org> writes:\n\n> Here's a possible solution, or better said a new configuration option,\n> which I've been thinking about for a while...  When running \"add -p\",\n> displayed chunks can sometimes become confusing or a bit hard on the\n> eyes, but simply clearing the screen _before_ displaying any new step\n> (i.e. a new chunk, interactive help, etc.) could make it much easier\n> on the eyes.  It would be a new option, of course.\n\nOr your 'p' option can have a 'P' variant that clears before prints.\nI have this feeling that even those who want clearing of the screen,\nthey do not want it always on, when many of their hunks are 7 lines\nlong.\n"},{"id":"491773","messageId":"1b81a013dd0faccdc24fe018fd740755@manjaro.org","threadId":"61217","inReplyTo":"xmqq1q7uusin.fsf@gitster.g","subject":"Re: Better visual separation of hunks in `git add -p`","fromName":"Dragan Simic","fromEmail":"dsimic@manjaro.org","sentAt":"2024-03-28T18:29:26Z","receivedAt":"2024-03-28T18:29:28Z","isPatch":false,"sender":{"key":"dsimic@manjaro.org","avatar":null},"body":"On 2024-03-28 19:21, Junio C Hamano wrote:\n> Dragan Simic <dsimic@manjaro.org> writes:\n> \n>> Here's a possible solution, or better said a new configuration option,\n>> which I've been thinking about for a while...  When running \"add -p\",\n>> displayed chunks can sometimes become confusing or a bit hard on the\n>> eyes, but simply clearing the screen _before_ displaying any new step\n>> (i.e. a new chunk, interactive help, etc.) could make it much easier\n>> on the eyes.  It would be a new option, of course.\n> \n> Or your 'p' option can have a 'P' variant that clears before prints.\n> I have this feeling that even those who want clearing of the screen,\n> they do not want it always on, when many of their hunks are 7 lines\n> long.\n\nThat would be even better.  Though, would adding new short command-line\noption to git-add be frowned upon?\n"},{"id":"491776","messageId":"CAHfn=+tsrgAyUUqUkq4TpXcABr7=ZcH+cna+vwALJqZ3H8LxFA@mail.gmail.com","threadId":"61217","inReplyTo":"1b81a013dd0faccdc24fe018fd740755@manjaro.org","subject":"Re: Better visual separation of hunks in `git add -p`","fromName":"Eugenio Bargiacchi","fromEmail":"svalorzen@gmail.com","sentAt":"2024-03-28T19:01:36Z","receivedAt":"2024-03-28T19:01:49Z","isPatch":false,"sender":{"key":"svalorzen@gmail.com","avatar":null},"body":"> Here's a possible solution, or better said a new configuration option,\n> which I've been thinking about for a while...  When running \"add -p\",\n> displayed chunks can sometimes become confusing or a bit hard on the\n> eyes, but simply clearing the screen _before_ displaying any new step\n> (i.e. a new chunk, interactive help, etc.) could make it much easier\n> on the eyes.  It would be a new option, of course.\n\nIn my head, an option to print an arbitrary string would be amazing,\nsince then if wanted one can print a special character that clears the\nscreen, or simply add some space, or something else.\n\nOn Thu, 28 Mar 2024 at 19:29, Dragan Simic <dsimic@manjaro.org> wrote:\n>\n> On 2024-03-28 19:21, Junio C Hamano wrote:\n> > Dragan Simic <dsimic@manjaro.org> writes:\n> >\n> >> Here's a possible solution, or better said a new configuration option,\n> >> which I've been thinking about for a while...  When running \"add -p\",\n> >> displayed chunks can sometimes become confusing or a bit hard on the\n> >> eyes, but simply clearing the screen _before_ displaying any new step\n> >> (i.e. a new chunk, interactive help, etc.) could make it much easier\n> >> on the eyes.  It would be a new option, of course.\n> >\n> > Or your 'p' option can have a 'P' variant that clears before prints.\n> > I have this feeling that even those who want clearing of the screen,\n> > they do not want it always on, when many of their hunks are 7 lines\n> > long.\n>\n> That would be even better.  Though, would adding new short command-line\n> option to git-add be frowned upon?\n"},{"id":"491777","messageId":"26f8d21dfd53d699804485b0f8c6abe1@manjaro.org","threadId":"61217","inReplyTo":"CAHfn=+tsrgAyUUqUkq4TpXcABr7=ZcH+cna+vwALJqZ3H8LxFA@mail.gmail.com","subject":"Re: Better visual separation of hunks in `git add -p`","fromName":"Dragan Simic","fromEmail":"dsimic@manjaro.org","sentAt":"2024-03-28T19:04:54Z","receivedAt":"2024-03-28T19:04:55Z","isPatch":false,"sender":{"key":"dsimic@manjaro.org","avatar":null},"body":"On 2024-03-28 20:01, Eugenio Bargiacchi wrote:\n>> Here's a possible solution, or better said a new configuration option,\n>> which I've been thinking about for a while...  When running \"add -p\",\n>> displayed chunks can sometimes become confusing or a bit hard on the\n>> eyes, but simply clearing the screen _before_ displaying any new step\n>> (i.e. a new chunk, interactive help, etc.) could make it much easier\n>> on the eyes.  It would be a new option, of course.\n> \n> In my head, an option to print an arbitrary string would be amazing,\n> since then if wanted one can print a special character that clears the\n> screen, or simply add some space, or something else.\n\nHuh, letting the users handle screen clearing that way could be rather\nproblematic, because different terminals may do it differently.\n\n> On Thu, 28 Mar 2024 at 19:29, Dragan Simic <dsimic@manjaro.org> wrote:\n>> \n>> On 2024-03-28 19:21, Junio C Hamano wrote:\n>> > Dragan Simic <dsimic@manjaro.org> writes:\n>> >\n>> >> Here's a possible solution, or better said a new configuration option,\n>> >> which I've been thinking about for a while...  When running \"add -p\",\n>> >> displayed chunks can sometimes become confusing or a bit hard on the\n>> >> eyes, but simply clearing the screen _before_ displaying any new step\n>> >> (i.e. a new chunk, interactive help, etc.) could make it much easier\n>> >> on the eyes.  It would be a new option, of course.\n>> >\n>> > Or your 'p' option can have a 'P' variant that clears before prints.\n>> > I have this feeling that even those who want clearing of the screen,\n>> > they do not want it always on, when many of their hunks are 7 lines\n>> > long.\n>> \n>> That would be even better.  Though, would adding new short \n>> command-line\n>> option to git-add be frowned upon?\n"},{"id":"491778","messageId":"CAHfn=+s5_hvV1osP1HFjWs4wxRfr9YUW-9=WkXbgSp-8sPZ-Qg@mail.gmail.com","threadId":"61217","inReplyTo":"26f8d21dfd53d699804485b0f8c6abe1@manjaro.org","subject":"Re: Better visual separation of hunks in `git add -p`","fromName":"Eugenio Bargiacchi","fromEmail":"svalorzen@gmail.com","sentAt":"2024-03-28T19:08:09Z","receivedAt":"2024-03-28T19:08:22Z","isPatch":false,"sender":{"key":"svalorzen@gmail.com","avatar":null},"body":"But then each can configure it specifically for their terminal, no? Or\nare you afraid that a user may use different terminals at the same\ntime, so the same config would be applied, so it would not work? In\nany case, my suggestion was aiming mainly to avoid having to add\nmultiple options while allowing to freely customize the separators,\nbut if that will not work in general to clear, that makes sense as\nwell.\n\nOn Thu, 28 Mar 2024 at 20:04, Dragan Simic <dsimic@manjaro.org> wrote:\n>\n> On 2024-03-28 20:01, Eugenio Bargiacchi wrote:\n> >> Here's a possible solution, or better said a new configuration option,\n> >> which I've been thinking about for a while...  When running \"add -p\",\n> >> displayed chunks can sometimes become confusing or a bit hard on the\n> >> eyes, but simply clearing the screen _before_ displaying any new step\n> >> (i.e. a new chunk, interactive help, etc.) could make it much easier\n> >> on the eyes.  It would be a new option, of course.\n> >\n> > In my head, an option to print an arbitrary string would be amazing,\n> > since then if wanted one can print a special character that clears the\n> > screen, or simply add some space, or something else.\n>\n> Huh, letting the users handle screen clearing that way could be rather\n> problematic, because different terminals may do it differently.\n>\n> > On Thu, 28 Mar 2024 at 19:29, Dragan Simic <dsimic@manjaro.org> wrote:\n> >>\n> >> On 2024-03-28 19:21, Junio C Hamano wrote:\n> >> > Dragan Simic <dsimic@manjaro.org> writes:\n> >> >\n> >> >> Here's a possible solution, or better said a new configuration option,\n> >> >> which I've been thinking about for a while...  When running \"add -p\",\n> >> >> displayed chunks can sometimes become confusing or a bit hard on the\n> >> >> eyes, but simply clearing the screen _before_ displaying any new step\n> >> >> (i.e. a new chunk, interactive help, etc.) could make it much easier\n> >> >> on the eyes.  It would be a new option, of course.\n> >> >\n> >> > Or your 'p' option can have a 'P' variant that clears before prints.\n> >> > I have this feeling that even those who want clearing of the screen,\n> >> > they do not want it always on, when many of their hunks are 7 lines\n> >> > long.\n> >>\n> >> That would be even better.  Though, would adding new short\n> >> command-line\n> >> option to git-add be frowned upon?\n"},{"id":"491780","messageId":"de182310842ea3ff04c171a271587ca1@manjaro.org","threadId":"61217","inReplyTo":"CAHfn=+s5_hvV1osP1HFjWs4wxRfr9YUW-9=WkXbgSp-8sPZ-Qg@mail.gmail.com","subject":"Re: Better visual separation of hunks in `git add -p`","fromName":"Dragan Simic","fromEmail":"dsimic@manjaro.org","sentAt":"2024-03-28T19:16:28Z","receivedAt":"2024-03-28T19:16:31Z","isPatch":false,"sender":{"key":"dsimic@manjaro.org","avatar":null},"body":"On 2024-03-28 20:08, Eugenio Bargiacchi wrote:\n> But then each can configure it specifically for their terminal, no? Or\n> are you afraid that a user may use different terminals at the same\n> time, so the same config would be applied, so it would not work? In\n> any case, my suggestion was aiming mainly to avoid having to add\n> multiple options while allowing to freely customize the separators,\n> but if that will not work in general to clear, that makes sense as\n> well.\n\nOf course, users could pick the right escape sequences for their\nterminals, but as you already noted, the same configurations could\nend up being used on different terminals.  For example, even SSHing\ninto a machine using a different SSH client could lead to a mess.\n\n\n> On Thu, 28 Mar 2024 at 20:04, Dragan Simic <dsimic@manjaro.org> wrote:\n>> \n>> On 2024-03-28 20:01, Eugenio Bargiacchi wrote:\n>> >> Here's a possible solution, or better said a new configuration option,\n>> >> which I've been thinking about for a while...  When running \"add -p\",\n>> >> displayed chunks can sometimes become confusing or a bit hard on the\n>> >> eyes, but simply clearing the screen _before_ displaying any new step\n>> >> (i.e. a new chunk, interactive help, etc.) could make it much easier\n>> >> on the eyes.  It would be a new option, of course.\n>> >\n>> > In my head, an option to print an arbitrary string would be amazing,\n>> > since then if wanted one can print a special character that clears the\n>> > screen, or simply add some space, or something else.\n>> \n>> Huh, letting the users handle screen clearing that way could be rather\n>> problematic, because different terminals may do it differently.\n>> \n>> > On Thu, 28 Mar 2024 at 19:29, Dragan Simic <dsimic@manjaro.org> wrote:\n>> >>\n>> >> On 2024-03-28 19:21, Junio C Hamano wrote:\n>> >> > Dragan Simic <dsimic@manjaro.org> writes:\n>> >> >\n>> >> >> Here's a possible solution, or better said a new configuration option,\n>> >> >> which I've been thinking about for a while...  When running \"add -p\",\n>> >> >> displayed chunks can sometimes become confusing or a bit hard on the\n>> >> >> eyes, but simply clearing the screen _before_ displaying any new step\n>> >> >> (i.e. a new chunk, interactive help, etc.) could make it much easier\n>> >> >> on the eyes.  It would be a new option, of course.\n>> >> >\n>> >> > Or your 'p' option can have a 'P' variant that clears before prints.\n>> >> > I have this feeling that even those who want clearing of the screen,\n>> >> > they do not want it always on, when many of their hunks are 7 lines\n>> >> > long.\n>> >>\n>> >> That would be even better.  Though, would adding new short\n>> >> command-line\n>> >> option to git-add be frowned upon?\n"},{"id":"491782","messageId":"xmqqr0fut7di.fsf@gitster.g","threadId":"61217","inReplyTo":"de182310842ea3ff04c171a271587ca1@manjaro.org","subject":"Re: Better visual separation of hunks in `git add -p`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-03-28T20:43:21Z","receivedAt":"2024-03-28T20:43:24Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dragan Simic <dsimic@manjaro.org> writes:\n\n> Of course, users could pick the right escape sequences for their\n> terminals, but as you already noted, the same configurations could\n> end up being used on different terminals.  For example, even SSHing\n> into a machine using a different SSH client could lead to a mess.\n\nThere is a separate discussion of conditional configuration based on\nenvironment variable settings, e.g.\n\n    [includeIf \"env:TERM:vt100\"]\n\tpath = ~/.git-config-bits/vt100\n\nwhere the named file might have\n\n    [prompt] prefix = \"\\033[H\\033[J\"\n\nso it is certainly doable.\n\nIt is a different story if doing so is sensible, of course.\n\n\n\n\n\n"},{"id":"491786","messageId":"fc4ede3ecffd33811adca702493c8763@manjaro.org","threadId":"61217","inReplyTo":"xmqqr0fut7di.fsf@gitster.g","subject":"Re: Better visual separation of hunks in `git add -p`","fromName":"Dragan Simic","fromEmail":"dsimic@manjaro.org","sentAt":"2024-03-28T21:19:24Z","receivedAt":"2024-03-28T21:19:33Z","isPatch":false,"sender":{"key":"dsimic@manjaro.org","avatar":null},"body":"On 2024-03-28 21:43, Junio C Hamano wrote:\n> Dragan Simic <dsimic@manjaro.org> writes:\n> \n>> Of course, users could pick the right escape sequences for their\n>> terminals, but as you already noted, the same configurations could\n>> end up being used on different terminals.  For example, even SSHing\n>> into a machine using a different SSH client could lead to a mess.\n> \n> There is a separate discussion of conditional configuration based on\n> environment variable settings, e.g.\n> \n>     [includeIf \"env:TERM:vt100\"]\n> \tpath = ~/.git-config-bits/vt100\n> \n> where the named file might have\n> \n>     [prompt] prefix = \"\\033[H\\033[J\"\n> \n> so it is certainly doable.\n> \n> It is a different story if doing so is sensible, of course.\n\nQuite frankly, I think that would be like opening a can of worms.\nIn other words, if we end up implementing support for the \"add -P\"\nprefix, allowing the users to do whatever they want with the prefixes\nwould surely be fine, but only if we implement \"add -P\" at the same\ntime, to already provide a reliable and simple way for clearing the\nscreen.\n"},{"id":"491789","messageId":"CAHfn=+uXhAW+7YG6R6BAeTOcWdrGQjUwGYCT6QJ3u9d9TwaySg@mail.gmail.com","threadId":"61217","inReplyTo":"fc4ede3ecffd33811adca702493c8763@manjaro.org","subject":"Re: Better visual separation of hunks in `git add -p`","fromName":"Eugenio Bargiacchi","fromEmail":"svalorzen@gmail.com","sentAt":"2024-03-28T21:43:53Z","receivedAt":"2024-03-28T21:44:07Z","isPatch":false,"sender":{"key":"svalorzen@gmail.com","avatar":null},"body":"It seems to me that the two options are orthogonal: allowing the user\nto add an arbitrary prefix is not a block for allowing the user to\nclear the screen or vice-versa. If anything, the arbitrary prefix\nseems the more general flag to me as it at least offers a way (however\nunportable) to perform a clear. So saying that if we do not allow the\nuser to clear the screen then it is not fine to add arbitrary prefixes\nseems strange.\n\nOn Thu, 28 Mar 2024 at 22:19, Dragan Simic <dsimic@manjaro.org> wrote:\n>\n> On 2024-03-28 21:43, Junio C Hamano wrote:\n> > Dragan Simic <dsimic@manjaro.org> writes:\n> >\n> >> Of course, users could pick the right escape sequences for their\n> >> terminals, but as you already noted, the same configurations could\n> >> end up being used on different terminals.  For example, even SSHing\n> >> into a machine using a different SSH client could lead to a mess.\n> >\n> > There is a separate discussion of conditional configuration based on\n> > environment variable settings, e.g.\n> >\n> >     [includeIf \"env:TERM:vt100\"]\n> >       path = ~/.git-config-bits/vt100\n> >\n> > where the named file might have\n> >\n> >     [prompt] prefix = \"\\033[H\\033[J\"\n> >\n> > so it is certainly doable.\n> >\n> > It is a different story if doing so is sensible, of course.\n>\n> Quite frankly, I think that would be like opening a can of worms.\n> In other words, if we end up implementing support for the \"add -P\"\n> prefix, allowing the users to do whatever they want with the prefixes\n> would surely be fine, but only if we implement \"add -P\" at the same\n> time, to already provide a reliable and simple way for clearing the\n> screen.\n"},{"id":"491790","messageId":"a26d1f79fce1ecc5671e7539c390b2b9@manjaro.org","threadId":"61217","inReplyTo":"CAHfn=+uXhAW+7YG6R6BAeTOcWdrGQjUwGYCT6QJ3u9d9TwaySg@mail.gmail.com","subject":"Re: Better visual separation of hunks in `git add -p`","fromName":"Dragan Simic","fromEmail":"dsimic@manjaro.org","sentAt":"2024-03-28T21:49:04Z","receivedAt":"2024-03-28T21:49:06Z","isPatch":false,"sender":{"key":"dsimic@manjaro.org","avatar":null},"body":"On 2024-03-28 22:43, Eugenio Bargiacchi wrote:\n> It seems to me that the two options are orthogonal: allowing the user\n> to add an arbitrary prefix is not a block for allowing the user to\n> clear the screen or vice-versa. If anything, the arbitrary prefix\n> seems the more general flag to me as it at least offers a way (however\n> unportable) to perform a clear. So saying that if we do not allow the\n> user to clear the screen then it is not fine to add arbitrary prefixes\n> seems strange.\n\nWell, it all depends on one's perspective.  To me more precise, I don't\ncare about the prefixes because I've never wanted them, but I'd like to \nbe\nable to clear the screen.  Thus, from my viewpoint, which is presumably\nshared with other users, forcing me to use the prefix to be able to \nclear\nthe screen, and to use it in a messy way, makes little sense.\n\nI hope this makes my perspective mroe clear.\n\n\n> On Thu, 28 Mar 2024 at 22:19, Dragan Simic <dsimic@manjaro.org> wrote:\n>> \n>> On 2024-03-28 21:43, Junio C Hamano wrote:\n>> > Dragan Simic <dsimic@manjaro.org> writes:\n>> >\n>> >> Of course, users could pick the right escape sequences for their\n>> >> terminals, but as you already noted, the same configurations could\n>> >> end up being used on different terminals.  For example, even SSHing\n>> >> into a machine using a different SSH client could lead to a mess.\n>> >\n>> > There is a separate discussion of conditional configuration based on\n>> > environment variable settings, e.g.\n>> >\n>> >     [includeIf \"env:TERM:vt100\"]\n>> >       path = ~/.git-config-bits/vt100\n>> >\n>> > where the named file might have\n>> >\n>> >     [prompt] prefix = \"\\033[H\\033[J\"\n>> >\n>> > so it is certainly doable.\n>> >\n>> > It is a different story if doing so is sensible, of course.\n>> \n>> Quite frankly, I think that would be like opening a can of worms.\n>> In other words, if we end up implementing support for the \"add -P\"\n>> prefix, allowing the users to do whatever they want with the prefixes\n>> would surely be fine, but only if we implement \"add -P\" at the same\n>> time, to already provide a reliable and simple way for clearing the\n>> screen.\n"}]}