<commit_before>package com.maddyhome.idea.vim.group;

/*
 * IdeaVim - A Vim emulator plugin for IntelliJ Idea
 * Copyright (C) 2003 <NAME>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.LogicalPosition;
import com.intellij.openapi.util.TextRange;
import com.maddyhome.idea.vim.KeyHandler;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.common.Register;
import com.maddyhome.idea.vim.helper.EditorHelper;

/**
 * This group works with command associated with copying and pasting text
 */
public class CopyGroup extends AbstractActionGroup
{
    /**
     * Creates the group
     */
    public CopyGroup()
    {
    }

    /**
     * This yanks the text moved over by the motion command argument.
     * @param editor The editor to yank from
     * @param context The data context
     * @param count The number of times to yank
     * @param rawCount The actual count entered by the user
     * @param argument The motion command argument
     * @return true if able to yank the text, false if not
     */
    public boolean yankMotion(Editor editor, DataContext context, int count, int rawCount, Argument argument)
    {
        TextRange range = MotionGroup.getMotionRange(editor, context, count, rawCount, argument, true);

        return yankRange(editor, context, range, argument.getMotion().getFlags());
    }

    /**
     * This yanks count lines of text
     * @param editor The editor to yank from
     * @param context The data context
     * @param count The number of lines to yank
     * @return true if able to yank the lines, false if not
     */
    public boolean yankLine(Editor editor, DataContext context, int count)
    {
        int start = CommandGroups.getInstance().getMotion().moveCaretToLineStart(editor);
        int offset = Math.min(CommandGroups.getInstance().getMotion().moveCaretToLineEndOffset(
            editor, count - 1, true) + 1, EditorHelper.getFileSize(editor));
        if (offset != -1)
        {
            return yankRange(editor, context, new TextRange(start, offset), Command.FLAG_MOT_LINEWISE);<commit_msg>*** empty log message ***<commit_after>package com.maddyhome.idea.vim.group;

/*
 * IdeaVim - A Vim emulator plugin for IntelliJ Idea
 * Copyright (C) 2003 <NAME>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.LogicalPosition;
import com.intellij.openapi.util.TextRange;
import com.maddyhome.idea.vim.KeyHandler;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.common.Register;
import com.maddyhome.idea.vim.helper.EditorHelper;

/**
 * This group works with command associated with copying and pasting text
 */
public class CopyGroup extends AbstractActionGroup
{
    /**
     * Creates the group
     */
    public CopyGroup()
    {
    }

    /**
     * This yanks the text moved over by the motion command argument.
     * @param editor The editor to yank from
     * @param context The data context
     * @param count The number of times to yank
     * @param rawCount The actual count entered by the user
     * @param argument The motion command argument
     * @return true if able to yank the text, false if not
     */
    public boolean yankMotion(Editor editor, DataContext context, int count, int rawCount, Argument argument)
    {
        TextRange range = MotionGroup.getMotionRange(editor, context, count, rawCount, argument, true, true);

        return yankRange(editor, context, range, argument.getMotion().getFlags());
    }

    /**
     * This yanks count lines of text
     * @param editor The editor to yank from
     * @param context The data context
     * @param count The number of lines to yank
     * @return true if able to yank the lines, false if not
     */
    public boolean yankLine(Editor editor, DataContext context, int count)
    {
        int start = CommandGroups.getInstance().getMotion().moveCaretToLineStart(editor);
        int offset = Math.min(CommandGroups.getInstance().getMotion().moveCaretToLineEndOffset(
            editor, count - 1, true) + 1, EditorHelper.getFileSize(editor));
        if (offset != -1)
        {
            return yankRange(editor, context, new TextRange(start, offset), Command.FLAG_MOT_LINEWISE);
{'fraction_non_alphanumeric': 0.0834152736807604, 'fraction_numerical': 0.007210750573582432, 'mean_word_length': 3.448250728862974, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3130649', 'n_tokens_mistral': 1733, 'n_tokens_neox': 1664, 'n_words': 642}