emilk / emilk/egui

Terminal/In Game Console Widget

Open
#319 7 comments 8 reactions 0 assignees View on GitHub
feature
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

**Is your feature request related to a problem? Please describe.**
I'd like to build an in game console but there does not seem to be a way to do this using the multiline text edit.

**Describe the solution you'd like**
I'd like a widget that has a way to scroll the cursor to the last character in the text box. Additionally, it would be amazing to be able to color specific text blocks in the output for errors and logging, etc.

**Describe alternatives you've considered**
I tried to use a multiline text box but when the buffer is modified (to add the prompt), the cursor stays behind the new text, and there is no way to move the cursor programmatically that I could find.

**Additional context**

```rust
let mut terminal_buffer = String::with_capacity(500);
ui.text_edit_multiline(&mut terminal_buffer);

// Later at the end of the frame:
if {
let command = >> " to the 2 newlines>;
// process command
terminal_buffer += &String::from(">>> "); // Add new prompt <--- This is where the cursor gets left behind
}
```

Is there a way to move the cursor to the end when the buffer is modified?

Contributor guide

Open the contributing guide

Research direction

Start with the ui.text_edit_multiline entry point and inspect how its text buffer and cursor are updated when the buffer changes. Check whether the existing widget API exposes programmatic cursor movement or styled output. Done means the requested terminal-console behavior is supported, including moving to the end after appending a prompt and coloring selected output blocks.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.