Multi-window: - Per-window ImGui contexts (fixes input, scroll, and rendering isolation) - Per-instance scroll and mouse state in ImGuiRenderer (no more statics) - Proper GL context activation during window destruction - ValidateBufferIndex guards against stale curbuf_ across shared buffers - Editor methods (CurrentBuffer, SwitchTo, CloseBuffer, etc.) use Buffers() accessor to respect shared buffer lists - New windows open with an untitled buffer - Scratch buffer reuse works in secondary windows - CMD-w on macOS closes only the focused window - Deferred new-window creation to avoid mid-frame ImGui context corruption Swap file cleanup: - SaveAs prompt handler now calls ResetJournal - cmd_save_and_quit now calls ResetJournal - Editor::Reset detaches all buffers before clearing - Tests for save-and-quit and editor-reset swap cleanup Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
24 lines
600 B
C++
24 lines
600 B
C++
/*
|
|
* ImGuiRenderer - ImGui-based renderer for GUI mode
|
|
*/
|
|
#pragma once
|
|
#include "Renderer.h"
|
|
|
|
class ImGuiRenderer final : public Renderer {
|
|
public:
|
|
ImGuiRenderer() = default;
|
|
|
|
~ImGuiRenderer() override = default;
|
|
|
|
void Draw(Editor &ed) override;
|
|
|
|
private:
|
|
// Per-window scroll tracking for two-way sync between Buffer offsets and ImGui scroll.
|
|
// These must be per-instance (not static) so each window maintains independent state.
|
|
long prev_buf_rowoffs_ = -1;
|
|
long prev_buf_coloffs_ = -1;
|
|
float prev_scroll_y_ = -1.0f;
|
|
float prev_scroll_x_ = -1.0f;
|
|
bool mouse_selecting_ = false;
|
|
};
|