eric7/QScintilla/Editor.py

branch
eric7
changeset 8539
24daea9ad41b
parent 8535
409de549193e
child 8581
a6c893c8b7af
equal deleted inserted replaced
8538:01b7559d3f4e 8539:24daea9ad41b
5 5
6 """ 6 """
7 Module implementing the editor component of the eric IDE. 7 Module implementing the editor component of the eric IDE.
8 """ 8 """
9 9
10 import bisect
10 import collections 11 import collections
11 import contextlib 12 import contextlib
12 import difflib 13 import difflib
13 import os 14 import os
14 import re 15 import re
41 import Preferences 42 import Preferences
42 import Utilities 43 import Utilities
43 from Utilities import MouseUtilities 44 from Utilities import MouseUtilities
44 45
45 import UI.PixmapCache 46 import UI.PixmapCache
47
48 from UI import PythonDisViewer
46 49
47 EditorAutoCompletionListID = 1 50 EditorAutoCompletionListID = 1
48 TemplateCompletionListID = 2 51 TemplateCompletionListID = 2
49 ReferencesListID = 3 52 ReferencesListID = 3
50 53
2413 2416
2414 @param line line number of the breakpoint (integer) 2417 @param line line number of the breakpoint (integer)
2415 @param temporary flag indicating a temporary breakpoint (boolean) 2418 @param temporary flag indicating a temporary breakpoint (boolean)
2416 """ 2419 """
2417 if self.fileName and self.isPyFile(): 2420 if self.fileName and self.isPyFile():
2421 linestarts = PythonDisViewer.linestarts(self.text())
2422 if line not in linestarts:
2423 if Preferences.getDebugger("IntelligentBreakpoints"):
2424 # change line to the next one starting an instruction block
2425 index = bisect.bisect(linestarts, line)
2426 with contextlib.suppress(IndexError):
2427 line = linestarts[index]
2428 self.__toggleBreakpoint(line, temporary=temporary)
2429 else:
2430 EricMessageBox.warning(
2431 self,
2432 self.tr("Add Breakpoint"),
2433 self.tr("No Python byte code will be created for the"
2434 " selected line. No break point will be set!")
2435 )
2436 return
2437
2418 self.breakpointModel.addBreakPoint( 2438 self.breakpointModel.addBreakPoint(
2419 self.fileName, line, ('', temporary, True, 0)) 2439 self.fileName, line, ('', temporary, True, 0))
2420 self.breakpointToggled.emit(self) 2440 self.breakpointToggled.emit(self)
2421 2441
2422 def __toggleBreakpointEnabled(self, line): 2442 def __toggleBreakpointEnabled(self, line):

eric ide

mercurial