diff options
author | nyamatongwe <devnull@localhost> | 2009-07-13 02:58:00 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2009-07-13 02:58:00 +0000 |
commit | cd7976141577d678924b3384a90cd0eb50be6697 (patch) | |
tree | 710b9c1dd0e934ba7013aad7b14eb93d368d8494 /src | |
parent | 1b7996eb3920d707e0e93eb0e611356335dec4de (diff) | |
download | scintilla-mirror-cd7976141577d678924b3384a90cd0eb50be6697.tar.gz |
Using std::string for space buffer to ensure deletion.
Fixed name clash with Borland C++ 5.5 including Windows.h when string
included.
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 6c6922648..9bd18d570 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -10,6 +10,16 @@ #include <stdio.h> #include <ctype.h> +#include <string> + +// With Borland C++ 5.5, including <string> includes Windows.h leading to defining +// FindText to FindTextA which makes calls here to Document::FindText fail. +#ifdef __BORLANDC__ +#ifdef FindText +#undef FindText +#endif +#endif + #include "Platform.h" #include "Scintilla.h" @@ -3628,14 +3638,12 @@ void Editor::ChangeSize() { } int Editor::InsertSpace(int position, unsigned int spaces) { - if (spaces > 0) { - char *spaceText = new char[spaces]; - memset(spaceText, ' ', spaces); - pdoc->InsertString(position, spaceText, spaces); - position += spaces; - delete []spaceText; - } - return position; + if (spaces > 0) { + std::string spaceText(spaces, ' '); + pdoc->InsertString(position, spaceText.c_str(), spaces); + position += spaces; + } + return position; } void Editor::AddChar(char ch) { |