FIRE-30892: Pressing the Home key in the script editor should go to the first non-whitespace character on a line; Contribution by Testicular Slingshot
parent
a072cd4db0
commit
6d26efe266
|
|
@ -2882,7 +2882,7 @@ void LLTextBase::updateCursorXPos()
|
|||
mDesiredXPixel = getLocalRectFromDocIndex(mCursorPos).mLeft;
|
||||
}
|
||||
|
||||
|
||||
//virtual
|
||||
void LLTextBase::startOfLine()
|
||||
{
|
||||
S32 offset = getLineOffsetFromDocIndex(mCursorPos);
|
||||
|
|
|
|||
|
|
@ -497,7 +497,7 @@ public:
|
|||
S32 getCursorPos() { return mCursorPos; }
|
||||
// [/SL:KB
|
||||
bool setCursorPos(S32 cursor_pos, bool keep_cursor_offset = false);
|
||||
void startOfLine();
|
||||
virtual void startOfLine(); // <FS> Added virtual modifier
|
||||
void endOfLine();
|
||||
void startOfDoc();
|
||||
void endOfDoc();
|
||||
|
|
|
|||
|
|
@ -322,3 +322,26 @@ void LLScriptEditor::drawSelectionBackground()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// <FS> Improved Home-key behavior
|
||||
//virtual
|
||||
void LLScriptEditor::startOfLine()
|
||||
{
|
||||
const LLWString text = getWText();
|
||||
const S32 line_start_pos = mCursorPos - getLineOffsetFromDocIndex(mCursorPos);
|
||||
S32 trimmed_line_start_pos = line_start_pos;
|
||||
while (trimmed_line_start_pos < mCursorPos && LLStringOps::isSpace(text[trimmed_line_start_pos]))
|
||||
{
|
||||
++trimmed_line_start_pos;
|
||||
}
|
||||
|
||||
if (mCursorPos != trimmed_line_start_pos)
|
||||
{
|
||||
setCursorPos(trimmed_line_start_pos);
|
||||
}
|
||||
else if (mCursorPos != line_start_pos)
|
||||
{
|
||||
setCursorPos(line_start_pos);
|
||||
}
|
||||
}
|
||||
// </FS>
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ public:
|
|||
|
||||
// LLView override
|
||||
virtual void draw();
|
||||
|
||||
// <FS> Improved Home-key behavior
|
||||
// LLTextBase override
|
||||
virtual void startOfLine();
|
||||
|
||||
void initKeywords();
|
||||
void loadKeywords();
|
||||
|
|
@ -67,8 +71,9 @@ private:
|
|||
void drawLineNumbers();
|
||||
/* virtual */ void updateSegments();
|
||||
/* virtual */ void drawSelectionBackground();
|
||||
void loadKeywords(const std::string& filename_keywords,
|
||||
const std::string& filename_colors);
|
||||
// <FS:Ansariel> Doesn't exist
|
||||
//void loadKeywords(const std::string& filename_keywords,
|
||||
// const std::string& filename_colors);
|
||||
|
||||
LLKeywords mKeywords;
|
||||
bool mShowLineNumbers;
|
||||
|
|
|
|||
Loading…
Reference in New Issue