- Functions were cleaned up after mruby, which was wrong. - Becuase functions could have stored a reference to a Block which refers to mruby. - And so it would crash on release builds at exit if custom functions were used.
59 lines
1.8 KiB
C++
59 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "definitions.h"
|
|
#include "internal/buffer/buffer.h"
|
|
#include "internal/functions/functions.h"
|
|
#include "internal/functions/suffixes.h"
|
|
#include "internal/io/io.h"
|
|
#include "internal/marks/marks.h"
|
|
#include "internal/scripting/ruby.h"
|
|
#include "internal/theme/theme.h"
|
|
#include "internal/ui/command.h"
|
|
#include "internal/ui/text_mode.h"
|
|
#include "pch.h"
|
|
|
|
namespace bed {
|
|
struct BEd {
|
|
internal::scripting::RubyState mrb;
|
|
internal::trie::Trie<internal::functions::Function> functions;
|
|
internal::functions::Function no_op;
|
|
internal::functions::Function eof_op;
|
|
std::array<std::optional<internal::functions::Suffix>, 26> suffixes;
|
|
internal::theme::Theme theme;
|
|
std::unordered_map<std::string, internal::syntax::Language *> languages;
|
|
internal::io::IO io;
|
|
internal::vase::AppendStorage append{"/tmp"};
|
|
std::unordered_map<std::string, internal::buffer::Buffer *> buffers;
|
|
|
|
bool help_mode = false;
|
|
bool prompt_mode = true;
|
|
std::function<std::string(BEd &)> prompt = nullptr;
|
|
bool suppress_mode = false;
|
|
bool color_mode = false;
|
|
bool temporary_current = false;
|
|
std::string last_help = "";
|
|
std::string last_regex = "";
|
|
std::string last_symbol = "";
|
|
std::string last_replacement = "";
|
|
std::string last_shell = "";
|
|
|
|
internal::buffer::Range prev_1;
|
|
internal::buffer::Range prev_2;
|
|
internal::marks::MarksEngine marks;
|
|
|
|
BEd(std::vector<std::string> args);
|
|
~BEd();
|
|
|
|
internal::buffer::Buffer &buffer(const std::string &);
|
|
internal::buffer::Line ¤t();
|
|
internal::buffer::Range &prev();
|
|
void mark(uint8_t, internal::buffer::Line);
|
|
|
|
void print_help();
|
|
void handle(std::string_view cmd, bool eof);
|
|
void run();
|
|
void suffix_handle(char s);
|
|
bool escape_command(std::string &cmd, std::string_view filename);
|
|
};
|
|
} // namespace bed
|