@@ -101,7 +101,7 @@ def __init__(self, app):
101101 else :
102102 for button in self .statusBar .buttons :
103103 self .gui .add_button (button )
104- self .setWindowTitle ("Durdraw" )
104+ # self.setWindowTitle("Durdraw")
105105
106106 # set a default drawing character
107107 self .appState .drawChar = chr (self .chMap ['f4' ])
@@ -187,6 +187,7 @@ def enableTransBackground(self):
187187 def setWindowTitle (self , title ):
188188 title = f"Durdraw - { title } "
189189 sys .stdout .write (f"\x1b ]2;{ title } \x07 " )
190+ sys .stdout .flush ()
190191
191192 def getPlaybackRange (self ):
192193 """ ask for playback range presses cmd-r """
@@ -590,6 +591,27 @@ def clearCanvas(self, prompting = False):
590591 self .move_cursor_topleft ()
591592 self .hardRefresh ()
592593
594+ def searchForStringPrompt (self ):
595+ self .stdscr .nodelay (0 ) # wait for input when calling getch
596+ self .promptPrint ("Enter string to search: " )
597+ curses .echo ()
598+ search_string = self .stdscr .getstr ().decode ('utf-8' )
599+ curses .noecho ()
600+
601+ search_result = self .mov .search_for_string (search_string )
602+ if search_result == False :
603+ self .notify ("No results found." )
604+ else :
605+ line = search_result ["line" ]
606+ column = search_result ["col" ]
607+ frame_num = search_result ["frame" ]
608+ self .mov .gotoFrame (frame_num )
609+ self .move_cursor_to_line_and_column (line , column )
610+
611+ if self .playing :
612+ elf .stdscr .nodelay (1 )
613+
614+
593615 def showCharInspector (self ):
594616 line = self .xy [0 ]
595617 col = self .xy [1 ] - 1
@@ -920,6 +942,7 @@ def startPlaying(self):
920942 self .appState .sideBarShowing = False
921943 self .statusBar .hide ()
922944 self .cursorOff ()
945+ self .setWindowTitle (self .appState .curOpenFileName )
923946 self .playing = True
924947 self .metaKey = 0
925948 if self .appState .playOnlyMode :
@@ -1405,6 +1428,10 @@ def resizeHandler(self):
14051428 def drawStatusBar (self ):
14061429 if self .statusBar .hidden :
14071430 return False
1431+
1432+
1433+ self .setWindowTitle (self .appState .curOpenFileName )
1434+
14081435 mainColor = self .appState .theme ['mainColor' ]
14091436 clickColor = self .appState .theme ['clickColor' ]
14101437
@@ -1794,6 +1821,8 @@ def mainLoop(self):
17941821 self .clickedUndo ()
17951822 elif c == 114 : # alt-r = redo
17961823 self .clickedRedo ()
1824+ elif c == ord ('F' ): # alt-F, find/search
1825+ self .searchForStringPrompt ()
17971826 elif c == 118 : # alt-v - paste
17981827 # Paste from the clipboard
17991828 if self .clipBoard : # If there is something in the clipboard
@@ -2131,6 +2160,8 @@ def enterViewMode(self):
21312160 oldDrawBorders = self .appState .drawBorders # to turn back on when done
21322161 self .appState .playOnlyMode = True
21332162 self .startPlaying ()
2163+
2164+ # Return to normal when done
21342165 self .appState .playOnlyMode = False
21352166 self .appState .topLine = old_top_line
21362167 self .statusBar .show ()
@@ -2213,6 +2244,10 @@ def move_cursor_home(self):
22132244 def move_cursor_end (self ):
22142245 self .xy [1 ] = self .mov .sizeX
22152246
2247+ def move_cursor_to_line_and_column (self , line , col ):
2248+ self .xy [0 ] = line
2249+ self .xy [1 ] = col
2250+
22162251 def getDelayValue (self ):
22172252 """ Ask the user for the delay value to set for current frame, then
22182253 set it """
@@ -3213,7 +3248,7 @@ def loadFromFile(self, shortfile, loadFormat): # shortfile = non full path file
32133248 if self .appState .debug : self .notify (f"Finished loading JSON dur file" )
32143249 self .appState .curOpenFileName = os .path .basename (filename )
32153250 self .appState .modified = False
3216- self .setWindowTitle (shortfile )
3251+ # self.setWindowTitle(shortfile)
32173252 self .convertToCurrentFormat (fileColorMode = fileColorMode )
32183253
32193254 # Convert palettes as necessary
@@ -3272,7 +3307,7 @@ def loadFromFile(self, shortfile, loadFormat): # shortfile = non full path file
32723307 if loadFormat == 'ascii' : # loading as dur failed, so load as ascii instead.
32733308 self .loadFromFile (shortfile , loadFormat )
32743309 self .appState .modified = False
3275- self .setWindowTitle (shortfile )
3310+ # self.setWindowTitle(shortfile)
32763311 self .mov .gotoFrame (1 )
32773312 self .hardRefresh ()
32783313
@@ -3437,7 +3472,7 @@ def save(self):
34373472 self .appState .curOpenFileName = os .path .basename (filename )
34383473 self .appState .modified = False
34393474 self .undo .modifications = 0
3440- self .setWindowTitle (self .appState .curOpenFileName )
3475+ # self.setWindowTitle(self.appState.curOpenFileName)
34413476 elif not saved :
34423477 self .notify ("Save failed." )
34433478
0 commit comments