Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

scite_rev3908.patch

By: a guest on Aug 21st, 2012  |  syntax: Diff  |  size: 3.00 KB  |  hits: 32  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # HG changeset patch
  2. # User Jerome LAFORGE <jerome.laforge@gmail.com>
  3. # Date 1345558732 -7200
  4. # Node ID 8a30a2f803ce686a1eb6d8dc2f4be99ca3fbf476
  5. # Parent  c0540f310854a758c3fb57e8aa4a76c586e00f15
  6. Override global strip.trailing.spaces with strip.trailing.spaces by pattern files.
  7. Feature #3556320.
  8.  
  9. diff -r c0540f310854 -r 8a30a2f803ce src/PropSetFile.cxx
  10. --- a/src/PropSetFile.cxx       mer. août 08 23:38:24 2012 +1000
  11. +++ b/src/PropSetFile.cxx       mar. août 21 16:18:52 2012 +0200
  12. @@ -507,7 +507,7 @@
  13.  }
  14.  
  15.  // Match file names to patterns allowing for a '*' suffix or prefix.
  16. -static bool MatchWild(const char *pattern, size_t lenPattern, const char *fileName, bool caseSensitive) {
  17. +bool PropSetFile::MatchWild(const char *pattern, size_t lenPattern, const char *fileName, bool caseSensitive) {
  18.         size_t lenFileName = strlen(fileName);
  19.         if (lenFileName == lenPattern) {
  20.                 if (StringEqual(pattern, fileName, lenFileName, caseSensitive)) {
  21. diff -r c0540f310854 -r 8a30a2f803ce src/PropSetFile.h
  22. --- a/src/PropSetFile.h mer. août 08 23:38:24 2012 +1000
  23. +++ b/src/PropSetFile.h mar. août 21 16:18:52 2012 +0200
  24. @@ -34,6 +34,7 @@
  25.         void Unset(const char *key, int lenKey=-1);
  26.         void SetMultiple(const char *s);
  27.         bool Exists(const char *key) const;
  28. +       bool MatchWild(const char *pattern, size_t lenPattern, const char *fileName, bool caseSensitive);
  29.         SString Get(const char *key) const;
  30.         SString Evaluate(const char *key) const;
  31.         SString GetExpanded(const char *key) const;
  32. diff -r c0540f310854 -r 8a30a2f803ce src/SciTEIO.cxx
  33. --- a/src/SciTEIO.cxx   mer. août 08 23:38:24 2012 +1000
  34. +++ b/src/SciTEIO.cxx   mar. août 21 16:18:52 2012 +0200
  35. @@ -921,7 +921,34 @@
  36.         bool retVal = false;
  37.         // Perform clean ups on text before saving
  38.         wEditor.Call(SCI_BEGINUNDOACTION);
  39. -       if (props.GetInt("strip.trailing.spaces"))
  40. +       SString stringTrailingSpacePrefix = "strip.trailing.spaces.";
  41. +       const char *currentKey;
  42. +       const char *currentValue;
  43. +       bool isFound = false;
  44. +       PropSetFile *currentProp = &CurrentBuffer()->props;
  45. +       do {
  46. +               bool b = currentProp->GetFirst(currentKey, currentValue);
  47. +               while (b) {
  48. +                       if (0 == strncmp(stringTrailingSpacePrefix.c_str(), currentKey, stringTrailingSpacePrefix.length())) {
  49. +                               SString tmp(currentProp->Expand(currentKey).substr(stringTrailingSpacePrefix.length()));
  50. +                               tmp.substitute(';', '\0');
  51. +                               int length = tmp.length();
  52. +                               const char *pattern = tmp.c_str();
  53. +                               while (length > 0) {
  54. +                                       if (isFound = currentProp->MatchWild(pattern, strlen(pattern), saveName.Name().AsUTF8().c_str(), true))
  55. +                                               break;
  56. +                                       length -= strlen(pattern) + 1;
  57. +                                       pattern += strlen(pattern) + 1;
  58. +                               }
  59. +                       }
  60. +                       b = !isFound && currentProp->GetNext(currentKey, currentValue);
  61. +               }
  62. +               currentProp = currentProp->superPS;
  63. +       } while (!isFound && currentProp != NULL);
  64. +       if (isFound) {
  65. +               if (atoi(currentValue))
  66. +                       StripTrailingSpaces();
  67. +       } else if (props.GetInt("strip.trailing.spaces"))
  68.                 StripTrailingSpaces();
  69.         if (props.GetInt("ensure.final.line.end"))
  70.                 EnsureFinalNewLine();