コード例 #1
0
void
JVIKeyHandler::YankToEndOfLine
	(
	const JBoolean del,
	const JBoolean ins
	)
{
	JTextEditor* te = GetTE();

	JIndexRange r;
	r.first           = te->GetInsertionIndex();
	const JIndex line = te->GetLineForChar(r.first) + GetOperationCount() - 1;
	r.last            = te->GetLineEnd(line);
	if (te->IndexValid(r.last) && te->GetText().GetCharacter(r.last) == '\n')
		{
		r.last--;
		}

	if (!r.IsEmpty())
		{
		CutBuffer* buf = GetCutBuffer(cutbufPattern);
		buf->Set(te->GetText().GetSubstring(r), kJFalse);

		if (del)
			{
			te->SetSelection(r);
			te->DeleteSelection();
			}

		if (ins)
			{
			SetMode(kTextEntryMode);
			}
		}
}
コード例 #2
0
void
JTEUndoDrop::Undo()
{
	JTextEditor* te = GetTE();
	te->SetSelection(itsNewSelStart, itsNewSelEnd);
	te->DropSelection(itsOrigCaretLoc, kJFalse);			// deletes us
}
コード例 #3
0
void
JVIKeyHandler::YankLines
	(
	const JArray<JIndexRange>&	matchList,
	const JBoolean				del
	)
{
	JTextEditor* te = GetTE();
	te->GoToBeginningOfLine();
	const JIndex start = te->GetInsertionIndex();

	MoveCaretVert(GetOperationCount());

	JIndexRange r(start, te->GetInsertionIndex()-1);
	if (!r.IsEmpty())
		{
		CutBuffer* buf = GetCutBuffer(yankDeletePattern, matchList);
		buf->Set((te->GetText()).GetSubstring(r), kJTrue);

		if (del)
			{
			te->SetSelection(r);
			te->DeleteSelection();
			}
		}
}
コード例 #4
0
void
JTEUndoStyle::Undo()
{
	JTextEditor* te = GetTE();
	te->SetSelection(itsStartIndex, itsStartIndex + itsOrigStyles->GetElementCount() - 1);

	JTEUndoStyle* newUndo = new JTEUndoStyle(te);
	assert( newUndo != NULL );

	te->SetFont(itsStartIndex, *itsOrigStyles, kJFalse);

	te->ReplaceUndo(this, newUndo);		// deletes us
}