Advertisement
Guest User

scite_rev3630.patch

a guest
Sep 27th, 2011
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.21 KB | None | 0 0
  1. # HG changeset patch
  2. # User Jerome LAFORGE <jerome.laforge@gmail.com>
  3. # Date 1317127561 -7200
  4. # Branch AddSessionFindWhat
  5. # Node ID 60d66825e5f271c5143b6f7ff1ca6e1eccc40a72
  6. # Parent  4708e0216ca160da0786fa822fbe343e51ebca4b
  7. Add save.find to save "Find what" and "Replace with" into session.
  8.  
  9. diff -r 4708e0216ca1 -r 60d66825e5f2 doc/SciTEDoc.html
  10. --- a/doc/SciTEDoc.html dim. sept. 25 09:58:27 2011 +1000
  11. +++ b/doc/SciTEDoc.html mar. sept. 27 14:46:01 2011 +0200
  12. @@ -2315,7 +2315,8 @@
  13.          <td>
  14.            save.session<br />
  15.            save.recent<br />
  16. -          save.position
  17. +          save.position<br />
  18. +          save.find
  19.          </td>
  20.          <td>
  21.          If you set save.session, the list of currently opened buffers will be saved on exit
  22. @@ -2331,7 +2332,9 @@
  23.          Setting save.recent causes the most recently used files list to be saved on
  24.          exit in the session file and read at start up.<br />
  25.          Setting save.position causes the SciTE window position on the desktop to be
  26. -        saved on exit in the session file and restored at start up.
  27. +        saved on exit in the session file and restored at start up.<br />
  28. +        Setting save.find cause the "Find what" and "Replace with" to be saved on
  29. +        exit in the session file and read at start up.
  30.          </td>
  31.        </tr>
  32.        <tr>
  33. diff -r 4708e0216ca1 -r 60d66825e5f2 src/SciTEBase.cxx
  34. --- a/src/SciTEBase.cxx dim. sept. 25 09:58:27 2011 +1000
  35. +++ b/src/SciTEBase.cxx mar. sept. 27 14:46:01 2011 +0200
  36. @@ -4518,6 +4518,8 @@
  37.  bool SciTEBase::ProcessCommandLine(GUI::gui_string &args, int phase) {
  38.     bool performPrint = false;
  39.     bool evaluate = phase == 0;
  40. +   if (evaluate && props.GetInt("save.find") != 0)
  41. +       RestoreFindWhat();
  42.     std::vector<GUI::gui_string> wlArgs = ListFromString(args);
  43.     // Convert args to vector
  44.     for (size_t i = 0; i < wlArgs.size(); i++) {
  45. diff -r 4708e0216ca1 -r 60d66825e5f2 src/SciTEBase.h
  46. --- a/src/SciTEBase.h   dim. sept. 25 09:58:27 2011 +1000
  47. +++ b/src/SciTEBase.h   mar. sept. 27 14:46:01 2011 +0200
  48. @@ -518,6 +518,7 @@
  49.     void LoadSessionFile(const GUI::gui_char *sessionName);
  50.     void RestoreRecentMenu();
  51.     void RestoreSession();
  52. +   void RestoreFindWhat();
  53.     void SaveSessionFile(const GUI::gui_char *sessionName);
  54.     virtual void GetWindowPosition(int *left, int *top, int *width, int *height, int *maximize) = 0;
  55.     void SetIndentSettings();
  56. diff -r 4708e0216ca1 -r 60d66825e5f2 src/SciTEBuffers.cxx
  57. --- a/src/SciTEBuffers.cxx  dim. sept. 25 09:58:27 2011 +1000
  58. +++ b/src/SciTEBuffers.cxx  mar. sept. 27 14:46:01 2011 +0200
  59. @@ -463,6 +463,24 @@
  60.         SetDocumentAt(curr);
  61.  }
  62.  
  63. +void SciTEBase::RestoreFindWhat() {
  64. +   for (int i = 0; true; i++) {
  65. +       SString propKey = IndexPropKey("search", i, "findWhat");
  66. +       SString propStr = propsSession.Get(propKey.c_str());
  67. +       if (propStr == "")
  68. +           break;
  69. +       memFinds.AppendList(propStr.c_str());
  70. +   }
  71. +
  72. +   for (int i = 0; true; i++) {
  73. +       SString propKey = IndexPropKey("search", i, "replaceWith");
  74. +       SString propStr = propsSession.Get(propKey.c_str());
  75. +       if (propStr == "")
  76. +           break;
  77. +       memReplaces.AppendList(propStr.c_str());
  78. +   }
  79. +}
  80. +
  81.  void SciTEBase::SaveSessionFile(const GUI::gui_char *sessionName) {
  82.     bool defaultSession;
  83.     FilePath sessionPathName;
  84. @@ -506,6 +524,31 @@
  85.         }
  86.     }
  87.  
  88. +   if (defaultSession && props.GetInt("save.find")) {
  89. +       SString propKey;
  90. +       std::vector<std::string>::iterator it;
  91. +       std::vector<std::string> mem = memFinds.AsVector();
  92. +       if (!mem.empty()) {
  93. +           fprintf(sessionFile, "\n");
  94. +           it = mem.begin();
  95. +           for (int i = 0; it != mem.end(); i++, it++) {
  96. +               propKey = IndexPropKey("search", i, "findWhat");
  97. +               fprintf(sessionFile, "%s=%s\n", propKey.c_str(), (*it).c_str());
  98. +           }
  99. +       }
  100. +
  101. +       mem = memReplaces.AsVector();
  102. +       if (!mem.empty()) {
  103. +           fprintf(sessionFile, "\n");
  104. +           mem = memReplaces.AsVector();
  105. +           it = mem.begin();
  106. +           for (int i = 0; it != mem.end(); i++, it++) {
  107. +               propKey = IndexPropKey("search", i, "replaceWith");
  108. +               fprintf(sessionFile, "%s=%s\n", propKey.c_str(), (*it).c_str());
  109. +           }
  110. +       }
  111. +   }
  112. +
  113.     if (props.GetInt("buffers") && (!defaultSession || props.GetInt("save.session"))) {
  114.         int curr = buffers.Current();
  115.         for (int i = 0; i < buffers.length; i++) {
  116.  
  117.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement