summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewscript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpreviewscript.cpp')
-rwxr-xr-xindra/newview/llpreviewscript.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 9411b8265b..a41986373e 100755
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -663,12 +663,13 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate)
LLTextSegmentPtr segment = NULL;
std::vector<LLTextSegmentPtr> selected_segments;
mEditor->getSelectedSegments(selected_segments);
-
+ LLKeywordToken* token;
// try segments in selection range first
std::vector<LLTextSegmentPtr>::iterator segment_iter;
for (segment_iter = selected_segments.begin(); segment_iter != selected_segments.end(); ++segment_iter)
{
- if((*segment_iter)->getToken() && (*segment_iter)->getToken()->getType() == LLKeywordToken::TT_WORD)
+ token = (*segment_iter)->getToken();
+ if(token && isKeyword(token))
{
segment = *segment_iter;
break;
@@ -679,7 +680,8 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate)
if (!segment)
{
const LLTextSegmentPtr test_segment = mEditor->getPreviousSegment();
- if(test_segment->getToken() && test_segment->getToken()->getType() == LLKeywordToken::TT_WORD)
+ token = test_segment->getToken();
+ if(token && isKeyword(token))
{
segment = test_segment;
}
@@ -708,6 +710,24 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate)
}
}
+bool LLScriptEdCore::isKeyword(LLKeywordToken* token)
+{
+ switch(token->getType())
+ {
+ case LLKeywordToken::TT_CONSTANT:
+ case LLKeywordToken::TT_CONTROL:
+ case LLKeywordToken::TT_EVENT:
+ case LLKeywordToken::TT_FUNCTION:
+ case LLKeywordToken::TT_SECTION:
+ case LLKeywordToken::TT_TYPE:
+ case LLKeywordToken::TT_WORD:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
void LLScriptEdCore::setHelpPage(const std::string& help_string)
{
LLFloater* help_floater = mLiveHelpHandle.get();
@@ -1166,7 +1186,7 @@ void LLScriptEdCore::onBtnSaveToFile( void* userdata )
if( self->mSaveCallback )
{
LLFilePicker& file_picker = LLFilePicker::instance();
- if( file_picker.getSaveFile( LLFilePicker::FFSAVE_SCRIPT ) )
+ if( file_picker.getSaveFile( LLFilePicker::FFSAVE_SCRIPT, self->mScriptName ) )
{
std::string filename = file_picker.getFirstFile();
std::string scriptText=self->mEditor->getText();
@@ -1948,6 +1968,7 @@ void LLLiveLSLEditor::loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType
mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), TRUE);
mScriptEd->mEditor->makePristine();
+ mScriptEd->setScriptName(getItem()->getName());
}