Compare commits
2 Commits
20d71722ea
...
fbeb32097e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbeb32097e | ||
|
|
43a79535e8 |
@@ -39,9 +39,8 @@ The codebase includes its own:
|
|||||||
Requirements:
|
Requirements:
|
||||||
|
|
||||||
- `clang`
|
- `clang`
|
||||||
- `cmake`
|
|
||||||
- `libbacktrace`
|
- `libbacktrace`
|
||||||
- SDL3 (the build script can clone and install SDL when missing)
|
- `libsdl3`
|
||||||
|
|
||||||
Build commands:
|
Build commands:
|
||||||
|
|
||||||
|
|||||||
24
build.sh
24
build.sh
@@ -9,18 +9,18 @@ if [ -v addr ]; then echo "[address sanitizer build]"; fi
|
|||||||
|
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
|
|
||||||
if [ ! -e "src/external/SDL" ]; then
|
# if [ ! -e "src/external/SDL" ]; then
|
||||||
cd src/external
|
# cd src/external
|
||||||
git clone https://github.com/libsdl-org/SDL.git
|
# git clone https://github.com/libsdl-org/SDL.git
|
||||||
cd SDL
|
# cd SDL
|
||||||
git checkout release-3.2.30
|
# git checkout release-3.2.30
|
||||||
# We need older version of SDL3 because there is a bug on wayland that
|
# # We need older version of SDL3 because there is a bug on wayland that
|
||||||
# doubles click events and it's kind of unusable
|
# # doubles click events and it's kind of unusable
|
||||||
cmake -S . -B build_linux -DSDL_PIPEWIRE=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
|
# cmake -S . -B build_linux -DSDL_PIPEWIRE=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
|
||||||
cd build_linux
|
# cd build_linux
|
||||||
sudo make -j16 install
|
# sudo make -j16 install
|
||||||
cd ../../../..
|
# cd ../../../..
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
cd build
|
cd build
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ String16 FetchFuzzyViewLoadLine(View *view) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CMD_OpenLoadWord() {
|
void CMD_OpenLoadWord() {
|
||||||
Scratch scratch;
|
|
||||||
BSet active = GetBSet(ActiveWindowID);
|
BSet active = GetBSet(ActiveWindowID);
|
||||||
For (active.view->carets) {
|
For (active.view->carets) {
|
||||||
Range range = it.range;
|
Range range = it.range;
|
||||||
|
|||||||
67
src/plugin_command_runner_window.cpp
Normal file
67
src/plugin_command_runner_window.cpp
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
WindowID CommandRunnerWindowID;
|
||||||
|
|
||||||
|
void CMD_ShowCommandRunner() {
|
||||||
|
BSet command_bar = GetBSet(CommandRunnerWindowID);
|
||||||
|
command_bar.window->visible = true;
|
||||||
|
NextActiveWindowID = command_bar.window->id;
|
||||||
|
command_bar.view->update_scroll = true;
|
||||||
|
SelectRange(command_bar.view, GetRange(command_bar.buffer));
|
||||||
|
} RegisterCommand(CMD_ShowCommandRunner, "alt-p", "Little helper window that allows you to quickly run commands");
|
||||||
|
|
||||||
|
void LayoutCommandRunnerWindow(Rect2I *rect, int16_t wx, int16_t wy) {
|
||||||
|
Unused(wy); Unused(wx);
|
||||||
|
Window *window = GetWindow(CommandRunnerWindowID);
|
||||||
|
Rect2I copy_rect = *rect;
|
||||||
|
if (!window->visible) {
|
||||||
|
rect = ©_rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
Int barsize = GetExpandingBarSize(window);
|
||||||
|
window->document_rect = window->total_rect = CutBottom(rect, barsize);
|
||||||
|
// Int barsize = Clamp((Int)window->font->line_spacing*4, (Int)0, (Int)wx - 100);
|
||||||
|
// window->document_rect = window->total_rect = CutBottom(rect, barsize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMD_OpenForRunnerWindow() {
|
||||||
|
Scratch scratch;
|
||||||
|
BSet active = GetBSet(ActiveWindowID);
|
||||||
|
BSet main = GetBSet(PrimaryWindowID);
|
||||||
|
NextActiveWindowID = main.window->id;
|
||||||
|
|
||||||
|
if (active.view->carets.len == 1 && GetSize(active.view->carets[0].range) == 0) {
|
||||||
|
String16 string = GetString(active.buffer);
|
||||||
|
string = Concat(scratch, u"!", string);
|
||||||
|
|
||||||
|
Open(string);
|
||||||
|
} else {
|
||||||
|
For (active.view->carets) {
|
||||||
|
Range range = it.range;
|
||||||
|
if (GetSize(range) == 0) {
|
||||||
|
range = EncloseLoadWord(active.buffer, GetFront(it));
|
||||||
|
}
|
||||||
|
String16 load_word = GetString(active.buffer, range);
|
||||||
|
load_word = Concat(scratch, u"!", load_word);
|
||||||
|
Open(load_word);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitCommandRunnerWindow() {
|
||||||
|
Window *window = CreateWind();
|
||||||
|
CommandRunnerWindowID = window->id;
|
||||||
|
Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectFolder, "command_runner_window"));
|
||||||
|
buffer->special = true;
|
||||||
|
View *view = CreateView(buffer->id);
|
||||||
|
view->special = true;
|
||||||
|
window->active_view = view->id;
|
||||||
|
window->draw_line_numbers = false;
|
||||||
|
window->draw_scrollbar = false;
|
||||||
|
window->secondary_window_style = true;
|
||||||
|
window->draw_line_highlight = true;
|
||||||
|
window->primary = false;
|
||||||
|
window->visible = false;
|
||||||
|
window->sync_visibility_with_focus = true;
|
||||||
|
window->lose_focus_on_escape = true;
|
||||||
|
window->jump_history = false;
|
||||||
|
AddCommand(&view->commands, "Open", OpenKeySet, CMD_OpenForRunnerWindow);
|
||||||
|
}
|
||||||
@@ -81,6 +81,7 @@
|
|||||||
#define PLUGIN_PROJECT_MANAGEMENT 1
|
#define PLUGIN_PROJECT_MANAGEMENT 1
|
||||||
#define PLUGIN_BASIC_COMMANDS 1
|
#define PLUGIN_BASIC_COMMANDS 1
|
||||||
#define PLUGIN_COMMAND_WINDOW 1
|
#define PLUGIN_COMMAND_WINDOW 1
|
||||||
|
#define PLUGIN_COMMAND_RUNNER_WINDOW 1
|
||||||
#define PLUGIN_SEARCH_WINDOW 1
|
#define PLUGIN_SEARCH_WINDOW 1
|
||||||
#define PLUGIN_STATUS_WINDOW 1
|
#define PLUGIN_STATUS_WINDOW 1
|
||||||
#define PLUGIN_BUILD_WINDOW 1
|
#define PLUGIN_BUILD_WINDOW 1
|
||||||
@@ -118,6 +119,7 @@
|
|||||||
#include "plugin_window_management.cpp"
|
#include "plugin_window_management.cpp"
|
||||||
#include "plugin_directory_navigation.cpp"
|
#include "plugin_directory_navigation.cpp"
|
||||||
#include "plugin_search_open_buffers.cpp"
|
#include "plugin_search_open_buffers.cpp"
|
||||||
|
#include "plugin_command_runner_window.cpp"
|
||||||
#include "plugin_project_management.cpp"
|
#include "plugin_project_management.cpp"
|
||||||
#include "plugin_basic_commands.cpp"
|
#include "plugin_basic_commands.cpp"
|
||||||
#include "plugin_command_window.cpp"
|
#include "plugin_command_window.cpp"
|
||||||
@@ -674,6 +676,10 @@ void LayoutWindows(int16_t wx, int16_t wy) {
|
|||||||
LayoutCommandWindow(&screen_rect, wx, wy);
|
LayoutCommandWindow(&screen_rect, wx, wy);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if PLUGIN_COMMAND_RUNNER_WINDOW
|
||||||
|
LayoutCommandRunnerWindow(&screen_rect, wx, wy);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if PLUGIN_DEBUG_WINDOW
|
#if PLUGIN_DEBUG_WINDOW
|
||||||
LayoutDebugWindow(&screen_rect, wx, wy);
|
LayoutDebugWindow(&screen_rect, wx, wy);
|
||||||
#endif
|
#endif
|
||||||
@@ -824,6 +830,9 @@ void Update(Event event) {
|
|||||||
#endif
|
#endif
|
||||||
#if PLUGIN_SEARCH_WINDOW
|
#if PLUGIN_SEARCH_WINDOW
|
||||||
SearchWindowID,
|
SearchWindowID,
|
||||||
|
#endif
|
||||||
|
#if PLUGIN_COMMAND_RUNNER_WINDOW
|
||||||
|
CommandRunnerWindowID,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
for (int i = 1; i < Lengthof(id); i += 1) {
|
for (int i = 1; i < Lengthof(id); i += 1) {
|
||||||
@@ -1140,6 +1149,10 @@ int main(int argc, char **argv, char **envp)
|
|||||||
InitCommandWindow();
|
InitCommandWindow();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if PLUGIN_COMMAND_RUNNER_WINDOW
|
||||||
|
InitCommandRunnerWindow();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if PLUGIN_DEBUG_WINDOW
|
#if PLUGIN_DEBUG_WINDOW
|
||||||
InitDebugWindow();
|
InitDebugWindow();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user