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 1345410282 -7200
- # Node ID 8a98250736513f3dbf5e16713bf4e3e58cc178d4
- # Parent c0540f310854a758c3fb57e8aa4a76c586e00f15
- Override global strip.trailing.spaces with strip.trailing.spaces by extension.
- Feature #3556320.
- diff -r c0540f310854 -r 8a9825073651 src/SciTEBase.h
- --- a/src/SciTEBase.h mer. août 08 23:38:24 2012 +1000
- +++ b/src/SciTEBase.h dim. août 19 23:04:42 2012 +0200
- @@ -106,6 +106,7 @@
- std::vector<int> bookmarks;
- FileWorker *pFileWorker;
- PropSetFile props;
- + std::map<std::string, int>stripTrailingSpacesByExtension;
- enum FutureDo { fdNone=0, fdFinishSave=1 } futureDo;
- Buffer() :
- RecentFile(), doc(0), isDirty(false), isReadOnly(false), useMonoFont(false), lifeState(empty),
- diff -r c0540f310854 -r 8a9825073651 src/SciTEIO.cxx
- --- a/src/SciTEIO.cxx mer. août 08 23:38:24 2012 +1000
- +++ b/src/SciTEIO.cxx dim. août 19 23:04:42 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 = CurrentBuffer()->stripTrailingSpacesByExtension.find(saveName.Extension().AsUTF8().c_str());
- + if (it != CurrentBuffer()->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 8a9825073651 src/SciTEProps.cxx
- --- a/src/SciTEProps.cxx mer. août 08 23:38:24 2012 +1000
- +++ b/src/SciTEProps.cxx dim. août 19 23:04:42 2012 +0200
- @@ -1348,6 +1348,32 @@
- HighlightCurrentWord(true);
- }
- + SString stringTrailingSpacePrefix = "strip.trailing.spaces.";
- + CurrentBuffer()->stripTrailingSpacesByExtension.clear();
- + const char *currentKey;
- + const char *currentValue;
- + 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.remove("*.");
- + tmp.substitute(';', '\0');
- + int length = tmp.length();
- + const char *extension = tmp.c_str();
- + while (length > 0) {
- + if (CurrentBuffer()->stripTrailingSpacesByExtension.find(extension) == CurrentBuffer()->stripTrailingSpacesByExtension.end())
- + CurrentBuffer()->stripTrailingSpacesByExtension[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