mercurial/crecord.py
changeset 42073 80103ed2e8ee
parent 42025 66fc05ff0ea3
child 42569 756326d54761
equal deleted inserted replaced
42072:fc0095256513 42073:80103ed2e8ee
  1465                       A : (un-)select all items
  1465                       A : (un-)select all items
  1466     up/down-arrow [k/j] : go to previous/next unfolded item
  1466     up/down-arrow [k/j] : go to previous/next unfolded item
  1467         pgup/pgdn [K/J] : go to previous/next item of same type
  1467         pgup/pgdn [K/J] : go to previous/next item of same type
  1468  right/left-arrow [l/h] : go to child item / parent item
  1468  right/left-arrow [l/h] : go to child item / parent item
  1469  shift-left-arrow   [H] : go to parent header / fold selected header
  1469  shift-left-arrow   [H] : go to parent header / fold selected header
       
  1470                       g : go to the top
       
  1471                       G : go to the bottom
  1470                       f : fold / unfold item, hiding/revealing its children
  1472                       f : fold / unfold item, hiding/revealing its children
  1471                       F : fold / unfold parent item and all of its ancestors
  1473                       F : fold / unfold parent item and all of its ancestors
  1472                  ctrl-l : scroll the selected line to the top of the screen
  1474                  ctrl-l : scroll the selected line to the top of the screen
  1473                       m : edit / resume editing the commit message
  1475                       m : edit / resume editing the commit message
  1474                       e : edit the currently selected hunk
  1476                       e : edit the currently selected hunk
  1502         curses.endwin()
  1504         curses.endwin()
  1503         self.commenttext = self.ui.edit(self.commenttext, self.ui.username())
  1505         self.commenttext = self.ui.edit(self.commenttext, self.ui.username())
  1504         curses.cbreak()
  1506         curses.cbreak()
  1505         self.stdscr.refresh()
  1507         self.stdscr.refresh()
  1506         self.stdscr.keypad(1) # allow arrow-keys to continue to function
  1508         self.stdscr.keypad(1) # allow arrow-keys to continue to function
       
  1509 
       
  1510     def handlefirstlineevent(self):
       
  1511         """
       
  1512         Handle 'g' to navigate to the top most file in the ncurses window.
       
  1513         """
       
  1514         self.currentselecteditem = self.headerlist[0]
       
  1515         currentitem = self.currentselecteditem
       
  1516         # select the parent item recursively until we're at a header
       
  1517         while True:
       
  1518             nextitem = currentitem.parentitem()
       
  1519             if nextitem is None:
       
  1520                 break
       
  1521             else:
       
  1522                 currentitem = nextitem
       
  1523 
       
  1524         self.currentselecteditem = currentitem
       
  1525 
       
  1526     def handlelastlineevent(self):
       
  1527         """
       
  1528         Handle 'G' to navigate to the bottom most file/hunk/line depending
       
  1529         on the whether the fold is active or not.
       
  1530 
       
  1531         If the bottom most file is folded, it navigates to that file and
       
  1532         stops there. If the bottom most file is unfolded, it navigates to
       
  1533         the bottom most hunk in that file and stops there. If the bottom most
       
  1534         hunk is unfolded, it navigates to the bottom most line in that hunk.
       
  1535         """
       
  1536         currentitem = self.currentselecteditem
       
  1537         nextitem = currentitem.nextitem()
       
  1538         # select the child item recursively until we're at a footer
       
  1539         while nextitem is not None:
       
  1540             nextitem = currentitem.nextitem()
       
  1541             if nextitem is None:
       
  1542                 break
       
  1543             else:
       
  1544                 currentitem = nextitem
       
  1545 
       
  1546         self.currentselecteditem = currentitem
       
  1547         self.recenterdisplayedarea()
  1507 
  1548 
  1508     def confirmationwindow(self, windowtext):
  1549     def confirmationwindow(self, windowtext):
  1509         "display an informational window, then wait for and return a keypress."
  1550         "display an informational window, then wait for and return a keypress."
  1510 
  1551 
  1511         confirmwin = curses.newwin(self.yscreensize, 0, 0, 0)
  1552         confirmwin = curses.newwin(self.yscreensize, 0, 0, 0)
  1723             self.togglefolded()
  1764             self.togglefolded()
  1724         elif keypressed in ["F"]:
  1765         elif keypressed in ["F"]:
  1725             self.togglefolded(foldparent=True)
  1766             self.togglefolded(foldparent=True)
  1726         elif keypressed in ["m"]:
  1767         elif keypressed in ["m"]:
  1727             self.commitMessageWindow()
  1768             self.commitMessageWindow()
       
  1769         elif keypressed in ["g", "KEY_HOME"]:
       
  1770             self.handlefirstlineevent()
       
  1771         elif keypressed in ["G", "KEY_END"]:
       
  1772             self.handlelastlineevent()
  1728         elif keypressed in ["?"]:
  1773         elif keypressed in ["?"]:
  1729             self.helpwindow()
  1774             self.helpwindow()
  1730             self.stdscr.clear()
  1775             self.stdscr.clear()
  1731             self.stdscr.refresh()
  1776             self.stdscr.refresh()
  1732         elif curses.unctrl(keypressed) in ["^L"]:
  1777         elif curses.unctrl(keypressed) in ["^L"]: