Advertisement
Guest User

scite_rev3908.patch

a guest
Aug 19th, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.60 KB | None | 0 0
  1. # HG changeset patch
  2. # User Jerome LAFORGE <jerome.laforge@gmail.com>
  3. # Date 1345405729 -7200
  4. # Node ID 3d408a345def9f9b476a5cff23960e085647e58c
  5. # Parent  c0540f310854a758c3fb57e8aa4a76c586e00f15
  6. Override global strip.trailing.spaces with strip.trailing.spaces by extension.
  7. Feature #3556320.
  8.  
  9. diff -r c0540f310854 -r 3d408a345def src/SciTEBase.h
  10. --- a/src/SciTEBase.h   mer. août 08 23:38:24 2012 +1000
  11. +++ b/src/SciTEBase.h   dim. août 19 21:48:49 2012 +0200
  12. @@ -516,6 +516,8 @@
  13.     SString currentMacro;
  14.     bool recording;
  15.  
  16. +   std::map<std::string, int>stripTrailingSpacesByExtension;
  17. +
  18.     PropSetFile propsEmbed;
  19.     PropSetFile propsBase;
  20.     PropSetFile propsUser;
  21. diff -r c0540f310854 -r 3d408a345def src/SciTEIO.cxx
  22. --- a/src/SciTEIO.cxx   mer. août 08 23:38:24 2012 +1000
  23. +++ b/src/SciTEIO.cxx   dim. août 19 21:48:49 2012 +0200
  24. @@ -921,7 +921,11 @@
  25.     bool retVal = false;
  26.     // Perform clean ups on text before saving
  27.     wEditor.Call(SCI_BEGINUNDOACTION);
  28. -   if (props.GetInt("strip.trailing.spaces"))
  29. +   std::map<std::string, int>::iterator it = stripTrailingSpacesByExtension.find(saveName.Extension().AsUTF8().c_str());
  30. +   if (it != stripTrailingSpacesByExtension.end()) {
  31. +       if (it->second)
  32. +           StripTrailingSpaces();
  33. +   } else if (props.GetInt("strip.trailing.spaces"))
  34.         StripTrailingSpaces();
  35.     if (props.GetInt("ensure.final.line.end"))
  36.         EnsureFinalNewLine();
  37. diff -r c0540f310854 -r 3d408a345def src/SciTEProps.cxx
  38. --- a/src/SciTEProps.cxx    mer. août 08 23:38:24 2012 +1000
  39. +++ b/src/SciTEProps.cxx    dim. août 19 21:48:49 2012 +0200
  40. @@ -1348,6 +1348,30 @@
  41.         HighlightCurrentWord(true);
  42.     }
  43.  
  44. +   SString stringTrailingSpacePrefix = "strip.trailing.spaces.";
  45. +   const char *currentKey;
  46. +   const char *currentValue;
  47. +   PropSetFile *currentProp = &props;
  48. +   do {
  49. +       bool b = currentProp->GetFirst(currentKey, currentValue);
  50. +       while (b) {
  51. +           if (0 == strncmp(stringTrailingSpacePrefix.c_str(), currentKey, stringTrailingSpacePrefix.length())) {
  52. +               SString tmp(currentProp->Expand(currentKey).substr(stringTrailingSpacePrefix.length()));
  53. +               tmp.remove("*.");
  54. +               tmp.substitute(';', '\0');
  55. +               int length = tmp.length();
  56. +               const char *extension = tmp.c_str();
  57. +               while (length > 0) {
  58. +                   stripTrailingSpacesByExtension[std::string(extension)] = atoi(currentValue);
  59. +                   length -= strlen(extension) + 1;
  60. +                   extension += strlen(extension) + 1;
  61. +               }
  62. +           }
  63. +           b = currentProp->GetNext(currentKey, currentValue);
  64. +       }
  65. +       currentProp = currentProp->superPS;
  66. +   } while (currentProp != NULL);
  67. +
  68.     if (extender) {
  69.         FilePath defaultDir = GetDefaultDirectory();
  70.         FilePath scriptPath;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement