|
|
@@ -154,6 +154,8 @@ private:
|
|
|
Mode mode_ = Mode::Normal;
|
|
|
std::string command_buffer_;
|
|
|
std::string message_line_;
|
|
|
+ std::vector<std::string> minibuffer_history_;
|
|
|
+ size_t history_index_ = 0;
|
|
|
|
|
|
// Member variables
|
|
|
Gtk::DrawingArea* drawing_area_ = nullptr; // For single-window compatibility
|
|
|
@@ -945,6 +947,12 @@ protected:
|
|
|
}
|
|
|
|
|
|
if (key_name == "Return") {
|
|
|
+ // Add to history
|
|
|
+ if (!command_buffer_.empty() && (minibuffer_history_.empty() || minibuffer_history_.back() != command_buffer_)) {
|
|
|
+ minibuffer_history_.push_back(command_buffer_);
|
|
|
+ }
|
|
|
+ history_index_ = minibuffer_history_.size();
|
|
|
+
|
|
|
// Execute command logic
|
|
|
if (mode_ == Mode::Command) {
|
|
|
if (command_buffer_ == "quit" || command_buffer_ == "q") {
|
|
|
@@ -970,6 +978,29 @@ protected:
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ // History Navigation
|
|
|
+ if (key_name == "ArrowUp") {
|
|
|
+ if (history_index_ > 0) {
|
|
|
+ history_index_--;
|
|
|
+ command_buffer_ = minibuffer_history_[history_index_];
|
|
|
+ if (content_widget_) queue_redraw_all_windows(content_widget_);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (key_name == "ArrowDown") {
|
|
|
+ if (history_index_ < minibuffer_history_.size()) {
|
|
|
+ history_index_++;
|
|
|
+ if (history_index_ == minibuffer_history_.size()) {
|
|
|
+ command_buffer_.clear();
|
|
|
+ } else {
|
|
|
+ command_buffer_ = minibuffer_history_[history_index_];
|
|
|
+ }
|
|
|
+ if (content_widget_) queue_redraw_all_windows(content_widget_);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
if (key_name == "Backspace") {
|
|
|
if (!command_buffer_.empty()) command_buffer_.pop_back();
|
|
|
if (content_widget_) queue_redraw_all_windows(content_widget_);
|