فهرست منبع

feat(message-system): add multi-line message handling (Phase 4)

Multi-line messages now display the first line with an indicator showing
how many additional lines exist (e.g., "[+3 lines, C-h e]"). Users can
view the full message in the *Messages* buffer using C-h e.

Implemented in both GTK and TUI renderers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Bernardo Magri 1 ماه پیش
والد
کامیت
d9eabf38ff
2فایلهای تغییر یافته به همراه30 افزوده شده و 0 حذف شده
  1. 14 0
      src/gtk_renderer.cpp
  2. 16 0
      src/tui_editor.cpp

+ 14 - 0
src/gtk_renderer.cpp

@@ -511,6 +511,20 @@ void GtkRenderer::render_minibuffer(const Cairo::RefPtr<Cairo::Context>& cr, int
                     cr->set_source_rgb(fg.r / 255.0, fg.g / 255.0, fg.b / 255.0);
                     break;
             }
+
+            // Handle multi-line messages: show first line + indicator
+            size_t newline_pos = minibuffer_text.find('\n');
+            if (newline_pos != std::string::npos) {
+                // Count additional lines
+                size_t line_count = 1;
+                size_t pos = 0;
+                while ((pos = minibuffer_text.find('\n', pos)) != std::string::npos) {
+                    ++line_count;
+                    ++pos;
+                }
+                minibuffer_text = minibuffer_text.substr(0, newline_pos) +
+                    " [+" + std::to_string(line_count - 1) + " lines, C-h e]";
+            }
         } else {
             cr->set_source_rgb(fg.r / 255.0, fg.g / 255.0, fg.b / 255.0);
         }

+ 16 - 0
src/tui_editor.cpp

@@ -677,6 +677,22 @@ void TuiEditor::render_message_line() {
     } else if (!message_line_.empty()) {
         // Display transient message with truncation if needed
         std::string display_msg = message_line_;
+
+        // Handle multi-line messages: show first line + indicator
+        size_t newline_pos = display_msg.find('\n');
+        if (newline_pos != std::string::npos) {
+            // Count lines
+            size_t line_count = 1;
+            size_t pos = 0;
+            while ((pos = display_msg.find('\n', pos)) != std::string::npos) {
+                ++line_count;
+                ++pos;
+            }
+            // Show first line with line count indicator
+            display_msg = display_msg.substr(0, newline_pos) +
+                " [+" + std::to_string(line_count - 1) + " lines, C-h e]";
+        }
+
         const std::string suffix = "...[C-h e]";
         int available_width = width_ - 1;