##// END OF EJS Templates
py3: keep "keypressed" a native str in crecord...
Denis Laxalde -
r43795:7cc91339 stable
parent child Browse files
Show More
@@ -24,7 +24,6 b' from . import ('
24 encoding,
24 encoding,
25 error,
25 error,
26 patch as patchmod,
26 patch as patchmod,
27 pycompat,
28 scmutil,
27 scmutil,
29 util,
28 util,
30 )
29 )
@@ -607,8 +606,8 b' def testchunkselector(testfn, ui, header'
607
606
608 chunkselector.stdscr = dummystdscr()
607 chunkselector.stdscr = dummystdscr()
609 if testfn and os.path.exists(testfn):
608 if testfn and os.path.exists(testfn):
610 testf = open(testfn, b'rb')
609 testf = open(testfn, 'r')
611 testcommands = [x.rstrip(b'\n') for x in testf.readlines()]
610 testcommands = [x.rstrip('\n') for x in testf.readlines()]
612 testf.close()
611 testf.close()
613 while True:
612 while True:
614 if chunkselector.handlekeypressed(testcommands.pop(0), test=True):
613 if chunkselector.handlekeypressed(testcommands.pop(0), test=True):
@@ -1887,60 +1886,59 b' are you sure you want to review/edit and'
1887
1886
1888 Return true to exit the main loop.
1887 Return true to exit the main loop.
1889 """
1888 """
1890 keypressed = pycompat.bytestr(keypressed)
1889 if keypressed in ["k", "KEY_UP"]:
1891 if keypressed in [b"k", b"KEY_UP"]:
1892 self.uparrowevent()
1890 self.uparrowevent()
1893 elif keypressed in [b"K", b"KEY_PPAGE"]:
1891 elif keypressed in ["K", "KEY_PPAGE"]:
1894 self.uparrowshiftevent()
1892 self.uparrowshiftevent()
1895 elif keypressed in [b"j", b"KEY_DOWN"]:
1893 elif keypressed in ["j", "KEY_DOWN"]:
1896 self.downarrowevent()
1894 self.downarrowevent()
1897 elif keypressed in [b"J", b"KEY_NPAGE"]:
1895 elif keypressed in ["J", "KEY_NPAGE"]:
1898 self.downarrowshiftevent()
1896 self.downarrowshiftevent()
1899 elif keypressed in [b"l", b"KEY_RIGHT"]:
1897 elif keypressed in ["l", "KEY_RIGHT"]:
1900 self.rightarrowevent()
1898 self.rightarrowevent()
1901 elif keypressed in [b"h", b"KEY_LEFT"]:
1899 elif keypressed in ["h", "KEY_LEFT"]:
1902 self.leftarrowevent()
1900 self.leftarrowevent()
1903 elif keypressed in [b"H", b"KEY_SLEFT"]:
1901 elif keypressed in ["H", "KEY_SLEFT"]:
1904 self.leftarrowshiftevent()
1902 self.leftarrowshiftevent()
1905 elif keypressed in [b"q"]:
1903 elif keypressed in ["q"]:
1906 raise error.Abort(_(b'user quit'))
1904 raise error.Abort(_(b'user quit'))
1907 elif keypressed in [b'a']:
1905 elif keypressed in ['a']:
1908 self.toggleamend(self.opts, test)
1906 self.toggleamend(self.opts, test)
1909 elif keypressed in [b"c"]:
1907 elif keypressed in ["c"]:
1910 return True
1908 return True
1911 elif keypressed in [b"r"]:
1909 elif keypressed in ["r"]:
1912 if self.reviewcommit():
1910 if self.reviewcommit():
1913 self.opts[b'review'] = True
1911 self.opts[b'review'] = True
1914 return True
1912 return True
1915 elif test and keypressed in [b'R']:
1913 elif test and keypressed in ["R"]:
1916 self.opts[b'review'] = True
1914 self.opts[b'review'] = True
1917 return True
1915 return True
1918 elif keypressed in [b' ', b'x']:
1916 elif keypressed in [" ", "x"]:
1919 self.toggleapply()
1917 self.toggleapply()
1920 elif keypressed in [b'\n', b'KEY_ENTER']:
1918 elif keypressed in ["\n", "KEY_ENTER"]:
1921 self.toggleapply()
1919 self.toggleapply()
1922 self.nextsametype(test=test)
1920 self.nextsametype(test=test)
1923 elif keypressed in [b'X']:
1921 elif keypressed in ["X"]:
1924 self.toggleallbetween()
1922 self.toggleallbetween()
1925 elif keypressed in [b'A']:
1923 elif keypressed in ["A"]:
1926 self.toggleall()
1924 self.toggleall()
1927 elif keypressed in [b'e']:
1925 elif keypressed in ["e"]:
1928 self.toggleedit(test=test)
1926 self.toggleedit(test=test)
1929 elif keypressed in [b"f"]:
1927 elif keypressed in ["f"]:
1930 self.togglefolded()
1928 self.togglefolded()
1931 elif keypressed in [b"F"]:
1929 elif keypressed in ["F"]:
1932 self.togglefolded(foldparent=True)
1930 self.togglefolded(foldparent=True)
1933 elif keypressed in [b"m"]:
1931 elif keypressed in ["m"]:
1934 self.commitMessageWindow()
1932 self.commitMessageWindow()
1935 elif keypressed in [b"g", b"KEY_HOME"]:
1933 elif keypressed in ["g", "KEY_HOME"]:
1936 self.handlefirstlineevent()
1934 self.handlefirstlineevent()
1937 elif keypressed in [b"G", b"KEY_END"]:
1935 elif keypressed in ["G", "KEY_END"]:
1938 self.handlelastlineevent()
1936 self.handlelastlineevent()
1939 elif keypressed in [b"?"]:
1937 elif keypressed in ["?"]:
1940 self.helpwindow()
1938 self.helpwindow()
1941 self.stdscr.clear()
1939 self.stdscr.clear()
1942 self.stdscr.refresh()
1940 self.stdscr.refresh()
1943 elif curses.unctrl(keypressed) in [b"^L"]:
1941 elif curses.unctrl(keypressed) in ["^L"]:
1944 # scroll the current line to the top of the screen, and redraw
1942 # scroll the current line to the top of the screen, and redraw
1945 # everything
1943 # everything
1946 self.scrolllines(self.selecteditemstartline)
1944 self.scrolllines(self.selecteditemstartline)
General Comments 0
You need to be logged in to leave comments. Login now