Slash status line implementation - #25
Open
jeanbaptistelab wants to merge 3 commits into
Open
Conversation
- ioctl() calls fails due to loki logging messing with the file descriptor used in these calls - replace use of "slash->fd_write" with "0" (stdin fd) which is unaffected - report error back or bail out of code path when ioctl() call fails - check for rows > 0 - push cursor position in more appropriate place - remove unnecessary cursor position setting
jeanbaptistelab
requested review from
edvardxyz,
kivkiv12345 and
troelsjessen
and
a lite review from Copilot
August 18, 2026 11:00
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a terminal statusline feature to slash, rendering persistent messages on a reserved bottom row and integrating lifecycle hooks into terminal setup/refresh/resize handling.
Changes:
- Added a statusline module with keyed items and severity-based coloring (normal/warning/error).
- Integrated statusline activation/deactivation into terminal configure/restore and refresh paths, plus SIGWINCH handling.
- Updated build system to compile the new source file and exposed a public statusline API header.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/statusline.c | Implements statusline item storage and rendering with ANSI escapes and theme colors. |
| src/slash.c | Activates a reserved bottom row via scroll region, renders statusline during refresh, and adds resize handling. |
| include/slash/statusline.h | Adds public API for setting/removing/counting/rendering statusline items. |
| include/slash/slash.h | Extends struct slash with statusline state and adds slash_sigwinch declaration. |
| meson.build | Adds src/statusline.c to build sources. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+889
to
+904
| return slash_refresh(slash, printtime); | ||
| } | ||
| struct winsize ws; | ||
| if (ioctl(0, TIOCGWINSZ, &ws) == -1) { | ||
| return -1; | ||
| } | ||
| if (ws.ws_row != slash->statusline_rows) { | ||
| slash_statusline_activate(slash); | ||
| return slash_refresh(slash, printtime); | ||
| } | ||
| char pos[16]; | ||
| slash_write(slash, "\0337", 2); /* DEC save cursor */ | ||
| snprintf(pos, sizeof(pos), "\033[%d;1H", slash->statusline_rows); | ||
| slash_write(slash, pos, strlen(pos)); | ||
| slash_statusline_render(slash); | ||
| slash_write(slash, "\0338", 2); /* DEC restore cursor */ |
| #ifdef SLASH_HAVE_TERMIOS_H | ||
| slash->statusline_enabled = false; | ||
| struct winsize ws; | ||
| if (ioctl(0, TIOCGWINSZ, &ws) == -1) |
| return slash_refresh(slash, printtime); | ||
| } | ||
| struct winsize ws; | ||
| if (ioctl(0, TIOCGWINSZ, &ws) == -1) { |
| slash->complete_in_completion = true; | ||
|
|
||
| slash->statusline_enabled = false; | ||
| tcgetattr(slash->fd_read, &slash->original); |
| slash->complete_in_completion = true; | ||
|
|
||
| slash->statusline_enabled = false; | ||
| tcgetattr(slash->fd_read, &slash->original); |
Comment on lines
+24
to
+25
| static struct slash_statusline_item items[SLASH_STATUSLINE_MAX_ITEMS]; | ||
| static int item_count = 0; |
| * @param format Printf-style format string for the display text (rendered max 127 chars). | ||
| * @param ... Variadic arguments matching the format string. | ||
| * @return 0 on success, -1 if no space available. | ||
| * * @note This is a macro that wraps slash_statusline_set_impl to allow inline struct initialization. |
|
Not performing review of this. |
troelsjessen
approved these changes
Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.