iced-rs/iced · error

Cursor line should be present

Error message

Cursor line should be present

What it means

Error "Cursor line should be present" thrown in iced-rs/iced.

Source

Thrown at graphics/src/text/editor.rs:201

                                } * (1.0 / internal.hint_factor),
                            )
                        } else {
                            None
                        }
                    })
                    .collect();

                Selection::Range(regions)
            }
            _ => {
                let line_height = buffer.metrics().line_height;

                let visual_lines_offset = visual_lines_offset(cursor.line, buffer);

                let line = buffer
                    .lines
                    .get(cursor.line)
                    .expect("Cursor line should be present");

                let layout = line.layout_opt().expect("Line layout should be cached");

                let empty_offset = match internal.alignment {
                    Alignment::Default | Alignment::Left | Alignment::Justified => 0.0,
                    Alignment::Center => internal.bounds.width / 2.0,
                    Alignment::Right => internal.bounds.width,
                };

                let (visual_line, offset) = layout
                    .iter()
                    .enumerate()
                    .find_map(|(i, line)| {
                        let (start, offset) = line
                            .glyphs
                            .first()
                            .map(|glyph| (glyph.start, glyph.x))
                            .unwrap_or((0, empty_offset));

View on GitHub (pinned to 2cffa99b39)

When it happens

Trigger: Thrown at graphics/src/text/editor.rs:201 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of iced-rs/iced@2cffa99b39 (2026-08-16). Data as JSON: /api/errors/0eac86dd814c69f0. Report an issue: GitHub.