Skip to content

Commit ad53db1

Browse files
committedOct 23, 2018
feat: introduce move top, bottom, lineBegin and lineEnd instructions
1 parent de7ec01 commit ad53db1

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed
 

‎README.md

+32
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,38 @@ Move cursor `n` lines forward if `n` is positive, otherwise `n` lines backward,
581581
process.stdout.write(clc.move.lines(2));
582582
```
583583

584+
##### clc.move.top
585+
586+
Move cursor to top of a screen
587+
588+
```javascript
589+
process.stdout.write(clc.move.top);
590+
```
591+
592+
##### clc.move.bottom
593+
594+
Move cursor to bottom of a screen
595+
596+
```javascript
597+
process.stdout.write(clc.move.bottom);
598+
```
599+
600+
##### clc.move.lineBegin
601+
602+
Move cursor to begin of a line
603+
604+
```javascript
605+
process.stdout.write(clc.move.lineBegin);
606+
```
607+
608+
##### clc.move.lineEnd
609+
610+
Move cursor to end of a line
611+
612+
```javascript
613+
process.stdout.write(clc.move.lineEnd);
614+
```
615+
584616
#### Terminal characteristics
585617

586618
##### clc.windowSize.width

‎move.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ module.exports = Object.defineProperties(
3434
dir = n >= 0 ? "E" : "F";
3535
n = floor(abs(n));
3636
return "\x1b[" + n + dir;
37-
})
37+
}),
38+
top: d("\x1b[5000F"),
39+
bottom: d("\x1b[5000B"),
40+
lineBegin: d("\x1b[5000D"),
41+
lineEnd: d("\x1b[5000C")
3842
}
3943
);

0 commit comments

Comments
 (0)
Please sign in to comment.