eric7/QScintilla/Editor.py

branch
eric7
changeset 8524
595547ab8d6f
parent 8522
4f263b89a293
child 8535
409de549193e
diff -r 14e1ee6e720b -r 595547ab8d6f eric7/QScintilla/Editor.py
--- a/eric7/QScintilla/Editor.py	Fri Aug 20 14:19:55 2021 +0200
+++ b/eric7/QScintilla/Editor.py	Fri Aug 20 18:02:46 2021 +0200
@@ -36,6 +36,8 @@
 from .EditorMarkerMap import EditorMarkerMap
 from .SpellChecker import SpellChecker
 
+from Globals import recentNameBreakpointConditions
+
 import Preferences
 import Utilities
 from Utilities import MouseUtilities
@@ -238,7 +240,6 @@
         
         self.__loadEditorConfig()
         
-        self.condHistory = []
         self.__lexerReset = False
         self.completer = None
         self.encoding = self.__getEditorConfig("DefaultEncoding")
@@ -2517,16 +2518,36 @@
                 if not index.isValid():
                     return
                 
+                # get recently used breakpoint conditions
+                rs = Preferences.Prefs.rsettings.value(
+                    recentNameBreakpointConditions)
+                condHistory = (
+                    Preferences.toList(rs)[
+                        :Preferences.getDebugger("RecentNumber")]
+                    if rs is not None else
+                    []
+                )
+                
                 from Debugger.EditBreakpointDialog import EditBreakpointDialog
                 dlg = EditBreakpointDialog(
                     (self.fileName, ln),
                     (cond, temp, enabled, ignorecount),
-                    self.condHistory, self, modal=True)
+                    condHistory, self, modal=True)
                 if dlg.exec() == QDialog.DialogCode.Accepted:
                     cond, temp, enabled, ignorecount = dlg.getData()
                     self.breakpointModel.setBreakPointByIndex(
                         index, self.fileName, ln,
                         (cond, temp, enabled, ignorecount))
+                    
+                    if cond:
+                        # save the recently used breakpoint condition
+                        if cond in condHistory:
+                            condHistory.remove(cond)
+                        condHistory.insert(0, cond)
+                        Preferences.Prefs.rsettings.setValue(
+                            recentNameBreakpointConditions, condHistory)
+                        Preferences.Prefs.rsettings.sync()
+                    
                     break
         
         self.line = -1

eric ide

mercurial