summaryrefslogtreecommitdiff
path: root/src/interface/Textbox.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-09-14 21:03:14 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-09-14 21:03:14 (GMT)
commit486b34ebe581cf41b67145911a64ce2ea7b8932a (patch)
tree6752bc0bb7245bbd5009061b504f03b02790b58b /src/interface/Textbox.cpp
parent685be24ffa1eba28aa378b8a9b4fd52dbe238756 (diff)
downloadpowder-486b34ebe581cf41b67145911a64ce2ea7b8932a.zip
powder-486b34ebe581cf41b67145911a64ce2ea7b8932a.tar.gz
Fixes invalid text pasting, Adds API to VM, allow program loading in Lua and assigning to update function
Diffstat (limited to 'src/interface/Textbox.cpp')
-rw-r--r--src/interface/Textbox.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/interface/Textbox.cpp b/src/interface/Textbox.cpp
index 603fa23..ab4d907 100644
--- a/src/interface/Textbox.cpp
+++ b/src/interface/Textbox.cpp
@@ -191,6 +191,21 @@ void Textbox::pasteIntoSelection()
backingText.erase(backingText.begin()+getLowerSelectionBound(), backingText.begin()+getHigherSelectionBound());
cursor = getLowerSelectionBound();
}
+ for(std::string::iterator iter = newText.begin(), end = newText.end(); iter != end; ++iter)
+ {
+ if(!CharacterValid(*iter))
+ {
+ if(inputType == All)
+ {
+ if(*iter == '\n' || *iter == '\r')
+ *iter = ' ';
+ else
+ *iter = '?';
+ }
+ else
+ *iter = '0';
+ }
+ }
backingText.insert(cursor, newText);
cursor = cursor+newText.length();
ClearSelection();