Cleanup
This commit is contained in:
@@ -7,7 +7,7 @@ Coord editor_hit_test(Editor *editor, uint32_t x, uint32_t y) {
|
||||
uint32_t numlen =
|
||||
EXTRA_META + static_cast<int>(std::log10(editor->root->line_count + 1));
|
||||
uint32_t render_width = editor->size.col - numlen;
|
||||
x = MAX(x, numlen) - numlen;
|
||||
x = MAX(x, numlen) - numlen + 1;
|
||||
uint32_t target_visual_row = y;
|
||||
uint32_t visual_row = 0;
|
||||
uint32_t line_index = editor->scroll.row;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "editor/editor.h"
|
||||
#include "io/sysio.h"
|
||||
#include "lsp/lsp.h"
|
||||
#include "scripting/decl.h"
|
||||
#include "ruby/decl.h"
|
||||
#include "ui/bar.h"
|
||||
#include "utils/utils.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "scripting/decl.h"
|
||||
#include "ruby/decl.h"
|
||||
|
||||
mrb_value get_config_file(mrb_state *mrb, mrb_value self) {
|
||||
return mrb_str_new_cstr(mrb, ruby_config_path.string().c_str());
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "io/sysio.h"
|
||||
#include "main.h"
|
||||
#include "pch.h"
|
||||
#include "scripting/decl.h"
|
||||
#include "scripting/ruby_compiled.h"
|
||||
#include "ruby/decl.h"
|
||||
#include "ruby/ruby_compiled.h"
|
||||
#include "utils/utils.h"
|
||||
|
||||
std::unordered_map<std::string, std::pair<mrb_value, mrb_value>>
|
||||
@@ -38,6 +38,14 @@ void ruby_start() {
|
||||
}
|
||||
fs::path exe_dir = get_exe_dir();
|
||||
std::vector<fs::path> candidates;
|
||||
const char *crib_config = std::getenv("CRIB_CONFIG");
|
||||
if (crib_config)
|
||||
candidates.emplace_back(fs::path(crib_config));
|
||||
const char *crib_config_dir = std::getenv("CRIB_CONFIG_DIR");
|
||||
if (crib_config_dir) {
|
||||
candidates.emplace_back(fs::path(crib_config_dir) / "crib.rb");
|
||||
candidates.emplace_back(fs::path(crib_config_dir) / "main.rb");
|
||||
}
|
||||
candidates.emplace_back("./crib.rb");
|
||||
const char *xdg = std::getenv("XDG_CONFIG_HOME");
|
||||
const char *home = std::getenv("HOME");
|
||||
@@ -45,14 +53,13 @@ void ruby_start() {
|
||||
candidates.emplace_back(fs::path(xdg) / "crib/crib.rb");
|
||||
candidates.emplace_back(fs::path(xdg) / "crib/main.rb");
|
||||
candidates.emplace_back(fs::path(xdg) / "crib.rb");
|
||||
} else if (home) {
|
||||
}
|
||||
if (home) {
|
||||
fs::path base = fs::path(home) / ".config";
|
||||
candidates.emplace_back(base / "crib/crib.rb");
|
||||
candidates.emplace_back(base / "crib/main.rb");
|
||||
candidates.emplace_back(base / "crib.rb");
|
||||
}
|
||||
candidates.emplace_back(exe_dir / "../config/main.rb");
|
||||
candidates.emplace_back(exe_dir / "../config/crib.rb");
|
||||
mrb_load_irep(mrb, _tmp___crib_precompiled_mrb);
|
||||
C_module = mrb_module_get(mrb, "C");
|
||||
setup_ruby_bindings(mrb, C_module);
|
||||
@@ -38,7 +38,7 @@ esac
|
||||
echo " freeze"
|
||||
echo "end"
|
||||
echo
|
||||
cat "$SCRIPT_DIR/../include/scripting/libcrib.rb" | sed "s/os_name_placed_here/$OS_TYPE/g"
|
||||
cat "$SCRIPT_DIR/../include/ruby/libcrib.rb" | sed "s/os_name_placed_here/$OS_TYPE/g"
|
||||
} >>"$TMP"
|
||||
|
||||
"$SCRIPT_DIR/../libs/mruby/bin/mrbc" -o$OUTPUT $TMP
|
||||
@@ -47,7 +47,7 @@ esac
|
||||
echo "#pragma once"
|
||||
xxd -i $OUTPUT | sed 's/^unsigned char /constexpr unsigned char /' |
|
||||
sed 's/^unsigned int /constexpr unsigned int /'
|
||||
} >"$SCRIPT_DIR/../include/scripting/ruby_compiled.h"
|
||||
} >"$SCRIPT_DIR/../include/ruby/ruby_compiled.h"
|
||||
|
||||
rm $TMP
|
||||
rm $OUTPUT
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "scripting/decl.h"
|
||||
#include "ruby/decl.h"
|
||||
#include "utils/utils.h"
|
||||
|
||||
std::unordered_map<std::string, Language> languages;
|
||||
|
||||
Reference in New Issue
Block a user