- Replace header include guards with `#pragma once` and perform minor optimizations. - Replaced traditional include guards with `#pragma once` for simplicity and to reduce boilerplate in all headers. - Improved CLI line number handling with clamping and error messaging. - Enhanced `chdir` error handling for macOS GUI builds. - Removed redundant logic for GUI builds. - Adjusted font constructor and registry to handle `const` data pointers consistently.
32 lines
691 B
C++
32 lines
691 B
C++
/*
|
|
* TerminalFrontend - couples TerminalInputHandler + TerminalRenderer and owns ncurses lifecycle
|
|
*/
|
|
#pragma once
|
|
#include <termios.h>
|
|
|
|
#include "Frontend.h"
|
|
#include "TerminalInputHandler.h"
|
|
#include "TerminalRenderer.h"
|
|
|
|
|
|
class TerminalFrontend final : public Frontend {
|
|
public:
|
|
TerminalFrontend() = default;
|
|
|
|
~TerminalFrontend() override = default;
|
|
|
|
bool Init(Editor &ed) override;
|
|
|
|
void Step(Editor &ed, bool &running) override;
|
|
|
|
void Shutdown() override;
|
|
|
|
private:
|
|
TerminalInputHandler input_{};
|
|
TerminalRenderer renderer_{};
|
|
int prev_r_ = 0;
|
|
int prev_c_ = 0;
|
|
// Saved terminal attributes to restore on shutdown
|
|
bool have_orig_tio_ = false;
|
|
struct termios orig_tio_{};
|
|
}; |