Show More
@@ -14,14 +14,13 b' import locale' | |||||
14 | import os |
|
14 | import os | |
15 | import re |
|
15 | import re | |
16 | import signal |
|
16 | import signal | |
17 | import struct |
|
|||
18 | import sys |
|
|||
19 |
|
17 | |||
20 | from .i18n import _ |
|
18 | from .i18n import _ | |
21 | from . import ( |
|
19 | from . import ( | |
22 | encoding, |
|
20 | encoding, | |
23 | error, |
|
21 | error, | |
24 | patch as patchmod, |
|
22 | patch as patchmod, | |
|
23 | scmutil, | |||
25 | util, |
|
24 | util, | |
26 | ) |
|
25 | ) | |
27 | stringio = util.stringio |
|
26 | stringio = util.stringio | |
@@ -52,11 +51,7 b' patchhelptext = _("""#' | |||||
52 |
|
51 | |||
53 | try: |
|
52 | try: | |
54 | import curses |
|
53 | import curses | |
55 | import fcntl |
|
|||
56 | import termios |
|
|||
57 | curses.error |
|
54 | curses.error | |
58 | fcntl.ioctl |
|
|||
59 | termios.TIOCGWINSZ |
|
|||
60 | except ImportError: |
|
55 | except ImportError: | |
61 | # I have no idea if wcurses works with crecord... |
|
56 | # I have no idea if wcurses works with crecord... | |
62 | try: |
|
57 | try: | |
@@ -75,8 +70,6 b' def checkcurses(ui):' | |||||
75 | """ |
|
70 | """ | |
76 | return curses and ui.interface("chunkselector") == "curses" |
|
71 | return curses and ui.interface("chunkselector") == "curses" | |
77 |
|
72 | |||
78 | _origstdout = sys.__stdout__ # used by gethw() |
|
|||
79 |
|
||||
80 | class patchnode(object): |
|
73 | class patchnode(object): | |
81 | """abstract class for patch graph nodes |
|
74 | """abstract class for patch graph nodes | |
82 | (i.e. patchroot, header, hunk, hunkline) |
|
75 | (i.e. patchroot, header, hunk, hunkline) | |
@@ -473,18 +466,6 b' def filterpatch(ui, chunks, chunkselecto' | |||||
473 |
|
466 | |||
474 | return (appliedhunklist, ret) |
|
467 | return (appliedhunklist, ret) | |
475 |
|
468 | |||
476 | def gethw(): |
|
|||
477 | """ |
|
|||
478 | magically get the current height and width of the window (without initscr) |
|
|||
479 |
|
||||
480 | this is a rip-off of a rip-off - taken from the bpython code. it is |
|
|||
481 | useful / necessary because otherwise curses.initscr() must be called, |
|
|||
482 | which can leave the terminal in a nasty state after exiting. |
|
|||
483 | """ |
|
|||
484 | h, w = struct.unpack( |
|
|||
485 | "hhhh", fcntl.ioctl(_origstdout, termios.TIOCGWINSZ, "\000"*8))[0:2] |
|
|||
486 | return h, w |
|
|||
487 |
|
||||
488 | def chunkselector(ui, headerlist): |
|
469 | def chunkselector(ui, headerlist): | |
489 | """ |
|
470 | """ | |
490 | curses interface to get selection of chunks, and mark the applied flags |
|
471 | curses interface to get selection of chunks, and mark the applied flags | |
@@ -1259,7 +1240,7 b' class curseschunkselector(object):' | |||||
1259 | "handle window resizing" |
|
1240 | "handle window resizing" | |
1260 | try: |
|
1241 | try: | |
1261 | curses.endwin() |
|
1242 | curses.endwin() | |
1262 |
self. |
|
1243 | self.xscreensize, self.yscreensize = scmutil.termsize(self.ui) | |
1263 | self.statuswin.resize(self.numstatuslines, self.xscreensize) |
|
1244 | self.statuswin.resize(self.numstatuslines, self.xscreensize) | |
1264 | self.numpadlines = self.getnumlinesdisplayed(ignorefolding=True) + 1 |
|
1245 | self.numpadlines = self.getnumlinesdisplayed(ignorefolding=True) + 1 | |
1265 | self.chunkpad = curses.newpad(self.numpadlines, self.xscreensize) |
|
1246 | self.chunkpad = curses.newpad(self.numpadlines, self.xscreensize) |
General Comments 0
You need to be logged in to leave comments.
Login now