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

void org::gjt::sp::jedit::textarea::TextArea::extendSelection ( int  offset,
int  end,
int  extraStartVirt,
int  extraEndVirt 
) [inline]

Extends the selection at the specified offset, or creates a new one if there is no selection at the specified offset. This is different from resizing in that the new chunk is added to the selection in question, instead of replacing it.

Parameters:
offset The offset
end The new selection end
extraStartVirt Extra virtual space at the start
extraEndVirt Extra virtual space at the end
Since:
jEdit 4.2pre1

Definition at line 1857 of file TextArea.java.

References org::gjt::sp::jedit::textarea::Selection::end, org::gjt::sp::jedit::textarea::Selection::endLine, getLineLength(), getLineOfOffset(), getSelectionAtOffset(), invalidateLineRange(), scrollTo(), org::gjt::sp::jedit::textarea::Selection::start, and org::gjt::sp::jedit::textarea::Selection::startLine.

      {
            Selection s = getSelectionAtOffset(offset);
            if(s != null)
            {
                  invalidateLineRange(s.startLine,s.endLine);
                  selectionManager.removeFromSelection(s);

                  if(offset == s.start)
                  {
                        offset = end;
                        end = s.end;
                  }
                  else if(offset == s.end)
                  {
                        offset = s.start;
                  }
            }

            if(end < offset)
            {
                  int tmp = end;
                  end = offset;
                  offset = tmp;
            }

            if(rectangularSelectionMode)
            {
                  s = new Selection.Rect(offset,end);
                  ((Selection.Rect)s).extraStartVirt = extraStartVirt;
                  ((Selection.Rect)s).extraEndVirt = extraEndVirt;
            }
            else
                  s = new Selection.Range(offset,end);

            selectionManager.addToSelection(s);
            fireCaretEvent();

            if(rectangularSelectionMode && extraEndVirt != 0)
            {
                  int line = getLineOfOffset(end);
                  scrollTo(line,getLineLength(line) + extraEndVirt,false);
            }
      } //}}}


Generated by  Doxygen 1.6.0   Back to index