Skip to content

Commit 3c88926

Browse files
committed
term: make the second example in the README.md compilable as well
1 parent be3a536 commit 3c88926

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

‎vlib/term/README.md‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ This simple program covers many of the principal aspects of the `term ` module.
4141

4242
## API
4343

44-
Here are some functions you should be aware of in the `term `module:
44+
Here are some of the main functions of the `term `module:
4545

46-
```v oksyntax
46+
```v
4747
import term
4848
4949
// returns the height and the width of the terminal
5050
width, height := term.get_terminal_size()
51+
println('width: ${width}, height: ${height}')
5152
// returns the string as green text to be printed on stdout
5253
term.ok_message('cool')
5354
// returns the string as red text to be printed on stdout
@@ -77,15 +78,15 @@ term.bg_green('field')
7778
// sets the position of the cursor at a given place in the terminal
7879
term.set_cursor_position(x: 5, y: 10)
7980
// moves the cursor up
80-
term.cursor_up()
81+
term.cursor_up(1)
8182
// moves the cursor down
82-
term.cursor_down()
83+
term.cursor_down(1)
8384
// moves the cursor to the right
84-
term.cursor_forward()
85+
term.cursor_forward(2)
8586
// moves the cursor to the left
86-
term.cursor_back()
87-
// shows the cursor
88-
term.show_cursor()
87+
term.cursor_back(2)
8988
// hides the cursor
9089
term.hide_cursor()
90+
// shows the cursor
91+
term.show_cursor()
9192
```

0 commit comments

Comments
 (0)