Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/base/term.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ function term.popColor()
term.setTextColor(color)
end
end

function term.clearToEndOfLine()
io.write("\027[K")
end

function term.moveLeft(n)
io.write(string.format("\027[%sD", n))
end
2 changes: 2 additions & 0 deletions website/docs/Lua-Library-Additions.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@
* [term.setTextColor](term.setTextColor.md)
* [term.pushColor](term.pushColor.md)
* [term.popColor](term.popColor.md)
* [term.clearToEndOfLine](term.clearToEndOfLine.md)
* [term.moveLeft](term.moveLeft.md)

### Zip

Expand Down
24 changes: 24 additions & 0 deletions website/docs/term.clearToEndOfLine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Clears the console from the cursor location to the end of the line.

```lua
term.clearToEndOfLine()
```

### Parameters ###
None

### Return Value ###
None

### Example ###
``` lua
term.clearToEndOfLine()
```

### See Also ###
* [term.moveLeft](term.moveLeft.md)

### Availability ###

Premake 5.0.0 beta 3 or later.

24 changes: 24 additions & 0 deletions website/docs/term.moveLeft.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Moves the console cursor left by a number of columns.

```lua
term.moveLeft(columns)
```

### Parameters ###
`columns` is the number of columns to move left.

### Return Value ###
None

### Example ###
``` lua
term.moveLeft(2)
```

### See Also ###
* [term.clearToEndOfLine](term.clearToEndOfLine.md)

### Availability ###

Premake 5.0.0 beta 3 or later.

4 changes: 3 additions & 1 deletion website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,11 @@ module.exports = {
label: 'term',
items: [
'term.getTextColor',
'term.setTextColor',
'term.popColor',
Copy link
Contributor

@Jarod42 Jarod42 Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'term.moveLeft' is missing here.

'term.pushColor',
'term.setTextColor'
'term.clearToEndOfLine',
'term.moveLeft'
]
},
{
Expand Down