Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # HG changeset patch
- # User Jerome LAFORGE <jerome.laforge@gmail.com>
- # Date 1345558732 -7200
- # Node ID 8a30a2f803ce686a1eb6d8dc2f4be99ca3fbf476
- # Parent c0540f310854a758c3fb57e8aa4a76c586e00f15
- Override global strip.trailing.spaces with strip.trailing.spaces by pattern files.
- Feature #3556320.
- diff -r c0540f310854 -r 8a30a2f803ce src/PropSetFile.cxx
- --- a/src/PropSetFile.cxx mer. août 08 23:38:24 2012 +1000
- +++ b/src/PropSetFile.cxx mar. août 21 16:18:52 2012 +0200
- @@ -507,7 +507,7 @@
- }
- // Match file names to patterns allowing for a '*' suffix or prefix.
- -static bool MatchWild(const char *pattern, size_t lenPattern, const char *fileName, bool caseSensitive) {
- +bool PropSetFile::MatchWild(const char *pattern, size_t lenPattern, const char *fileName, bool caseSensitive) {
- size_t lenFileName = strlen(fileName);
- if (lenFileName == lenPattern) {
- if (StringEqual(pattern, fileName, lenFileName, caseSensitive)) {
- diff -r c0540f310854 -r 8a30a2f803ce src/PropSetFile.h
- --- a/src/PropSetFile.h mer. août 08 23:38:24 2012 +1000
- +++ b/src/PropSetFile.h mar. août 21 16:18:52 2012 +0200
- @@ -34,6 +34,7 @@
- void Unset(const char *key, int lenKey=-1);
- void SetMultiple(const char *s);
- bool Exists(const char *key) const;
- + bool MatchWild(const char *pattern, size_t lenPattern, const char *fileName, bool caseSensitive);
- SString Get(const char *key) const;
- SString Evaluate(const char *key) const;
- SString GetExpanded(const char *key) const;
- diff -r c0540f310854 -r 8a30a2f803ce src/SciTEIO.cxx
- --- a/src/SciTEIO.cxx mer. août 08 23:38:24 2012 +1000
- +++ b/src/SciTEIO.cxx mar. août 21 16:18:52 2012 +0200
- @@ -921,7 +921,34 @@
- bool retVal = false;
- // Perform clean ups on text before saving
- wEditor.Call(SCI_BEGINUNDOACTION);
- - if (props.GetInt("strip.trailing.spaces"))
- + SString stringTrailingSpacePrefix = "strip.trailing.spaces.";
- + const char *currentKey;
- + const char *currentValue;
- + bool isFound = false;
- + PropSetFile *currentProp = &CurrentBuffer()->props;
- + do {
- + bool b = currentProp->GetFirst(currentKey, currentValue);
- + while (b) {
- + if (0 == strncmp(stringTrailingSpacePrefix.c_str(), currentKey, stringTrailingSpacePrefix.length())) {
- + SString tmp(currentProp->Expand(currentKey).substr(stringTrailingSpacePrefix.length()));
- + tmp.substitute(';', '\0');
- + int length = tmp.length();
- + const char *pattern = tmp.c_str();
- + while (length > 0) {
- + if (isFound = currentProp->MatchWild(pattern, strlen(pattern), saveName.Name().AsUTF8().c_str(), true))
- + break;
- + length -= strlen(pattern) + 1;
- + pattern += strlen(pattern) + 1;
- + }
- + }
- + b = !isFound && currentProp->GetNext(currentKey, currentValue);
- + }
- + currentProp = currentProp->superPS;
- + } while (!isFound && currentProp != NULL);
- + if (isFound) {
- + if (atoi(currentValue))
- + StripTrailingSpaces();
- + } else if (props.GetInt("strip.trailing.spaces"))
- StripTrailingSpaces();
- if (props.GetInt("ensure.final.line.end"))
- EnsureFinalNewLine();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement