##// END OF EJS Templates
curses: do not setlocale() at import time (issue5261)...
Yuya Nishihara -
r43268:701341f5 stable
parent child Browse files
Show More
@@ -201,6 +201,7 b' except ImportError:'
201 201 termios = None
202 202
203 203 import functools
204 import locale
204 205 import os
205 206 import struct
206 207
@@ -947,12 +948,6 b' def findoutgoing(ui, repo, remote=None, '
947 948 # Curses Support
948 949 try:
949 950 import curses
950
951 # Curses requires setting the locale or it will default to the C
952 # locale. This sets the locale to the user's default system
953 # locale.
954 import locale
955 locale.setlocale(locale.LC_ALL, r'')
956 951 except ImportError:
957 952 curses = None
958 953
@@ -1538,6 +1533,10 b' def _chistedit(ui, repo, *freeargs, **op'
1538 1533 ctxs = []
1539 1534 for i, r in enumerate(revs):
1540 1535 ctxs.append(histeditrule(repo[r], i))
1536 # Curses requires setting the locale or it will default to the C
1537 # locale. This sets the locale to the user's default system
1538 # locale.
1539 locale.setlocale(locale.LC_ALL, r'')
1541 1540 rc = curses.wrapper(functools.partial(_chisteditmain, repo, ctxs))
1542 1541 curses.echo()
1543 1542 curses.endwin()
@@ -2323,4 +2322,3 b' def extsetup(ui):'
2323 2322 cmdutil.summaryhooks.add('histedit', summaryhook)
2324 2323 statemod.addunfinished('histedit', fname='histedit-state', allowcommit=True,
2325 2324 continueflag=True, abortfunc=hgaborthistedit)
2326
@@ -29,10 +29,6 b' from .utils import ('
29 29 )
30 30 stringio = util.stringio
31 31
32 # This is required for ncurses to display non-ASCII characters in default user
33 # locale encoding correctly. --immerrr
34 locale.setlocale(locale.LC_ALL, r'')
35
36 32 # patch comments based on the git one
37 33 diffhelptext = _("""# To remove '-' lines, make them ' ' lines (context).
38 34 # To remove '+' lines, delete them.
@@ -530,6 +526,9 b' def chunkselector(ui, headerlist, operat'
530 526 """
531 527 ui.write(_('starting interactive selection\n'))
532 528 chunkselector = curseschunkselector(headerlist, ui, operation)
529 # This is required for ncurses to display non-ASCII characters in
530 # default user locale encoding correctly. --immerrr
531 locale.setlocale(locale.LC_ALL, r'')
533 532 origsigtstp = sentinel = object()
534 533 if util.safehasattr(signal, 'SIGTSTP'):
535 534 origsigtstp = signal.getsignal(signal.SIGTSTP)
General Comments 0
You need to be logged in to leave comments. Login now