Show More
@@ -14,14 +14,13 b' import locale' | |||
|
14 | 14 | import os |
|
15 | 15 | import re |
|
16 | 16 | import signal |
|
17 | import struct | |
|
18 | import sys | |
|
19 | 17 | |
|
20 | 18 | from .i18n import _ |
|
21 | 19 | from . import ( |
|
22 | 20 | encoding, |
|
23 | 21 | error, |
|
24 | 22 | patch as patchmod, |
|
23 | scmutil, | |
|
25 | 24 | util, |
|
26 | 25 | ) |
|
27 | 26 | stringio = util.stringio |
@@ -52,11 +51,7 b' patchhelptext = _("""#' | |||
|
52 | 51 | |
|
53 | 52 | try: |
|
54 | 53 | import curses |
|
55 | import fcntl | |
|
56 | import termios | |
|
57 | 54 | curses.error |
|
58 | fcntl.ioctl | |
|
59 | termios.TIOCGWINSZ | |
|
60 | 55 | except ImportError: |
|
61 | 56 | # I have no idea if wcurses works with crecord... |
|
62 | 57 | try: |
@@ -75,8 +70,6 b' def checkcurses(ui):' | |||
|
75 | 70 | """ |
|
76 | 71 | return curses and ui.interface("chunkselector") == "curses" |
|
77 | 72 | |
|
78 | _origstdout = sys.__stdout__ # used by gethw() | |
|
79 | ||
|
80 | 73 | class patchnode(object): |
|
81 | 74 | """abstract class for patch graph nodes |
|
82 | 75 | (i.e. patchroot, header, hunk, hunkline) |
@@ -473,18 +466,6 b' def filterpatch(ui, chunks, chunkselecto' | |||
|
473 | 466 | |
|
474 | 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 | 469 | def chunkselector(ui, headerlist): |
|
489 | 470 | """ |
|
490 | 471 | curses interface to get selection of chunks, and mark the applied flags |
@@ -1259,7 +1240,7 b' class curseschunkselector(object):' | |||
|
1259 | 1240 | "handle window resizing" |
|
1260 | 1241 | try: |
|
1261 | 1242 | curses.endwin() |
|
1262 |
self. |
|
|
1243 | self.xscreensize, self.yscreensize = scmutil.termsize(self.ui) | |
|
1263 | 1244 | self.statuswin.resize(self.numstatuslines, self.xscreensize) |
|
1264 | 1245 | self.numpadlines = self.getnumlinesdisplayed(ignorefolding=True) + 1 |
|
1265 | 1246 | self.chunkpad = curses.newpad(self.numpadlines, self.xscreensize) |
General Comments 0
You need to be logged in to leave comments.
Login now