Logo Search packages:      
Sourcecode: jedit version File versions  Download package

void org::gjt::sp::jedit::textarea::TextArea::goToEndOfWhiteSpace ( boolean  select  )  [inline]

Moves the caret to the last non-whitespace character of the current line.

Parameters:
select true if you want to extend selection
Since:
jEdit 2.7pre2

Definition at line 3137 of file TextArea.java.

References org::gjt::sp::jedit::textarea::Selection::end, org::gjt::sp::jedit::textarea::Selection::endLine, extendSelection(), getLineEndOffset(), getLineLength(), getLineStartOffset(), getLineText(), getSelectionAtOffset(), org::gjt::sp::jedit::textarea::ChunkCache::getSubregionEndOffset(), moveCaretPosition(), multi, and selectNone().

Referenced by end(), org::gjt::sp::jedit::textarea::JEditTextArea::end(), smartEnd(), and org::gjt::sp::jedit::textarea::JEditTextArea::smartEnd().

      {
            Selection s = getSelectionAtOffset(caret);
            int line, offset;
            if(select || s == null)
            {
                  line = caretLine;
                  offset = caret - getLineStartOffset(line);
            }
            else
            {
                  line = s.endLine;
                  offset = s.end - getLineStartOffset(line);
            }

            int lastIndent = chunkCache.getSubregionEndOffset(line,offset);

            if(lastIndent == getLineEndOffset(line))
            {
                  lastIndent = getLineLength(line) - StandardUtilities.getTrailingWhiteSpace(getLineText(line));
                  if(lastIndent == 0)
                        lastIndent = getLineLength(line);
                  lastIndent += getLineStartOffset(line);
            }
            else
            {
                  lastIndent--;
            }

            if(select)
                  extendSelection(caret,lastIndent);
            else if(!multi)
                  selectNone();
            moveCaretPosition(lastIndent);
      } //}}}


Generated by  Doxygen 1.6.0   Back to index