Reformat code.
This commit is contained in:
@@ -760,4 +760,4 @@ const UndoSystem *
|
||||
Buffer::Undo() const
|
||||
{
|
||||
return undo_sys_.get();
|
||||
}
|
||||
}
|
||||
|
||||
2
Buffer.h
2
Buffer.h
@@ -591,4 +591,4 @@ private:
|
||||
kte::SwapRecorder *swap_rec_ = nullptr;
|
||||
|
||||
mutable std::mutex buffer_mutex_;
|
||||
};
|
||||
};
|
||||
|
||||
43
Command.cc
43
Command.cc
@@ -1109,33 +1109,34 @@ cmd_theme_set_by_name(const CommandContext &ctx)
|
||||
static bool
|
||||
cmd_theme_set_by_name(CommandContext &ctx)
|
||||
{
|
||||
|
||||
# if defined(KTE_BUILD_GUI) && defined(KTE_USE_QT)
|
||||
// Qt GUI build: schedule theme change for frontend
|
||||
std::string name = ctx.arg;
|
||||
// trim spaces
|
||||
auto ltrim = [](std::string &s) {
|
||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) {
|
||||
return !std::isspace(ch);
|
||||
}));
|
||||
};
|
||||
auto rtrim = [](std::string &s) {
|
||||
s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) {
|
||||
return !std::isspace(ch);
|
||||
}).base(), s.end());
|
||||
};
|
||||
ltrim(name);
|
||||
rtrim(name);
|
||||
// Qt GUI build: schedule theme change for frontend
|
||||
std::string name = ctx.arg;
|
||||
// trim spaces
|
||||
auto ltrim = [](std::string &s) {
|
||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) {
|
||||
return !std::isspace(ch);
|
||||
}));
|
||||
};
|
||||
auto rtrim = [](std::string &s) {
|
||||
s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) {
|
||||
return !std::isspace(ch);
|
||||
}).base(), s.end());
|
||||
};
|
||||
ltrim (name);
|
||||
rtrim (name);
|
||||
if (name.empty()) {
|
||||
ctx.editor.SetStatus("theme: provide a name (e.g., nord, solarized-dark, gruvbox-light, eink)");
|
||||
return true;
|
||||
}
|
||||
kte::gThemeChangeRequest = name;
|
||||
kte::gThemeChangePending = true;
|
||||
ctx.editor.SetStatus(std::string("Theme requested: ") + name);
|
||||
kte::gThemeChangeRequest= name;
|
||||
kte::gThemeChangePending=true;
|
||||
ctx.editor.SetStatus (std::string("Theme requested: ") + name);
|
||||
return true;
|
||||
# else
|
||||
(void) ctx;
|
||||
// No-op in terminal build
|
||||
(void) ctx;
|
||||
// No-op in terminal build
|
||||
return true;
|
||||
# endif
|
||||
}
|
||||
@@ -4990,4 +4991,4 @@ Execute(Editor &ed, const std::string &name, const std::string &arg, int count)
|
||||
return false;
|
||||
CommandContext ctx{ed, arg, count};
|
||||
return cmd->handler ? cmd->handler(ctx) : false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,4 +164,4 @@ void InstallDefaultCommands();
|
||||
// Returns true if the command executed successfully.
|
||||
bool Execute(Editor &ed, CommandId id, const std::string &arg = std::string(), int count = 0);
|
||||
|
||||
bool Execute(Editor &ed, const std::string &name, const std::string &arg = std::string(), int count = 0);
|
||||
bool Execute(Editor &ed, const std::string &name, const std::string &arg = std::string(), int count = 0);
|
||||
|
||||
@@ -577,4 +577,4 @@ Editor::UArgGet()
|
||||
int n = (ucount_ > 0) ? ucount_ : 1;
|
||||
UArgClear();
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
2
Editor.h
2
Editor.h
@@ -662,4 +662,4 @@ public:
|
||||
private:
|
||||
std::string replace_find_tmp_;
|
||||
std::string replace_with_tmp_;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -19,4 +19,4 @@ public:
|
||||
|
||||
// Shutdown/cleanup
|
||||
virtual void Shutdown() = 0;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -127,4 +127,4 @@ GUIConfig::LoadFromFile(const std::string &path)
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,4 +30,4 @@ public:
|
||||
|
||||
// Load from explicit path. Returns true if file existed and was parsed.
|
||||
bool LoadFromFile(const std::string &path);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -942,4 +942,4 @@ SyntaxInk(const TokenKind k)
|
||||
}
|
||||
} // namespace kte
|
||||
|
||||
#endif // KTE_USE_QT
|
||||
#endif // KTE_USE_QT
|
||||
|
||||
@@ -79,4 +79,4 @@ HelpText::Text()
|
||||
" : theme NAME Set GUI theme (amber, eink, everforest, gruvbox, kanagawa-paper, lcars, nord, old-book, plan9, solarized, weyland-yutani, zenburn)\n"
|
||||
" : background MODE Set background: light | dark (affects eink, gruvbox, old-book, solarized)\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@ public:
|
||||
// Project maintainers can customize the returned string below
|
||||
// (in HelpText.cc) without touching the help command logic.
|
||||
static std::string Text();
|
||||
};
|
||||
};
|
||||
|
||||
@@ -34,4 +34,4 @@ struct LineHighlight {
|
||||
std::vector<HighlightSpan> spans;
|
||||
std::uint64_t version{0}; // buffer version used for this line
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -391,4 +391,4 @@ GUIFrontend::LoadGuiFont_(const char * /*path*/, const float size_px)
|
||||
|
||||
io.Fonts->Build();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,4 +33,4 @@ private:
|
||||
SDL_GLContext gl_ctx_ = nullptr;
|
||||
int width_ = 1280;
|
||||
int height_ = 800;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -158,17 +158,17 @@ map_key(const SDL_Keycode key,
|
||||
ascii_key = static_cast<int>(key);
|
||||
}
|
||||
bool ctrl2 = (mod & KMOD_CTRL) != 0;
|
||||
// If user typed a literal 'C' (uppercase) or '^' as a control qualifier, keep k-prefix active
|
||||
// Do NOT treat lowercase 'c' as a qualifier; 'c' is a valid k-command (BufferClose).
|
||||
if (ascii_key == 'C' || ascii_key == '^') {
|
||||
k_ctrl_pending = true;
|
||||
// Keep waiting for the next suffix; show status and suppress ensuing TEXTINPUT
|
||||
if (ed)
|
||||
ed->SetStatus("C-k C _");
|
||||
suppress_textinput_once = true;
|
||||
out.hasCommand = false;
|
||||
return true;
|
||||
}
|
||||
// If user typed a literal 'C' (uppercase) or '^' as a control qualifier, keep k-prefix active
|
||||
// Do NOT treat lowercase 'c' as a qualifier; 'c' is a valid k-command (BufferClose).
|
||||
if (ascii_key == 'C' || ascii_key == '^') {
|
||||
k_ctrl_pending = true;
|
||||
// Keep waiting for the next suffix; show status and suppress ensuing TEXTINPUT
|
||||
if (ed)
|
||||
ed->SetStatus("C-k C _");
|
||||
suppress_textinput_once = true;
|
||||
out.hasCommand = false;
|
||||
return true;
|
||||
}
|
||||
// Otherwise, consume the k-prefix now for the actual suffix
|
||||
k_prefix = false;
|
||||
if (ascii_key != 0) {
|
||||
@@ -298,7 +298,7 @@ ImGuiInputHandler::ProcessSDLEvent(const SDL_Event &e)
|
||||
// High-resolution trackpads can deliver fractional wheel deltas. Accumulate
|
||||
// precise values and emit one scroll step per whole unit.
|
||||
float dy = 0.0f;
|
||||
#if SDL_VERSION_ATLEAST(2,0,18)
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 18)
|
||||
dy = e.wheel.preciseY;
|
||||
#else
|
||||
dy = static_cast<float>(e.wheel.y);
|
||||
@@ -308,7 +308,7 @@ ImGuiInputHandler::ProcessSDLEvent(const SDL_Event &e)
|
||||
dy = -dy;
|
||||
#endif
|
||||
if (dy != 0.0f) {
|
||||
wheel_accum_y_ += dy;
|
||||
wheel_accum_y_ += dy;
|
||||
float abs_accum = wheel_accum_y_ >= 0.0f ? wheel_accum_y_ : -wheel_accum_y_;
|
||||
int steps = static_cast<int>(abs_accum);
|
||||
if (steps > 0) {
|
||||
@@ -439,14 +439,12 @@ ImGuiInputHandler::ProcessSDLEvent(const SDL_Event &e)
|
||||
}
|
||||
|
||||
// If editor universal argument is active, consume digit TEXTINPUT
|
||||
if (ed_ &&ed_
|
||||
if (ed_ && ed_
|
||||
|
||||
|
||||
|
||||
->
|
||||
UArg() != 0
|
||||
)
|
||||
{
|
||||
->
|
||||
UArg() != 0
|
||||
) {
|
||||
const char *txt = e.text.text;
|
||||
if (txt && *txt) {
|
||||
unsigned char c0 = static_cast<unsigned char>(txt[0]);
|
||||
@@ -473,16 +471,16 @@ ImGuiInputHandler::ProcessSDLEvent(const SDL_Event &e)
|
||||
ascii_key = static_cast<int>(c0);
|
||||
}
|
||||
if (ascii_key != 0) {
|
||||
// Qualifier via TEXTINPUT: uppercase 'C' or '^' only
|
||||
if (ascii_key == 'C' || ascii_key == '^') {
|
||||
k_ctrl_pending_ = true;
|
||||
if (ed_)
|
||||
ed_->SetStatus("C-k C _");
|
||||
// Keep k-prefix active; do not emit a command
|
||||
k_prefix_ = true;
|
||||
produced = true;
|
||||
break;
|
||||
}
|
||||
// Qualifier via TEXTINPUT: uppercase 'C' or '^' only
|
||||
if (ascii_key == 'C' || ascii_key == '^') {
|
||||
k_ctrl_pending_ = true;
|
||||
if (ed_)
|
||||
ed_->SetStatus("C-k C _");
|
||||
// Keep k-prefix active; do not emit a command
|
||||
k_prefix_ = true;
|
||||
produced = true;
|
||||
break;
|
||||
}
|
||||
// Map via k-prefix table; do not pass Ctrl for TEXTINPUT case
|
||||
CommandId id;
|
||||
bool pass_ctrl = k_ctrl_pending_;
|
||||
@@ -608,4 +606,4 @@ ImGuiInputHandler::Poll(MappedInput &out)
|
||||
out = q_.front();
|
||||
q_.pop();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,4 +46,4 @@ private:
|
||||
// command per whole step and keep the fractional remainder.
|
||||
float wheel_accum_y_ = 0.0f;
|
||||
float wheel_accum_x_ = 0.0f; // reserved for future horizontal scrolling
|
||||
};
|
||||
};
|
||||
|
||||
@@ -927,4 +927,4 @@ ImGuiRenderer::Draw(Editor &ed)
|
||||
ed.SetFilePickerVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,4 @@ public:
|
||||
~ImGuiRenderer() override = default;
|
||||
|
||||
void Draw(Editor &ed) override;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -28,4 +28,4 @@ public:
|
||||
// Poll for input and translate it to a command. Non-blocking.
|
||||
// Returns true if a command is available in 'out'. Returns false if no input.
|
||||
virtual bool Poll(MappedInput &out) = 0;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -230,4 +230,4 @@ KLookupEscCommand(const int ascii_key, CommandId &out) -> bool
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,4 +27,4 @@ KLowerAscii(const int key)
|
||||
if (key >= 'A' && key <= 'Z')
|
||||
return key + ('a' - 'A');
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,4 +20,4 @@ private:
|
||||
std::string last_pat_;
|
||||
|
||||
void build_bad_char(const std::string &pattern);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -982,4 +982,4 @@ GUIFrontend::Shutdown()
|
||||
delete app_;
|
||||
app_ = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,4 +33,4 @@ private:
|
||||
QWidget *window_ = nullptr; // owned
|
||||
int width_ = 1280;
|
||||
int height_ = 800;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -283,12 +283,11 @@ QtInputHandler::ProcessKeyEvent(const QKeyEvent &e)
|
||||
const bool ctrl_like = (mods & Qt::ControlModifier);
|
||||
|
||||
// 1) Universal argument digits (when active), consume digits without enqueuing commands
|
||||
if (ed_ &&ed_
|
||||
|
||||
->
|
||||
UArg() != 0
|
||||
)
|
||||
{
|
||||
if (ed_ && ed_
|
||||
|
||||
->
|
||||
UArg() != 0
|
||||
) {
|
||||
if (!(mods & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier))) {
|
||||
if (e.key() >= Qt::Key_0 && e.key() <= Qt::Key_9) {
|
||||
int d = e.key() - Qt::Key_0;
|
||||
@@ -379,10 +378,9 @@ QtInputHandler::ProcessKeyEvent(const QKeyEvent &e)
|
||||
// ESC/meta chords: on macOS, do NOT treat Meta as ESC; only Alt (Option) should trigger.
|
||||
#if defined(__APPLE__)
|
||||
if (esc_meta_ || (mods & Qt::AltModifier)) {
|
||||
|
||||
|
||||
#else
|
||||
if (esc_meta_ || (mods & (Qt::AltModifier | Qt::MetaModifier))) {
|
||||
if (esc_meta_ || (mods & (Qt::AltModifier | Qt::MetaModifier))) {
|
||||
|
||||
#endif
|
||||
int ascii_key = 0;
|
||||
if (e.key() == Qt::Key_Backspace) {
|
||||
@@ -535,4 +533,4 @@ QtInputHandler::Poll(MappedInput &out)
|
||||
out = q_.front();
|
||||
q_.pop();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,4 +37,4 @@ private:
|
||||
bool esc_meta_ = false; // ESC-prefix for next key
|
||||
bool suppress_text_input_once_ = false; // reserved (Qt sends text in keyPressEvent)
|
||||
Editor *ed_ = nullptr;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -73,4 +73,4 @@ QtRenderer::Draw(Editor &ed)
|
||||
}
|
||||
// Request a repaint
|
||||
widget_->update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +24,4 @@ public:
|
||||
|
||||
private:
|
||||
QWidget *widget_ = nullptr; // not owned
|
||||
};
|
||||
};
|
||||
|
||||
@@ -10,4 +10,4 @@ public:
|
||||
virtual ~Renderer() = default;
|
||||
|
||||
virtual void Draw(Editor &ed) = 0;
|
||||
};
|
||||
};
|
||||
|
||||
2
Swap.cc
2
Swap.cc
@@ -1292,4 +1292,4 @@ SwapManager::ReplayFile(Buffer &buf, const std::string &swap_path, std::string &
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
2
Swap.h
2
Swap.h
@@ -223,4 +223,4 @@ private:
|
||||
std::atomic<bool> running_{false};
|
||||
std::thread worker_;
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -16,4 +16,4 @@ public:
|
||||
|
||||
virtual void OnDelete(int row, int col, std::size_t len) = 0;
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -126,4 +126,4 @@ TerminalFrontend::Shutdown()
|
||||
have_old_sigint_ = false;
|
||||
}
|
||||
endwin();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,4 +38,4 @@ private:
|
||||
// Saved SIGINT handler to restore on shutdown
|
||||
bool have_old_sigint_ = false;
|
||||
struct sigaction old_sigint_{};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -329,4 +329,4 @@ TerminalInputHandler::Poll(MappedInput &out)
|
||||
{
|
||||
out = {};
|
||||
return decode_(out) && out.hasCommand;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,4 +34,4 @@ private:
|
||||
bool mouse_selecting_ = false;
|
||||
|
||||
Editor *ed_ = nullptr; // attached editor for uarg handling
|
||||
};
|
||||
};
|
||||
|
||||
@@ -615,4 +615,4 @@ TerminalRenderer::Draw(Editor &ed)
|
||||
}
|
||||
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,4 @@ public:
|
||||
~TerminalRenderer() override;
|
||||
|
||||
void Draw(Editor &ed) override;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -35,4 +35,4 @@ TestFrontend::Step(Editor &ed, bool &running)
|
||||
|
||||
|
||||
void
|
||||
TestFrontend::Shutdown() {}
|
||||
TestFrontend::Shutdown() {}
|
||||
|
||||
@@ -34,4 +34,4 @@ public:
|
||||
private:
|
||||
TestInputHandler input_{};
|
||||
TestRenderer renderer_{};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -27,4 +27,4 @@ public:
|
||||
|
||||
private:
|
||||
std::queue<MappedInput> queue_;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -29,4 +29,4 @@ public:
|
||||
|
||||
private:
|
||||
std::size_t draw_count_ = 0;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -20,4 +20,4 @@ struct UndoNode {
|
||||
UndoNode *parent = nullptr; // previous state; null means pre-first-edit
|
||||
UndoNode *child = nullptr; // next in current timeline
|
||||
UndoNode *next = nullptr; // redo branch
|
||||
};
|
||||
};
|
||||
|
||||
@@ -60,4 +60,4 @@ private:
|
||||
std::size_t block_size_;
|
||||
std::vector<std::unique_ptr<UndoNode[]> > blocks_;
|
||||
std::stack<UndoNode *> available_;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -452,4 +452,4 @@ UndoSystem::debug_log(const char *op) const
|
||||
#else
|
||||
(void) op;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,4 +77,4 @@ private:
|
||||
|
||||
Buffer *buf_;
|
||||
UndoTree &tree_;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -7,4 +7,4 @@ struct UndoTree {
|
||||
UndoNode *current = nullptr; // current state of buffer
|
||||
UndoNode *saved = nullptr; // points to node matching last save (for dirty flag)
|
||||
UndoNode *pending = nullptr; // in-progress batch (detached)
|
||||
};
|
||||
};
|
||||
|
||||
@@ -11884,4 +11884,4 @@ static const unsigned int DefaultFontRegularCompressedData[72616 / 4] =
|
||||
0x0070a96e,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5586,4 +5586,4 @@ static const unsigned int DefaultFontBoldCompressedData[32380 / 4] =
|
||||
0x0e01060e, 0xff01b82a, 0x8d04b085,
|
||||
0x440002b1, 0x066405b3, 0x00444400, 0x01000000, 0x00000000, 0xfacafa05, 0x00004aa6,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5918,4 +5918,4 @@ static const unsigned int DefaultFontRegularCompressedData[34064 / 4] =
|
||||
0x20080082, 0x01060eb3, 0x01b82a0e,
|
||||
0x04b085ff, 0x0002b18d, 0x6405b344, 0x44440006, 0x00000000, 0x00000001, 0xccfa0500, 0x0030ee4f,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2851,4 +2851,4 @@ static const unsigned int DefaultFontRegularCompressedData[68288 / 4] =
|
||||
0x820a2003, 0x421e20c3, 0x18821057,
|
||||
0x21830284, 0xdeda0024, 0x0d83c5d7, 0xa48ad12b, 0x0000001e, 0xa48ad100, 0x62fa051e, 0x00a176d4,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,4 +37,4 @@ Font::Load(const float size) const
|
||||
|
||||
io.Fonts->Build();
|
||||
}
|
||||
} // namespace kte::Fonts
|
||||
} // namespace kte::Fonts
|
||||
|
||||
@@ -119,4 +119,4 @@ private:
|
||||
|
||||
|
||||
void InstallDefaultFonts();
|
||||
}
|
||||
}
|
||||
|
||||
25743
fonts/Go.h
25743
fonts/Go.h
File diff suppressed because it is too large
Load Diff
@@ -13671,4 +13671,4 @@ static const unsigned int DefaultFontItalicCompressedData[84884 / 4] =
|
||||
0x4f1aea4f, 0x0d2022dc, 0x211fdc4f,
|
||||
0x164f2804, 0x8b952711, 0x236f6f19, 0xfa050081, 0x0bda00e5,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6231,4 +6231,4 @@ static const unsigned int DefaultFontRegularCompressedData[149388 / 4] =
|
||||
0x86382043, 0x870f8383, 0x022e2463,
|
||||
0x05480066, 0x599623fa, 0x00000043,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5632,4 +5632,4 @@ static const unsigned int DefaultFontRegularCompressedData[66932 / 4] =
|
||||
0xc6221786, 0x1788a203, 0x86008524,
|
||||
0x2f88e200, 0x1788a520, 0xf6ffb424, 0xfa05fa00, 0xc234b8e9,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5737,4 +5737,4 @@ static const unsigned int DefaultFontBoldCompressedData[68920 / 4] =
|
||||
0x86910006, 0x03c32217, 0x241788b7, 0x00ce0085, 0x202f88e4, 0x261788b5, 0x00ebffb4, 0x050000fe, 0x877646fa,
|
||||
0x000000de,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
22065
fonts/Triplicate.h
22065
fonts/Triplicate.h
File diff suppressed because it is too large
Load Diff
9
main.cc
9
main.cc
@@ -195,12 +195,11 @@ main(int argc, char *argv[])
|
||||
} else if (req_term) {
|
||||
use_gui = false;
|
||||
} else {
|
||||
|
||||
// Default depends on build target: kge defaults to GUI, kte to terminal
|
||||
// Default depends on build target: kge defaults to GUI, kte to terminal
|
||||
#if defined(KTE_DEFAULT_GUI)
|
||||
use_gui = true;
|
||||
use_gui = true;
|
||||
#else
|
||||
use_gui = false;
|
||||
use_gui = false;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -302,4 +301,4 @@ main(int argc, char *argv[])
|
||||
fe->Shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ CppHighlighter::HighlightLineStateful(const Buffer &buf,
|
||||
bool closed = false;
|
||||
while (j + 1 <= n) {
|
||||
if (j + 1 < n && s[j] == '*' && s[j + 1] == '/') {
|
||||
j += 2;
|
||||
j += 2;
|
||||
closed = true;
|
||||
break;
|
||||
}
|
||||
@@ -276,4 +276,4 @@ CppHighlighter::HighlightLineStateful(const Buffer &buf,
|
||||
|
||||
return state;
|
||||
}
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -32,4 +32,4 @@ private:
|
||||
|
||||
static bool is_ident_char(char c);
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -156,4 +156,4 @@ ErlangHighlighter::HighlightLine(const Buffer &buf, int row, std::vector<Highlig
|
||||
++i;
|
||||
}
|
||||
}
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -14,4 +14,4 @@ public:
|
||||
private:
|
||||
std::unordered_set<std::string> kws_;
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -118,4 +118,4 @@ ForthHighlighter::HighlightLine(const Buffer &buf, int row, std::vector<Highligh
|
||||
++i;
|
||||
}
|
||||
}
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -14,4 +14,4 @@ public:
|
||||
private:
|
||||
std::unordered_set<std::string> kws_;
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -75,7 +75,7 @@ GoHighlighter::HighlightLine(const Buffer &buf, int row, std::vector<HighlightSp
|
||||
bool closed = false;
|
||||
while (j + 1 <= n) {
|
||||
if (j + 1 < n && s[j] == '*' && s[j + 1] == '/') {
|
||||
j += 2;
|
||||
j += 2;
|
||||
closed = true;
|
||||
break;
|
||||
}
|
||||
@@ -154,4 +154,4 @@ GoHighlighter::HighlightLine(const Buffer &buf, int row, std::vector<HighlightSp
|
||||
++i;
|
||||
}
|
||||
}
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -15,4 +15,4 @@ private:
|
||||
std::unordered_set<std::string> kws_;
|
||||
std::unordered_set<std::string> types_;
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -221,4 +221,4 @@ HighlighterEngine::PrefetchViewport(const Buffer &buf, int first_row, int row_co
|
||||
ensure_worker_started();
|
||||
cv_.notify_one();
|
||||
}
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -87,4 +87,4 @@ private:
|
||||
|
||||
void worker_loop() const;
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -244,4 +244,4 @@ HighlighterRegistry::RegisterTreeSitter(std::string_view filetype,
|
||||
}, /*override_existing=*/true);
|
||||
}
|
||||
#endif
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -44,4 +44,4 @@ public:
|
||||
const TSLanguage * (*get_language)());
|
||||
#endif
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -87,4 +87,4 @@ JSONHighlighter::HighlightLine(const Buffer &buf, int row, std::vector<Highlight
|
||||
++i;
|
||||
}
|
||||
}
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -9,4 +9,4 @@ class JSONHighlighter final : public LanguageHighlighter {
|
||||
public:
|
||||
void HighlightLine(const Buffer &buf, int row, std::vector<HighlightSpan> &out) const override;
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -48,4 +48,4 @@ public:
|
||||
return true;
|
||||
}
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -104,4 +104,4 @@ LispHighlighter::HighlightLine(const Buffer &buf, int row, std::vector<Highlight
|
||||
++i;
|
||||
}
|
||||
}
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -14,4 +14,4 @@ public:
|
||||
private:
|
||||
std::unordered_set<std::string> kws_;
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -129,4 +129,4 @@ MarkdownHighlighter::HighlightLineStateful(const Buffer &buf, int row, const Lin
|
||||
}
|
||||
return state;
|
||||
}
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -11,4 +11,4 @@ public:
|
||||
LineState HighlightLineStateful(const Buffer &buf, int row, const LineState &prev,
|
||||
std::vector<HighlightSpan> &out) const override;
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -14,4 +14,4 @@ NullHighlighter::HighlightLine(const Buffer &buf, int row, std::vector<Highlight
|
||||
return;
|
||||
out.push_back({0, n, TokenKind::Default});
|
||||
}
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -8,4 +8,4 @@ class NullHighlighter final : public LanguageHighlighter {
|
||||
public:
|
||||
void HighlightLine(const Buffer &buf, int row, std::vector<HighlightSpan> &out) const override;
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -169,4 +169,4 @@ PythonHighlighter::HighlightLineStateful(const Buffer &buf, int row, const LineS
|
||||
}
|
||||
return state;
|
||||
}
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -17,4 +17,4 @@ public:
|
||||
private:
|
||||
std::unordered_set<std::string> kws_;
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -72,7 +72,7 @@ RustHighlighter::HighlightLine(const Buffer &buf, int row, std::vector<Highlight
|
||||
bool closed = false;
|
||||
while (j + 1 <= n) {
|
||||
if (j + 1 < n && s[j] == '*' && s[j + 1] == '/') {
|
||||
j += 2;
|
||||
j += 2;
|
||||
closed = true;
|
||||
break;
|
||||
}
|
||||
@@ -142,4 +142,4 @@ RustHighlighter::HighlightLine(const Buffer &buf, int row, std::vector<Highlight
|
||||
++i;
|
||||
}
|
||||
}
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -15,4 +15,4 @@ private:
|
||||
std::unordered_set<std::string> kws_;
|
||||
std::unordered_set<std::string> types_;
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -102,4 +102,4 @@ ShellHighlighter::HighlightLine(const Buffer &buf, int row, std::vector<Highligh
|
||||
++i;
|
||||
}
|
||||
}
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -8,4 +8,4 @@ class ShellHighlighter final : public LanguageHighlighter {
|
||||
public:
|
||||
void HighlightLine(const Buffer &buf, int row, std::vector<HighlightSpan> &out) const override;
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -75,7 +75,7 @@ SqlHighlighter::HighlightLine(const Buffer &buf, int row, std::vector<HighlightS
|
||||
bool closed = false;
|
||||
while (j + 1 <= n) {
|
||||
if (j + 1 < n && s[j] == '*' && s[j + 1] == '/') {
|
||||
j += 2;
|
||||
j += 2;
|
||||
closed = true;
|
||||
break;
|
||||
}
|
||||
@@ -153,4 +153,4 @@ SqlHighlighter::HighlightLine(const Buffer &buf, int row, std::vector<HighlightS
|
||||
++i;
|
||||
}
|
||||
}
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -15,4 +15,4 @@ private:
|
||||
std::unordered_set<std::string> kws_;
|
||||
std::unordered_set<std::string> types_;
|
||||
};
|
||||
} // namespace kte
|
||||
} // namespace kte
|
||||
|
||||
@@ -44,8 +44,8 @@ CreateTreeSitterHighlighter(const char *filetype,
|
||||
const void * (*get_lang)())
|
||||
{
|
||||
const auto *lang = reinterpret_cast<const TSLanguage *>(get_lang ? get_lang() : nullptr);
|
||||
return std::make_unique < TreeSitterHighlighter > (lang, filetype ? std::string(filetype) : std::string());
|
||||
return std::make_unique<TreeSitterHighlighter>(lang, filetype ? std::string(filetype) : std::string());
|
||||
}
|
||||
} // namespace kte
|
||||
|
||||
#endif // KTE_ENABLE_TREESITTER
|
||||
#endif // KTE_ENABLE_TREESITTER
|
||||
|
||||
@@ -45,4 +45,4 @@ std::unique_ptr<LanguageHighlighter> CreateTreeSitterHighlighter(const char *fil
|
||||
const void * (*get_lang)());
|
||||
} // namespace kte
|
||||
|
||||
#endif // KTE_ENABLE_TREESITTER
|
||||
#endif // KTE_ENABLE_TREESITTER
|
||||
|
||||
62
tests/Test.h
62
tests/Test.h
@@ -8,49 +8,61 @@
|
||||
#include <sstream>
|
||||
|
||||
namespace ktet {
|
||||
|
||||
struct TestCase {
|
||||
std::string name;
|
||||
std::function<void()> fn;
|
||||
std::string name;
|
||||
std::function<void()> fn;
|
||||
};
|
||||
|
||||
inline std::vector<TestCase>& registry() {
|
||||
static std::vector<TestCase> r;
|
||||
return r;
|
||||
|
||||
inline std::vector<TestCase> &
|
||||
registry()
|
||||
{
|
||||
static std::vector<TestCase> r;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
struct Registrar {
|
||||
Registrar(const char* name, std::function<void()> fn) {
|
||||
registry().push_back(TestCase{std::string(name), std::move(fn)});
|
||||
}
|
||||
Registrar(const char *name, std::function<void()> fn)
|
||||
{
|
||||
registry().push_back(TestCase{std::string(name), std::move(fn)});
|
||||
}
|
||||
};
|
||||
|
||||
// Assertions
|
||||
struct AssertionFailure {
|
||||
std::string msg;
|
||||
std::string msg;
|
||||
};
|
||||
|
||||
inline void expect(bool cond, const char* expr, const char* file, int line) {
|
||||
if (!cond) {
|
||||
std::cerr << file << ":" << line << ": EXPECT failed: " << expr << "\n";
|
||||
}
|
||||
|
||||
inline void
|
||||
expect(bool cond, const char *expr, const char *file, int line)
|
||||
{
|
||||
if (!cond) {
|
||||
std::cerr << file << ":" << line << ": EXPECT failed: " << expr << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
inline void assert_true(bool cond, const char* expr, const char* file, int line) {
|
||||
if (!cond) {
|
||||
throw AssertionFailure{std::string(file) + ":" + std::to_string(line) + ": ASSERT failed: " + expr};
|
||||
}
|
||||
|
||||
inline void
|
||||
assert_true(bool cond, const char *expr, const char *file, int line)
|
||||
{
|
||||
if (!cond) {
|
||||
throw AssertionFailure{std::string(file) + ":" + std::to_string(line) + ": ASSERT failed: " + expr};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename A, typename B>
|
||||
inline void assert_eq_impl(const A& a, const B& b, const char* ea, const char* eb, const char* file, int line) {
|
||||
if (!(a == b)) {
|
||||
std::ostringstream oss;
|
||||
oss << file << ":" << line << ": ASSERT_EQ failed: " << ea << " == " << eb;
|
||||
throw AssertionFailure{oss.str()};
|
||||
}
|
||||
inline void
|
||||
assert_eq_impl(const A &a, const B &b, const char *ea, const char *eb, const char *file, int line)
|
||||
{
|
||||
if (!(a == b)) {
|
||||
std::ostringstream oss;
|
||||
oss << file << ":" << line << ": ASSERT_EQ failed: " << ea << " == " << eb;
|
||||
throw AssertionFailure{oss.str()};
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ktet
|
||||
|
||||
#define TEST(name) \
|
||||
|
||||
@@ -135,4 +135,4 @@ public:
|
||||
private:
|
||||
Editor editor_;
|
||||
};
|
||||
} // namespace ktet
|
||||
} // namespace ktet
|
||||
|
||||
@@ -2,32 +2,35 @@
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
|
||||
int main() {
|
||||
using namespace std::chrono;
|
||||
auto ® = ktet::registry();
|
||||
std::cout << "kte unit tests: " << reg.size() << " test(s)\n";
|
||||
int failed = 0;
|
||||
auto t0 = steady_clock::now();
|
||||
for (const auto &tc : reg) {
|
||||
auto ts = steady_clock::now();
|
||||
try {
|
||||
tc.fn();
|
||||
auto te = steady_clock::now();
|
||||
auto ms = duration_cast<milliseconds>(te - ts).count();
|
||||
std::cout << "[ OK ] " << tc.name << " (" << ms << " ms)\n";
|
||||
} catch (const ktet::AssertionFailure &e) {
|
||||
++failed;
|
||||
std::cerr << "[FAIL] " << tc.name << " -> " << e.msg << "\n";
|
||||
} catch (const std::exception &e) {
|
||||
++failed;
|
||||
std::cerr << "[EXCP] " << tc.name << " -> " << e.what() << "\n";
|
||||
} catch (...) {
|
||||
++failed;
|
||||
std::cerr << "[EXCP] " << tc.name << " -> unknown exception\n";
|
||||
}
|
||||
}
|
||||
auto t1 = steady_clock::now();
|
||||
auto total_ms = duration_cast<milliseconds>(t1 - t0).count();
|
||||
std::cout << "Done in " << total_ms << " ms. Failures: " << failed << "\n";
|
||||
return failed == 0 ? 0 : 1;
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace std::chrono;
|
||||
auto ® = ktet::registry();
|
||||
std::cout << "kte unit tests: " << reg.size() << " test(s)\n";
|
||||
int failed = 0;
|
||||
auto t0 = steady_clock::now();
|
||||
for (const auto &tc: reg) {
|
||||
auto ts = steady_clock::now();
|
||||
try {
|
||||
tc.fn();
|
||||
auto te = steady_clock::now();
|
||||
auto ms = duration_cast<milliseconds>(te - ts).count();
|
||||
std::cout << "[ OK ] " << tc.name << " (" << ms << " ms)\n";
|
||||
} catch (const ktet::AssertionFailure &e) {
|
||||
++failed;
|
||||
std::cerr << "[FAIL] " << tc.name << " -> " << e.msg << "\n";
|
||||
} catch (const std::exception &e) {
|
||||
++failed;
|
||||
std::cerr << "[EXCP] " << tc.name << " -> " << e.what() << "\n";
|
||||
} catch (...) {
|
||||
++failed;
|
||||
std::cerr << "[EXCP] " << tc.name << " -> unknown exception\n";
|
||||
}
|
||||
}
|
||||
auto t1 = steady_clock::now();
|
||||
auto total_ms = duration_cast<milliseconds>(t1 - t0).count();
|
||||
std::cout << "Done in " << total_ms << " ms. Failures: " << failed << "\n";
|
||||
return failed == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -4,76 +4,85 @@
|
||||
#include <string>
|
||||
#include "Buffer.h"
|
||||
|
||||
static std::string read_all(const std::string &path) {
|
||||
std::ifstream in(path, std::ios::binary);
|
||||
return std::string((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>());
|
||||
|
||||
static std::string
|
||||
read_all(const std::string &path)
|
||||
{
|
||||
std::ifstream in(path, std::ios::binary);
|
||||
return std::string((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>());
|
||||
}
|
||||
|
||||
TEST(Buffer_SaveAs_and_Save_new_file) {
|
||||
const std::string path = "./.kte_ut_buffer_io_1.tmp";
|
||||
std::remove(path.c_str());
|
||||
|
||||
Buffer b;
|
||||
// insert two lines
|
||||
b.insert_text(0, 0, std::string("Hello, world!\n"));
|
||||
b.insert_text(1, 0, std::string("Second line\n"));
|
||||
TEST(Buffer_SaveAs_and_Save_new_file)
|
||||
{
|
||||
const std::string path = "./.kte_ut_buffer_io_1.tmp";
|
||||
std::remove(path.c_str());
|
||||
|
||||
std::string err;
|
||||
ASSERT_TRUE(b.SaveAs(path, err));
|
||||
ASSERT_EQ(err.empty(), true);
|
||||
Buffer b;
|
||||
// insert two lines
|
||||
b.insert_text(0, 0, std::string("Hello, world!\n"));
|
||||
b.insert_text(1, 0, std::string("Second line\n"));
|
||||
|
||||
// append another line then Save()
|
||||
b.insert_text(2, 0, std::string("Third\n"));
|
||||
b.SetDirty(true);
|
||||
ASSERT_TRUE(b.Save(err));
|
||||
ASSERT_EQ(err.empty(), true);
|
||||
std::string err;
|
||||
ASSERT_TRUE(b.SaveAs(path, err));
|
||||
ASSERT_EQ(err.empty(), true);
|
||||
|
||||
std::string got = read_all(path);
|
||||
ASSERT_EQ(got, std::string("Hello, world!\nSecond line\nThird\n"));
|
||||
// append another line then Save()
|
||||
b.insert_text(2, 0, std::string("Third\n"));
|
||||
b.SetDirty(true);
|
||||
ASSERT_TRUE(b.Save(err));
|
||||
ASSERT_EQ(err.empty(), true);
|
||||
|
||||
std::remove(path.c_str());
|
||||
std::string got = read_all(path);
|
||||
ASSERT_EQ(got, std::string("Hello, world!\nSecond line\nThird\n"));
|
||||
|
||||
std::remove(path.c_str());
|
||||
}
|
||||
|
||||
TEST(Buffer_Save_after_Open_existing) {
|
||||
const std::string path = "./.kte_ut_buffer_io_2.tmp";
|
||||
std::remove(path.c_str());
|
||||
{
|
||||
std::ofstream out(path, std::ios::binary);
|
||||
out << "abc\n123\n";
|
||||
}
|
||||
|
||||
Buffer b;
|
||||
std::string err;
|
||||
ASSERT_TRUE(b.OpenFromFile(path, err));
|
||||
ASSERT_EQ(err.empty(), true);
|
||||
TEST(Buffer_Save_after_Open_existing)
|
||||
{
|
||||
const std::string path = "./.kte_ut_buffer_io_2.tmp";
|
||||
std::remove(path.c_str());
|
||||
{
|
||||
std::ofstream out(path, std::ios::binary);
|
||||
out << "abc\n123\n";
|
||||
}
|
||||
|
||||
b.insert_text(2, 0, std::string("tail\n"));
|
||||
b.SetDirty(true);
|
||||
ASSERT_TRUE(b.Save(err));
|
||||
ASSERT_EQ(err.empty(), true);
|
||||
Buffer b;
|
||||
std::string err;
|
||||
ASSERT_TRUE(b.OpenFromFile(path, err));
|
||||
ASSERT_EQ(err.empty(), true);
|
||||
|
||||
std::string got = read_all(path);
|
||||
ASSERT_EQ(got, std::string("abc\n123\ntail\n"));
|
||||
std::remove(path.c_str());
|
||||
b.insert_text(2, 0, std::string("tail\n"));
|
||||
b.SetDirty(true);
|
||||
ASSERT_TRUE(b.Save(err));
|
||||
ASSERT_EQ(err.empty(), true);
|
||||
|
||||
std::string got = read_all(path);
|
||||
ASSERT_EQ(got, std::string("abc\n123\ntail\n"));
|
||||
std::remove(path.c_str());
|
||||
}
|
||||
|
||||
TEST(Buffer_Open_nonexistent_then_SaveAs) {
|
||||
const std::string path = "./.kte_ut_buffer_io_3.tmp";
|
||||
std::remove(path.c_str());
|
||||
|
||||
Buffer b;
|
||||
std::string err;
|
||||
ASSERT_TRUE(b.OpenFromFile(path, err));
|
||||
ASSERT_EQ(err.empty(), true);
|
||||
ASSERT_EQ(b.IsFileBacked(), false);
|
||||
TEST(Buffer_Open_nonexistent_then_SaveAs)
|
||||
{
|
||||
const std::string path = "./.kte_ut_buffer_io_3.tmp";
|
||||
std::remove(path.c_str());
|
||||
|
||||
b.insert_text(0, 0, std::string("hello, world"));
|
||||
b.insert_text(0, 12, std::string("\n"));
|
||||
b.SetDirty(true);
|
||||
ASSERT_TRUE(b.SaveAs(path, err));
|
||||
ASSERT_EQ(err.empty(), true);
|
||||
Buffer b;
|
||||
std::string err;
|
||||
ASSERT_TRUE(b.OpenFromFile(path, err));
|
||||
ASSERT_EQ(err.empty(), true);
|
||||
ASSERT_EQ(b.IsFileBacked(), false);
|
||||
|
||||
std::string got = read_all(path);
|
||||
ASSERT_EQ(got, std::string("hello, world\n"));
|
||||
std::remove(path.c_str());
|
||||
b.insert_text(0, 0, std::string("hello, world"));
|
||||
b.insert_text(0, 12, std::string("\n"));
|
||||
b.SetDirty(true);
|
||||
ASSERT_TRUE(b.SaveAs(path, err));
|
||||
ASSERT_EQ(err.empty(), true);
|
||||
|
||||
std::string got = read_all(path);
|
||||
ASSERT_EQ(got, std::string("hello, world\n"));
|
||||
std::remove(path.c_str());
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ check_buffer_matches_model(const Buffer &b, const std::string &model)
|
||||
}
|
||||
|
||||
|
||||
TEST (Buffer_RowsCache_MultiLineEdits_StayConsistent)
|
||||
TEST(Buffer_RowsCache_MultiLineEdits_StayConsistent)
|
||||
{
|
||||
Buffer b;
|
||||
std::string model;
|
||||
@@ -139,4 +139,4 @@ TEST (Buffer_RowsCache_MultiLineEdits_StayConsistent)
|
||||
}
|
||||
}
|
||||
check_buffer_matches_model(b, model);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
using ktet::TestHarness;
|
||||
|
||||
|
||||
TEST (CommandSemantics_KillToEOL_KillChain_And_Yank)
|
||||
TEST(CommandSemantics_KillToEOL_KillChain_And_Yank)
|
||||
{
|
||||
TestHarness h;
|
||||
Editor &ed = h.EditorRef();
|
||||
@@ -34,7 +34,7 @@ TEST (CommandSemantics_KillToEOL_KillChain_And_Yank)
|
||||
}
|
||||
|
||||
|
||||
TEST (CommandSemantics_ToggleMark_JumpToMark)
|
||||
TEST(CommandSemantics_ToggleMark_JumpToMark)
|
||||
{
|
||||
TestHarness h;
|
||||
Buffer &b = h.Buf();
|
||||
@@ -59,7 +59,7 @@ TEST (CommandSemantics_ToggleMark_JumpToMark)
|
||||
}
|
||||
|
||||
|
||||
TEST (CommandSemantics_CtrlGRefresh_ClearsMark_WhenNothingElseToCancel)
|
||||
TEST(CommandSemantics_CtrlGRefresh_ClearsMark_WhenNothingElseToCancel)
|
||||
{
|
||||
TestHarness h;
|
||||
Buffer &b = h.Buf();
|
||||
@@ -78,7 +78,7 @@ TEST (CommandSemantics_CtrlGRefresh_ClearsMark_WhenNothingElseToCancel)
|
||||
}
|
||||
|
||||
|
||||
TEST (CommandSemantics_CopyRegion_And_KillRegion)
|
||||
TEST(CommandSemantics_CopyRegion_And_KillRegion)
|
||||
{
|
||||
TestHarness h;
|
||||
Editor &ed = h.EditorRef();
|
||||
@@ -107,4 +107,4 @@ TEST (CommandSemantics_CopyRegion_And_KillRegion)
|
||||
ASSERT_EQ(ed.KillRingHead(), std::string("world"));
|
||||
ASSERT_EQ(b.MarkSet(), false);
|
||||
ASSERT_EQ(h.Text(), std::string("hello "));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
#include "tests/TestHarness.h"
|
||||
|
||||
|
||||
TEST (DailyDriverHarness_Smoke_CanCreateBufferAndInsertText)
|
||||
TEST(DailyDriverHarness_Smoke_CanCreateBufferAndInsertText)
|
||||
{
|
||||
ktet::TestHarness h;
|
||||
|
||||
ASSERT_TRUE(h.InsertText("hello"));
|
||||
ASSERT_EQ(h.Line(0), std::string("hello"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ buffer_bytes_via_views(const Buffer &b)
|
||||
}
|
||||
|
||||
|
||||
TEST (DailyWorkflow_OpenEditSave_Transcript)
|
||||
TEST(DailyWorkflow_OpenEditSave_Transcript)
|
||||
{
|
||||
ktet::InstallDefaultCommandsOnce();
|
||||
|
||||
@@ -77,7 +77,7 @@ TEST (DailyWorkflow_OpenEditSave_Transcript)
|
||||
}
|
||||
|
||||
|
||||
TEST (DailyWorkflow_MultiBufferSwitchClose_Transcript)
|
||||
TEST(DailyWorkflow_MultiBufferSwitchClose_Transcript)
|
||||
{
|
||||
ktet::InstallDefaultCommandsOnce();
|
||||
|
||||
@@ -123,7 +123,7 @@ TEST (DailyWorkflow_MultiBufferSwitchClose_Transcript)
|
||||
}
|
||||
|
||||
|
||||
TEST (DailyWorkflow_CrashRecovery_SwapReplay_Transcript)
|
||||
TEST(DailyWorkflow_CrashRecovery_SwapReplay_Transcript)
|
||||
{
|
||||
ktet::InstallDefaultCommandsOnce();
|
||||
|
||||
@@ -167,4 +167,4 @@ TEST (DailyWorkflow_CrashRecovery_SwapReplay_Transcript)
|
||||
ed.Swap()->Detach(buf);
|
||||
std::remove(path.c_str());
|
||||
std::remove(swap_path.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user