emilk / emilk/egui

The TextEdit component failed to recognize consecutive '\r\n' characters correctly

Open
#3,077 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

The TextEdit component failed to recognize consecutive '\r\n' characters correctly

**Describe the bug**

I found that when I give a string with '\r\n\r\n' to make TextEdit display, there is something wrong with the display. For example it looks like there is one line missing.When I press Key::Down, I can't reach the last '\r\n', but whether I get a new line can be displayed.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to the CodeEditor,modify the code value to end with '\r\n\r\n'
2. Click on the keyboard down button
3.

**Expected behavior**

**Screenshots**

**Desktop (please complete the following information):**
- OS: Windows11
- Browser :chrome
- Version 22

**Additional context**
Modified value:
code: "// A very simple example\n\
fn main() {\n\
\tprintln!(\"Hello world!\");\n\
}\r\n\r\n"
.into(),

Contributor guide

Open the contributing guide

Research direction

Start with the TextEdit component and reproduce the issue through CodeEditor using a value ending in consecutive '\r\n' characters. Inspect how Key::Down handles the final empty lines and verify that every newline is reachable and displayed correctly, including the trailing blank line.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.