feat(tui): builtin UI (TUI) sets client info #30397

Problem:
The default builtin UI client does not declare its client info. This
reduces discoverability and makes it difficult for plugins to identify
the UI.

Solution:
- Call nvim_set_client_info after attaching, as recommended by `:help dev-ui`.
- Also set the "pid" field.
- Also change `ui_active()` to return a count. Not directly relevant to
  this commit, but will be useful later.
This commit is contained in:
Justin M. Keyes
2024-09-18 04:14:06 -07:00
committed by GitHub
parent 22553e1f38
commit ff85e54939
13 changed files with 163 additions and 43 deletions

View File

@@ -182,9 +182,10 @@ bool ui_override(void)
return false;
}
bool ui_active(void)
/// Gets the number of UIs connected to this server.
size_t ui_active(void)
{
return ui_count > 0;
return ui_count;
}
void ui_refresh(void)
@@ -197,7 +198,7 @@ void ui_refresh(void)
int height = INT_MAX;
bool ext_widgets[kUIExtCount];
bool inclusive = ui_override();
memset(ext_widgets, ui_active(), ARRAY_SIZE(ext_widgets));
memset(ext_widgets, !!ui_active(), ARRAY_SIZE(ext_widgets));
for (size_t i = 0; i < ui_count; i++) {
RemoteUI *ui = uis[i];