When the command prompt (:) is active, the terminal cursor moves to the
prompt line, leaving the primary cursor position in the editor invisible.
This change detects when a prompt component is active and forces the
primary cursor to be drawn manually in the editor while the prompt
is shown.
- Add prompt_active field to EditorView to track prompt state
- Update compositor to detect and communicate prompt state to EditorView
- Modify cursor highlighting logic to force primary cursor drawing when prompt is active
- Maintain real terminal cursor for prompt while showing fake cursor in editor
Previously, block cursors were always drawn manually as part of the
selection/highlight rendering, which prevented terminal cursor effects
(like cursor trails) from working. This change makes block cursors
behave like bar/underline cursors by using the terminal's real cursor
for the primary selection.
- Skip rendering primary cursor in block mode when terminal is focused
- Let terminal handle primary cursor rendering for all cursor types
- Simplify cursor method to return actual cursor kind when focused
This allows terminal-based cursor effects to work with block cursors
while maintaining proper cursor visibility when the terminal is unfocused.
The prompt was previously assuming that each grapheme cluster in the
line was single-width and single-byte. Lines like the one in the new
integration test would cause panics because the anchor attempted to
slice into a character.
This change rewrites the anchor and truncation code in the prompt to
account for Unicode segmentation and width. Now multi-width graphemes
can be hidden by multiple consecutive elipses - for example "十" is
hidden by "……" (2-width).
Co-authored-by: Narazaki, Shuji <shujinarazaki@protonmail.com>
This was previously highlighted as `punctuation` because the capture
applied to the whole `(color_value)` node rather than the `"#"` child
node specifically.
This style for RopeGraphemes is identical to Ropey's Chars and Bytes
iterators. Being able to move the iterator types like cursors over the
bytes/chars/graphemes is useful in some cases. For example see
`helix_core::movement::<Chars as CharHelpers>::range_to_target`.
This change also adds `RopeSliceExt::graphemes_at` for flexibility.
`graphemes` and `graphemes_rev` are now implemented in terms of
`graphemes_at` and `RopeGraphemes::reversed`.
These functions mirror those in `helix_core::graphemes` but operate
directly on byte indices rather than character indices. These are meant
to be used as we transition to Ropey v2 and always use byte indices.
This fixes a deadlock when starting Helix with very many files, like
`hx runtime/queries/*/*.scm`. The tree-sitter query files don't have
an active language server on my machine and yet we were spawning a tokio
task to collect documentColors responses. We can skip that entirely.
Further debugging is needed to figure out why this lead to a deadlock
previously.
Since locals are handled during parsing instead of highlighting with
tree-house, we need to call `helix_core::syntax::Loader::set_scopes`
before parsing any documents. During `:config-reload` we previously
reloaded the `Loader` and re-parsed documents and _then_ updated the
theme. So documents were parsed before `Loader::set_scopes` was called
on the new loader.
With this change the `refresh_language_config` helper is inlined into
`refresh_config`. Updating the `Editor`'s `ArcSwap` of the loader is
done before updating the theme so that the `load_configured_theme`
helper can call `set_scopes` with on the new loader.
This function was never used and will be superseded by
`RopeSliceExt::is_grapheme_boundary` (which accepts a byte index rather
than a character index) once we transition to Ropey v2. In the meantime
any callers should convert to byte index and use the `RopeSliceExt`
extension rather than form new dependencies on this.