Skip to content

Commit

Permalink
Fix terminal buffers
Browse files Browse the repository at this point in the history
The documentation seem to be wrong on a couple of points...
  • Loading branch information
fredizzimo committed Dec 4, 2023
1 parent 581f058 commit f776736
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/bridge/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,8 @@ fn parse_highlight_info(info_map: Value) -> Result<HighlightInfo> {
match kind_str.as_str() {
"ui" => kind = Some(HighlightKind::Ui),
"syntax" => kind = Some(HighlightKind::Syntax),
"terminal" => kind = Some(HighlightKind::Terminal),
// The documenation says terminal but Neovim 0.9.4 sends term...
"terminal" | "term" => kind = Some(HighlightKind::Terminal),
_ => return Err(ParseError::Format("Invalid highlight kind".to_string())),
}
}
Expand All @@ -574,11 +575,8 @@ fn parse_highlight_info(info_map: Value) -> Result<HighlightInfo> {
} else {
String::default()
};
let hi_name = hi_name
.ok_or(ParseError::Format(
"hi_name field not found in highlight info".to_string(),
))?
.to_string();
// hi_name can actually be absent for terminal, even though the documentation indicates otherwise
let hi_name = hi_name.unwrap_or_default();
let id = id.ok_or(ParseError::Format(
"id field not found in highlight info".to_string(),
))?;
Expand Down

0 comments on commit f776736

Please sign in to comment.