|
|
@@ -234,15 +234,17 @@ void TuiEditor::handle_editor_event(EditorEvent event) {
|
|
|
} else if (event == EditorEvent::ISearchMode) {
|
|
|
core_->minibuffer_manager().activate_minibuffer(
|
|
|
MinibufferMode::ISearch, "I-search: ",
|
|
|
- [this](const std::string& input) { /* TODO: Implement actual isearch logic */ core_->set_message("I-search query: " + input); },
|
|
|
+ [](const std::string&) { },
|
|
|
[this]() { core_->set_message("Cancelled I-search"); }
|
|
|
);
|
|
|
+ core_->minibuffer_manager().start_isearch(true);
|
|
|
} else if (event == EditorEvent::ISearchBackwardMode) {
|
|
|
core_->minibuffer_manager().activate_minibuffer(
|
|
|
MinibufferMode::ISearch, "I-search backward: ",
|
|
|
- [this](const std::string& input) { /* TODO: Implement actual isearch logic */ core_->set_message("I-search backward query: " + input); },
|
|
|
+ [](const std::string&) { },
|
|
|
[this]() { core_->set_message("Cancelled I-search backward"); }
|
|
|
);
|
|
|
+ core_->minibuffer_manager().start_isearch(false);
|
|
|
} else if (event == EditorEvent::TransientMessageCleared) {
|
|
|
// Redraw to clear the message from the screen
|
|
|
render();
|
|
|
@@ -651,18 +653,23 @@ void TuiEditor::render_message_line() {
|
|
|
|
|
|
mvprintw(msg_y, 0, "%s", display_text.c_str());
|
|
|
|
|
|
- // Display completion candidates below the input line
|
|
|
+ // Display completion candidates below the input line (conceptually, but physically above if at bottom)
|
|
|
auto candidates = core_->minibuffer_manager().get_completion_candidates();
|
|
|
- if (!candidates.empty()) {
|
|
|
+ if (!candidates.empty() && msg_y > 0) {
|
|
|
+ // Move up one line to display completions above the current minibuffer line
|
|
|
+ move(msg_y - 1, 0);
|
|
|
+ clrtoeol(); // Clear the line first to remove artifacts from underlying window
|
|
|
+
|
|
|
std::string completion_display;
|
|
|
for (size_t i = 0; i < candidates.size() && static_cast<int>(completion_display.length()) < width_ - 5; ++i) {
|
|
|
if (!completion_display.empty()) completion_display += " ";
|
|
|
- completion_display += candidates[i].display_text; // Use display_text
|
|
|
+ completion_display += candidates[i].display_text;
|
|
|
}
|
|
|
if (static_cast<int>(completion_display.length()) >= width_ - 5) {
|
|
|
completion_display = completion_display.substr(0, width_ - 8) + "...";
|
|
|
}
|
|
|
- // Move up one line to display completions above the current minibuffer line
|
|
|
+
|
|
|
+ // Render with a different color/attribute if possible
|
|
|
mvprintw(msg_y - 1, 0, "%s", completion_display.c_str());
|
|
|
}
|
|
|
|