SHOW:
|
|
- or go back to the newest paste.
1 | # HG changeset patch | |
2 | # User Jerome LAFORGE <jerome.laforge@gmail.com> | |
3 | - | # Date 1345405729 -7200 |
3 | + | # Date 1345410282 -7200 |
4 | - | # Node ID 3d408a345def9f9b476a5cff23960e085647e58c |
4 | + | # Node ID 8a98250736513f3dbf5e16713bf4e3e58cc178d4 |
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 |
9 | + | diff -r c0540f310854 -r 8a9825073651 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 |
11 | + | +++ b/src/SciTEBase.h dim. août 19 23:04:42 2012 +0200 |
12 | - | @@ -516,6 +516,8 @@ |
12 | + | @@ -106,6 +106,7 @@ |
13 | - | SString currentMacro; |
13 | + | std::vector<int> bookmarks; |
14 | - | bool recording; |
14 | + | FileWorker *pFileWorker; |
15 | PropSetFile props; | |
16 | + std::map<std::string, int>stripTrailingSpacesByExtension; | |
17 | enum FutureDo { fdNone=0, fdFinishSave=1 } futureDo; | |
18 | - | PropSetFile propsEmbed; |
18 | + | Buffer() : |
19 | - | PropSetFile propsBase; |
19 | + | RecentFile(), doc(0), isDirty(false), isReadOnly(false), useMonoFont(false), lifeState(empty), |
20 | - | PropSetFile propsUser; |
20 | + | diff -r c0540f310854 -r 8a9825073651 src/SciTEIO.cxx |
21 | - | diff -r c0540f310854 -r 3d408a345def src/SciTEIO.cxx |
21 | + | |
22 | +++ b/src/SciTEIO.cxx dim. août 19 23:04:42 2012 +0200 | |
23 | - | +++ b/src/SciTEIO.cxx dim. août 19 21:48:49 2012 +0200 |
23 | + | |
24 | bool retVal = false; | |
25 | // Perform clean ups on text before saving | |
26 | wEditor.Call(SCI_BEGINUNDOACTION); | |
27 | - if (props.GetInt("strip.trailing.spaces")) | |
28 | + std::map<std::string, int>::iterator it = CurrentBuffer()->stripTrailingSpacesByExtension.find(saveName.Extension().AsUTF8().c_str()); | |
29 | - | + std::map<std::string, int>::iterator it = stripTrailingSpacesByExtension.find(saveName.Extension().AsUTF8().c_str()); |
29 | + | + if (it != CurrentBuffer()->stripTrailingSpacesByExtension.end()) { |
30 | - | + if (it != stripTrailingSpacesByExtension.end()) { |
30 | + | |
31 | + StripTrailingSpaces(); | |
32 | + } else if (props.GetInt("strip.trailing.spaces")) | |
33 | StripTrailingSpaces(); | |
34 | if (props.GetInt("ensure.final.line.end")) | |
35 | EnsureFinalNewLine(); | |
36 | diff -r c0540f310854 -r 8a9825073651 src/SciTEProps.cxx | |
37 | - | diff -r c0540f310854 -r 3d408a345def src/SciTEProps.cxx |
37 | + | |
38 | +++ b/src/SciTEProps.cxx dim. août 19 23:04:42 2012 +0200 | |
39 | - | +++ b/src/SciTEProps.cxx dim. août 19 21:48:49 2012 +0200 |
39 | + | @@ -1348,6 +1348,32 @@ |
40 | - | @@ -1348,6 +1348,30 @@ |
40 | + | |
41 | } | |
42 | ||
43 | + SString stringTrailingSpacePrefix = "strip.trailing.spaces."; | |
44 | + CurrentBuffer()->stripTrailingSpacesByExtension.clear(); | |
45 | + const char *currentKey; | |
46 | + const char *currentValue; | |
47 | - | + PropSetFile *currentProp = &props; |
47 | + | + PropSetFile *currentProp = &CurrentBuffer()->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); |
58 | + | + if (CurrentBuffer()->stripTrailingSpacesByExtension.find(extension) == CurrentBuffer()->stripTrailingSpacesByExtension.end()) |
59 | + CurrentBuffer()->stripTrailingSpacesByExtension[extension] = atoi(currentValue); | |
60 | + length -= strlen(extension) + 1; | |
61 | + extension += strlen(extension) + 1; | |
62 | + } | |
63 | + } | |
64 | + b = currentProp->GetNext(currentKey, currentValue); | |
65 | + } | |
66 | + currentProp = currentProp->superPS; | |
67 | + } while (currentProp != NULL); | |
68 | + | |
69 | if (extender) { | |
70 | FilePath defaultDir = GetDefaultDirectory(); | |
71 | FilePath scriptPath; |