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); } } }
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(); } } }