Show More
@@ -1,6 +1,6 b'' | |||
|
1 | 1 | # -*- coding: iso-8859-1 -*- |
|
2 | 2 | |
|
3 | import curses, textwrap | |
|
3 | import curses, fcntl, signal, struct, tty, textwrap | |
|
4 | 4 | |
|
5 | 5 | import astyle, ipipe |
|
6 | 6 | |
@@ -864,6 +864,9 b' class ibrowse(ipipe.Display):' | |||
|
864 | 864 | # e.g. normal browsing or entering an argument for a command |
|
865 | 865 | self.mode = "default" |
|
866 | 866 | |
|
867 | # set by the SIGWINCH signal handler | |
|
868 | self.resized = False | |
|
869 | ||
|
867 | 870 | def nextstepx(self, step): |
|
868 | 871 | """ |
|
869 | 872 | Accelerate horizontally. |
@@ -1300,6 +1303,9 b' class ibrowse(ipipe.Display):' | |||
|
1300 | 1303 | |
|
1301 | 1304 | self.enter(_BrowserHelp(self), "default") |
|
1302 | 1305 | |
|
1306 | def sigwinchhandler(self, signal, frame): | |
|
1307 | self.resized = True | |
|
1308 | ||
|
1303 | 1309 | def cmd_hideattr(self): |
|
1304 | 1310 | level = self.levels[-1] |
|
1305 | 1311 | if level.displayattr[0] is None: |
@@ -1558,6 +1564,20 b' class ibrowse(ipipe.Display):' | |||
|
1558 | 1564 | # Check keyboard |
|
1559 | 1565 | while True: |
|
1560 | 1566 | c = scr.getch() |
|
1567 | if self.resized: | |
|
1568 | size = fcntl.ioctl(0, tty.TIOCGWINSZ, "12345678") | |
|
1569 | size = struct.unpack("4H", size) | |
|
1570 | oldsize = scr.getmaxyx() | |
|
1571 | scr.erase() | |
|
1572 | curses.resize_term(size[0], size[1]) | |
|
1573 | newsize = scr.getmaxyx() | |
|
1574 | scr.erase() | |
|
1575 | for l in self.levels: | |
|
1576 | l.mainsizey += newsize[0]-oldsize[0] | |
|
1577 | l.moveto(l.curx, l.cury, refresh=True) | |
|
1578 | scr.refresh() | |
|
1579 | self.resized = False | |
|
1580 | break # Redisplay | |
|
1561 | 1581 | if self.mode in self.prompts: |
|
1562 | 1582 | if self.prompts[self.mode].handlekey(self, c): |
|
1563 | 1583 | break # Redisplay |
@@ -1596,4 +1616,11 b' class ibrowse(ipipe.Display):' | |||
|
1596 | 1616 | self.scr = None |
|
1597 | 1617 | |
|
1598 | 1618 | def display(self): |
|
1619 | if hasattr(curses, "resize_term"): | |
|
1620 | oldhandler = signal.signal(signal.SIGWINCH, self.sigwinchhandler) | |
|
1621 | try: | |
|
1622 | return curses.wrapper(self._dodisplay) | |
|
1623 | finally: | |
|
1624 | signal.signal(signal.SIGWINCH, oldhandler) | |
|
1625 | else: | |
|
1599 | 1626 | return curses.wrapper(self._dodisplay) |
@@ -1,3 +1,8 b'' | |||
|
1 | 2006-06-19 Walter Doerwald <walter@livinglogic.de> | |
|
2 | ||
|
3 | * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal | |
|
4 | resizing. This requires Python 2.5 to word. | |
|
5 | ||
|
1 | 6 | 2006-06-16 Walter Doerwald <walter@livinglogic.de> |
|
2 | 7 | |
|
3 | 8 | * IPython/Extensions/ibrowse.py: Add two new commands to |
General Comments 0
You need to be logged in to leave comments.
Login now