Skip to content

Commit

Permalink
Fixed some bugs with this approach
Browse files Browse the repository at this point in the history
  • Loading branch information
Chillee committed May 18, 2017
1 parent b4406a6 commit 59d1cbf
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/actions/motion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,10 @@ abstract class MoveByScreenLineMaintainDesiredColumn extends MoveByScreenLine {
}
}

class MoveDownFoldFix extends BaseMovement {
class MoveDownFoldFix extends MoveByScreenLine {
movementType: CursorMovePosition = "down";
by: CursorMoveByUnit = "line";

public async execAction(position: Position, vimState: VimState): Promise < Position | IMovement > {
if (position.line === TextEditor.getLineCount() - 1) {
return position;
Expand All @@ -253,7 +256,7 @@ class MoveDownFoldFix extends BaseMovement {
await new MoveUpByScreenLine().execAction(position, vimState);
count--;
}
return position.getDown(vimState.desiredColumn);
return super.execAction(position, vimState);
}
}

Expand Down Expand Up @@ -301,8 +304,9 @@ class MoveUp extends BaseMovement {
}

@RegisterAction
class MoveUpFoldFix extends BaseMovement {

class MoveUpFoldFix extends MoveByScreenLine {
movementType: CursorMovePosition = "up";
by: CursorMoveByUnit = "line";
public async execAction(position: Position, vimState: VimState): Promise < Position | IMovement > {
if (position.line === 0) {
return position;
Expand All @@ -321,7 +325,7 @@ class MoveUpFoldFix extends BaseMovement {
await new MoveDownByScreenLine().execAction(position, vimState);
count--;
}
return position.getUp(vimState.desiredColumn);
return super.execAction(position, vimState);
}
}

Expand Down

0 comments on commit 59d1cbf

Please sign in to comment.