mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 01:18:21 +00:00
fix whitespace not showing cursor in text input (closes #247)
This commit is contained in:
parent
fb17cbd67b
commit
3ff77e0669
1 changed files with 12 additions and 3 deletions
|
|
@ -11,7 +11,7 @@ use crate::{
|
|||
use anyhow::Result;
|
||||
use crossterm::event::{Event, KeyCode, KeyModifiers};
|
||||
use itertools::Itertools;
|
||||
use std::ops::Range;
|
||||
use std::{collections::HashMap, ops::Range};
|
||||
use tui::{
|
||||
backend::Backend,
|
||||
layout::Rect,
|
||||
|
|
@ -157,11 +157,20 @@ impl TextInputComponent {
|
|||
self.get_msg(self.cursor_position..pos)
|
||||
});
|
||||
|
||||
if cursor_str == "\n" {
|
||||
let cursor_highlighting = {
|
||||
let mut h = HashMap::with_capacity(2);
|
||||
h.insert("\n", "\u{21b5}\n\r");
|
||||
h.insert(" ", "\u{00B7}");
|
||||
h
|
||||
};
|
||||
|
||||
if let Some(substitute) =
|
||||
cursor_highlighting.get(cursor_str.as_str())
|
||||
{
|
||||
txt = text_append(
|
||||
txt,
|
||||
Text::styled(
|
||||
"\u{21b5}\n\r",
|
||||
substitute.clone(),
|
||||
self.theme
|
||||
.text(false, false)
|
||||
.add_modifier(Modifier::UNDERLINED),
|
||||
|
|
|
|||
Loading…
Reference in a new issue