@@ -97,6 +97,9 @@ def get_input_content(self):
9797 return self .view .substr (input_region )
9898 else :
9999 return ""
100+
101+ def check_R (self ):
102+ pass
100103
101104
102105class CodeCellView (BaseCellView ):
@@ -260,7 +263,7 @@ def setup(self, edit):
260263 reg = sublime .Region (start , end )
261264 regs = view .get_regions ("inb_input" )
262265 regs .append (reg )
263- view .add_regions ("inb_input" , regs , "text.tex.latex " , "" , input_draw_style )
266+ view .add_regions ("inb_input" , regs , "source.python " , "" , input_draw_style )
264267 self .view .set_read_only (False )
265268
266269 end = end + view .insert (edit , end , "#/" + self .get_cell_title ())
@@ -356,7 +359,7 @@ def on_modified(self):
356359 for s in self .view .sel ():
357360 for i , reg in enumerate (regset ):
358361 reg = sublime .Region (reg .begin ()+ 1 , reg .end ()- 1 )
359- if reg .contains (s ):
362+ if reg .contains (s ) and ( i < len ( self . cells )) :
360363 self .cells [i ].check_R ()
361364 break
362365
@@ -484,6 +487,11 @@ def set_status():
484487 sublime .set_timeout (set_status , 0 )
485488
486489 def handle_completions (self , view , prefix , locations ):
490+ cell_index = self .get_current_cell_index ()
491+ if cell_index < 0 :
492+ return None
493+ if not isinstance (self .cells [cell_index ], CodeCellView ):
494+ return None
487495 sel = view .sel ()
488496 if len (sel ) > 1 :
489497 return []
0 commit comments