aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui
diff options
context:
space:
mode:
authorelektrahesse2010-09-07 18:39:40 +0200
committerelektrahesse2010-09-07 18:39:40 +0200
commit22383f92482798cf5b5439396bdcdf1c8f9aa073 (patch)
tree538bc3c53d1d1f4245cf738d6ac045fa57dbe8d4 /linden/indra/llui
parentMerge branch 'weekly' of git://github.com/mccabe/imprudence into weekly (diff)
parentUse solid circles instead of asterisks for password fields. (diff)
downloadmeta-impy-22383f92482798cf5b5439396bdcdf1c8f9aa073.zip
meta-impy-22383f92482798cf5b5439396bdcdf1c8f9aa073.tar.gz
meta-impy-22383f92482798cf5b5439396bdcdf1c8f9aa073.tar.bz2
meta-impy-22383f92482798cf5b5439396bdcdf1c8f9aa073.tar.xz
Merge branch 'weekly' of git://github.com/mccabe/imprudence into weekly
Diffstat (limited to 'linden/indra/llui')
-rw-r--r--linden/indra/llui/lllineeditor.cpp41
-rw-r--r--linden/indra/llui/lltexteditor.cpp14
2 files changed, 38 insertions, 17 deletions
diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp
index 5441d0a..c1d8efa 100644
--- a/linden/indra/llui/lllineeditor.cpp
+++ b/linden/indra/llui/lllineeditor.cpp
@@ -439,7 +439,7 @@ S32 LLLineEditor::calculateCursorFromMouse( S32 local_mouse_x )
439 { 439 {
440 for (S32 i = 0; i < mText.length(); i++) 440 for (S32 i = 0; i < mText.length(); i++)
441 { 441 {
442 asterix_text += '*'; 442 asterix_text += (llwchar) 0x2022L;
443 } 443 }
444 wtext = asterix_text.c_str(); 444 wtext = asterix_text.c_str();
445 } 445 }
@@ -1938,7 +1938,7 @@ void LLLineEditor::draw()
1938 std::string text; 1938 std::string text;
1939 for (S32 i = 0; i < mText.length(); i++) 1939 for (S32 i = 0; i < mText.length(); i++)
1940 { 1940 {
1941 text += '*'; 1941 text += "\xe2\x80\xa2";
1942 } 1942 }
1943 mText = text; 1943 mText = text;
1944 } 1944 }
@@ -2621,28 +2621,37 @@ BOOL LLLineEditor::prevalidateASCII(const LLWString &str)
2621 2621
2622BOOL LLLineEditor::evaluateFloat() 2622BOOL LLLineEditor::evaluateFloat()
2623{ 2623{
2624 bool success; 2624 bool success = false;
2625 F32 result = 0.f;
2626 std::string expr = getText(); 2625 std::string expr = getText();
2627 LLStringUtil::toUpper(expr); 2626 LLStringUtil::toUpper(expr);
2628 2627
2629 success = LLCalc::getInstance()->evalString(expr, result); 2628 // user deleted the contents, nothing to evaluate -- MC
2630 2629 if (expr.empty())
2631 if (!success)
2632 { 2630 {
2633 // Move the cursor to near the error on failure 2631 return success;
2634 setCursor(LLCalc::getInstance()->getLastErrorPos());
2635 // *TODO: Translated error message indicating the type of error? Select error text?
2636 } 2632 }
2637 else 2633 else
2638 { 2634 {
2639 // Replace the expression with the result 2635 F32 result = 0.f;
2640 std::string result_str = llformat("%f",result); 2636 success = LLCalc::getInstance()->evalString(expr, result);
2641 setText(result_str);
2642 selectAll();
2643 }
2644 2637
2645 return success; 2638 if (!success)
2639 {
2640 // Move the cursor to near the error on failure
2641 setCursor(LLCalc::getInstance()->getLastErrorPos());
2642 // *TODO: Translated error message indicating the type of error? Select error text?
2643 }
2644 else
2645 {
2646 // Replace the expression with the result
2647 std::ostringstream result_str;
2648 result_str << result;
2649 setText(result_str.str());
2650 selectAll();
2651 }
2652
2653 return success;
2654 }
2646} 2655}
2647 2656
2648void LLLineEditor::onMouseCaptureLost() 2657void LLLineEditor::onMouseCaptureLost()
diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp
index 51f7ad6..6e5cdc4 100644
--- a/linden/indra/llui/lltexteditor.cpp
+++ b/linden/indra/llui/lltexteditor.cpp
@@ -951,7 +951,14 @@ S32 LLTextEditor::getLineStart( S32 line ) const
951 S32 segoffset = mLineStartList[line].mOffset; 951 S32 segoffset = mLineStartList[line].mOffset;
952 LLTextSegment* seg = mSegments[segidx]; 952 LLTextSegment* seg = mSegments[segidx];
953 S32 res = seg->getStart() + segoffset; 953 S32 res = seg->getStart() + segoffset;
954 if (res > seg->getEnd()) llerrs << "wtf" << llendl; 954 if (res > seg->getEnd())
955 {
956 //llerrs << "wtf" << llendl;
957 // This happens when creating a new notecard using the AO on certain opensims.
958 // Play it safe instead of bringing down the viewer - MC
959 llwarns << "BAD JOOJOO! Text length (" << res << ") greater than text end (" << seg->getEnd() << "). Setting line start to " << seg->getEnd() << llendl;
960 res = seg->getEnd();
961 }
955 return res; 962 return res;
956} 963}
957 964
@@ -1079,6 +1086,11 @@ S32 LLTextEditor::getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL rou
1079 1086
1080void LLTextEditor::setCursor(S32 row, S32 column) 1087void LLTextEditor::setCursor(S32 row, S32 column)
1081{ 1088{
1089 // Make sure we're not trying to set the cursor anywhere
1090 // it can't go by always setting the min to 0 -- MC
1091 row = (row < 0) ? 0 : row;
1092 column = (column < 0) ? 0 : column;
1093
1082 const llwchar* doc = mWText.c_str(); 1094 const llwchar* doc = mWText.c_str();
1083 const char CR = 10; 1095 const char CR = 10;
1084 while(row--) 1096 while(row--)