@@ -159,6 +159,13 @@ def construct_line_display(self):
159159 # Note that we're receiving one-based line numbers from the
160160 # user and storing and emitting zero-base line numbers.
161161
162+ def go_to_line_text (text ):
163+ try :
164+ line = int (text )
165+ except ValueError :
166+ return
167+ self .emit ('go-to-line' , max (0 , line - 1 ))
168+
162169 def line_entry_mapped (entry ):
163170 line , offset = self .props .cursor_position
164171 entry .set_text (str (line + 1 ))
@@ -168,12 +175,12 @@ def line_entry_insert_text(entry, new_text, length, position):
168175 GObject .signal_stop_emission_by_name (entry , 'insert-text' )
169176 return
170177
178+ def line_entry_changed (entry ):
179+ go_to_line_text (entry .get_text ())
180+
171181 def line_entry_activated (entry ):
172- try :
173- line = int (entry .get_text ())
174- except ValueError :
175- return
176- self .emit ('go-to-line' , max (0 , line - 1 ))
182+ go_to_line_text (entry .get_text ())
183+ pop .popdown ()
177184
178185 entry = Gtk .Entry ()
179186 entry .set_tooltip_text (_ ('Line you want to move the cursor to' ))
@@ -183,6 +190,7 @@ def line_entry_activated(entry):
183190 entry .set_input_purpose (Gtk .InputPurpose .DIGITS )
184191 entry .connect ('map' , line_entry_mapped )
185192 entry .connect ('insert-text' , line_entry_insert_text )
193+ entry .connect ('changed' , line_entry_changed )
186194 entry .connect ('activate' , line_entry_activated )
187195
188196 selector = Gtk .Grid ()
0 commit comments