Mercurial > hg
comparison mercurial/crecord.py @ 51385:47c74c120205
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.
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Wed, 14 Feb 2024 22:53:58 -0500 |
parents | 6fb4d2dfa8e4 |
children | d0f6b96d1fb8 |
comparison
equal
deleted
inserted
replaced
51384:6fb4d2dfa8e4 | 51385:47c74c120205 |
---|---|
1936 while matches and unfolded: | 1936 while matches and unfolded: |
1937 unfolded.folded = False | 1937 unfolded.folded = False |
1938 unfolded = unfolded.parentitem() | 1938 unfolded = unfolded.parentitem() |
1939 | 1939 |
1940 return matches | 1940 return matches |
1941 | |
1942 def searchdirection(self, failuremsg, forward=True): | |
1943 if not self.regex: | |
1944 return | |
1945 | |
1946 if not self.showsearch(self.regex, forward=forward): | |
1947 win = curses.newwin(1, self.xscreensize, self.yscreensize - 1, 0) | |
1948 self.printstring(win, failuremsg, pairname=b"legend", align=False) | |
1949 while win.getkey() not in ["\n", "KEY_ENTER"]: | |
1950 pass | |
1951 del win | |
1952 | |
1953 self.stdscr.clear() | |
1954 self.stdscr.refresh() | |
1941 | 1955 |
1942 def handlekeypressed(self, keypressed, test=False): | 1956 def handlekeypressed(self, keypressed, test=False): |
1943 """ | 1957 """ |
1944 Perform actions based on pressed keys. | 1958 Perform actions based on pressed keys. |
1945 | 1959 |