SIGN IN SIGN UP

input: Fix IME composition rendering underline (#2601)

## Description

IME marked text was not underlined when the input already contained text
and syntax highlighting was disabled. With syntax highlighting enabled,
the underline was only applied when a complete highlight range was
contained in the marked range. As a result, the composition underline
could disappear or become incomplete when it crossed Markdown or other
syntax-highlight boundaries.

This PR fixes the issue mentioned above.

## How to Test

This can be reproduced with the following code.

```rust
use gpui::*;
use gpui_component::{
    input::{Input, InputState},
    *,
};
use gpui_component_assets::Assets;

struct Example {
    editor: Entity<InputState>,
}

impl Example {
    fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
        let editor = cx.new(|cx| {
            InputState::new(window, cx)
                .code_editor("markdown")
                .default_value("# Existing Markdown\n\nCompose here: ")
        });
        Self { editor }
    }
}

impl Render for Example {
    fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
        v_flex()
            .size_full()
            .p_5()
            .gap_4()
            .child(Input::new(&self.editor).h(px(200.)))
    }
}

fn main() {
    gpui_platform::application()
        .with_assets(Assets)
        .run(|cx| {
            gpui_component::init(cx);
            cx.spawn(async move |cx| {
                cx.open_window(WindowOptions::default(), |window, cx| {
                    let example = cx.new(|cx| Example::new(window, cx));
                    cx.new(|cx| Root::new(example, window, cx))
                })?;
                Ok::<_, anyhow::Error>(())
            })
            .detach();
        });
}
```

**Before**

<img width="232" height="175" alt="スクリーンショット 2026-07-27 1 34 44"
src="https://github.com/user-attachments/assets/a1ac1bde-6842-4f67-be78-a8ce2476339a"
/>

**After**

<img width="312" height="180" alt="スクリーンショット 2026-07-27 1 39 57"
src="https://github.com/user-attachments/assets/6a4dc516-44da-47d4-9482-f36d2c81de08"
/>


## Checklist

- [x] I have read the [CONTRIBUTING](../CONTRIBUTING.md) document and
followed the guidelines.
- [x] Reviewed the changes in this PR and confirmed AI generated code
(If any) is accurate.
- [x] Passed `cargo run` for story tests related to the changes.
- [ ] Tested macOS, Windows and Linux platforms performance (if the
change is platform-specific)

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
Y
Yusuke Nakada committed
4ac87b15c4df739a2fbca8c4116a920d9e0bb4d6
Parent: bc174a7
Committed by GitHub <noreply@github.com> on 7/27/2026, 3:03:38 AM