# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1707969238 18000 # Node ID 47c74c12020508a300627532917f266331dd3ea3 # Parent 6fb4d2dfa8e4a6dd0e187a90c8fa7767e19e8099 crecord: add a searchdirection function If a regex has already been previously set, this function handles the UI elements of searching again forward or backward. diff -r 6fb4d2dfa8e4 -r 47c74c120205 mercurial/crecord.py --- a/mercurial/crecord.py Wed Feb 14 22:50:00 2024 -0500 +++ b/mercurial/crecord.py Wed Feb 14 22:53:58 2024 -0500 @@ -1939,6 +1939,20 @@ return matches + def searchdirection(self, failuremsg, forward=True): + if not self.regex: + return + + if not self.showsearch(self.regex, forward=forward): + win = curses.newwin(1, self.xscreensize, self.yscreensize - 1, 0) + self.printstring(win, failuremsg, pairname=b"legend", align=False) + while win.getkey() not in ["\n", "KEY_ENTER"]: + pass + del win + + self.stdscr.clear() + self.stdscr.refresh() + def handlekeypressed(self, keypressed, test=False): """ Perform actions based on pressed keys.