1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-08-10 06:40:37 +02:00

Handle line greater than line count

This commit is contained in:
rmaddy 2003-05-07 20:25:16 +00:00
parent 379012c9b4
commit 30f6cd480b

View File

@ -26,6 +26,7 @@ import com.maddyhome.idea.vim.ex.CommandHandler;
import com.maddyhome.idea.vim.ex.ExCommand;
import com.maddyhome.idea.vim.group.CommandGroups;
import com.maddyhome.idea.vim.group.MotionGroup;
import com.maddyhome.idea.vim.helper.EditorHelper;
/**
* This handles Ex commands that just specify a range which translates to moving the cursor to the line given by the
@ -52,6 +53,12 @@ public class GotoLineHandler extends CommandHandler
{
int count = cmd.getLine(editor, context);
int max = EditorHelper.getLineCount(editor);
if (count >= max)
{
count = max - 1;
}
if (count >= 0)
{
MotionGroup.moveCaret(editor, context,