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

Re: [PATCH] editor: only save (and restore) the terminal if using a tty

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 24, 2021, 20:51 UTC
Message-ID
<xmqqy25dz39n.fsf@gitster.g>
In-Reply-To
<CAPUEspjBf1MrN_hhNYndJ3MExikZ=rODbHiLNHNfpz1SUKd3RA@mail.gmail.com>
Carlo Arenas <carenas@gmail.com> writes:
Show 18 quoted lines
> On Wed, Nov 24, 2021 at 11:34 AM Junio C Hamano <gitster@pobox.com> wrote:
>>
>> Why 'vi' and 'vim' are so special?  Is this an attempt to paper over
>> a bug in 'vim' on the caller side?
>
> not sure if the bug is on vi/vim, cygwin's pty or the new conPTY that
> Windows Terminal uses; but in Git for Windows, using an MSYS vim (that
> uses cygwin's pty) within Windows Terminal (and other terminals that
> use conPTY most likely) leads to this terminal output corruption, that
> bash "fixes" when it gets the control back, but that git does not
> (unless something like what I am proposing is done), and that is
> specially disruptive when doing several commits in a series (ex: an
> interactive rebase).
>
> you could say it is an attempt to paper over that bug, but IMHO it is
> also a way for git to protect itself from a "rogue" editor, as it is
> now just trusting that the editor wouldn't mess with its terminal
> settings after being invoked and it returns control to git.

Surely, bash keeps using the same TTY and it may be in its interest to "protect" it. We on the other hand would exit when we are done and no need for the TTY. In other words, bash may "own" TTY and it may want to take a good care of it. We don't.

I would have to say that your argument is a bit of stretch ;-).
Previous: Carlo ArenasNext: Johannes Schindelin
Message 15 of 25 in “Update to Git 2.34.0 breaks application”
  1. Alexander VeitNov 22, 2021
  2. Phillip WoodNov 22, 2021
  3. editor: only save (and restore) the terminal if using a ttyCarlo Marcelo Arenas Belón, Nov 22, 2021
  4. Junio C HamanoNov 22, 2021
  5. Junio C HamanoNov 22, 2021
  6. Junio C HamanoNov 22, 2021
  7. Alexander VeitNov 23, 2021
  8. Carlo ArenasNov 23, 2021
  9. Carlo ArenasNov 22, 2021
  10. Junio C HamanoNov 23, 2021
  11. Johannes SchindelinNov 24, 2021
  12. Carlo ArenasNov 24, 2021
  13. Junio C HamanoNov 24, 2021
  14. Carlo ArenasNov 24, 2021
  15. Junio C HamanoNov 24, 2021
  16. Johannes SchindelinNov 29, 2021
  17. Phillip WoodNov 23, 2021
  18. Junio C HamanoNov 23, 2021
  19. Carlo ArenasNov 23, 2021
  20. Phillip WoodNov 30, 2021
  21. Chris TorekDec 1, 2021
  22. Junio C HamanoDec 1, 2021
  23. Junio C HamanoDec 2, 2021
  24. Carlo ArenasDec 2, 2021
  25. Johannes SchindelinDec 2, 2021

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.