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 1345405729 -7200
- # Node ID 3d408a345def9f9b476a5cff23960e085647e58c
- # Parent c0540f310854a758c3fb57e8aa4a76c586e00f15
- Override global strip.trailing.spaces with strip.trailing.spaces by extension.
- Feature #3556320.
- diff -r c0540f310854 -r 3d408a345def src/SciTEBase.h
- --- a/src/SciTEBase.h mer. août 08 23:38:24 2012 +1000
- +++ b/src/SciTEBase.h dim. août 19 21:48:49 2012 +0200
- @@ -516,6 +516,8 @@
- SString currentMacro;
- bool recording;
- + std::map<std::string, int>stripTrailingSpacesByExtension;
- +
- PropSetFile propsEmbed;
- PropSetFile propsBase;
- PropSetFile propsUser;
- diff -r c0540f310854 -r 3d408a345def src/SciTEIO.cxx
- --- a/src/SciTEIO.cxx mer. août 08 23:38:24 2012 +1000
- +++ b/src/SciTEIO.cxx dim. août 19 21:48:49 2012 +0200
- @@ -921,7 +921,11 @@
- bool retVal = false;
- // Perform clean ups on text before saving
- wEditor.Call(SCI_BEGINUNDOACTION);
- - if (props.GetInt("strip.trailing.spaces"))
- + std::map<std::string, int>::iterator it = stripTrailingSpacesByExtension.find(saveName.Extension().AsUTF8().c_str());
- + if (it != stripTrailingSpacesByExtension.end()) {
- + if (it->second)
- + StripTrailingSpaces();
- + } else if (props.GetInt("strip.trailing.spaces"))
- StripTrailingSpaces();
- if (props.GetInt("ensure.final.line.end"))
- EnsureFinalNewLine();
- diff -r c0540f310854 -r 3d408a345def src/SciTEProps.cxx
- --- a/src/SciTEProps.cxx mer. août 08 23:38:24 2012 +1000
- +++ b/src/SciTEProps.cxx dim. août 19 21:48:49 2012 +0200
- @@ -1348,6 +1348,30 @@
- HighlightCurrentWord(true);
- }
- + SString stringTrailingSpacePrefix = "strip.trailing.spaces.";
- + const char *currentKey;
- + const char *currentValue;
- + PropSetFile *currentProp = &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.remove("*.");
- + tmp.substitute(';', '\0');
- + int length = tmp.length();
- + const char *extension = tmp.c_str();
- + while (length > 0) {
- + stripTrailingSpacesByExtension[std::string(extension)] = atoi(currentValue);
- + length -= strlen(extension) + 1;
- + extension += strlen(extension) + 1;
- + }
- + }
- + b = currentProp->GetNext(currentKey, currentValue);
- + }
- + currentProp = currentProp->superPS;
- + } while (currentProp != NULL);
- +
- if (extender) {
- FilePath defaultDir = GetDefaultDirectory();
- FilePath scriptPath;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement