Mercurial > public > mercurial-scm > hg-stable
diff hgext/histedit.py @ 44826:1bab6b61b62b stable
curses: do not initialize LC_ALL to user settings (issue6358)
701341f57ceb moved the setlocale() call to right before curses was used. This
didn?t fully solve the problem it was supposed to solve (locale-dependent
functions, like date formatting/parsing and str methods on Python 2), but only
postponed it.
Initializing LC_CTYPE seems to be sufficient for curses to work correctly.
Therefore LC_CTYPE is set while curses is used and reset afterwards. Some
locale-dependent str methods might behave differently on Python 2 while curses
is used, but that shouldn?d be a problem.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Sun, 28 Jun 2020 18:02:45 +0200 |
parents | e147748f750b |
children | 4a503c1b664a |
line wrap: on
line diff
--- a/hgext/histedit.py Thu Jun 25 03:46:07 2020 +0200 +++ b/hgext/histedit.py Sun Jun 28 18:02:45 2020 +0200 @@ -201,7 +201,6 @@ termios = None import functools -import locale import os import struct @@ -1710,11 +1709,8 @@ ctxs = [] for i, r in enumerate(revs): ctxs.append(histeditrule(ui, repo[r], i)) - # Curses requires setting the locale or it will default to the C - # locale. This sets the locale to the user's default system - # locale. - locale.setlocale(locale.LC_ALL, '') - rc = curses.wrapper(functools.partial(_chisteditmain, repo, ctxs)) + with util.with_lc_ctype(): + rc = curses.wrapper(functools.partial(_chisteditmain, repo, ctxs)) curses.echo() curses.endwin() if rc is False: