Compare commits
6 Commits
a7afdac4fa
...
77c6bf3da9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77c6bf3da9 | ||
|
|
565a005dcb | ||
|
|
40b15ec7aa | ||
|
|
9073909cfc | ||
|
|
cc57da69fd | ||
|
|
31ebf0bb14 |
2
config.te
Normal file
2
config.te
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
:Set FontSize 20
|
||||||
|
:Set InternetBrowser '"C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe"'
|
||||||
@@ -2,10 +2,15 @@
|
|||||||
! From a user (novice) point of view, how does it look like?
|
! From a user (novice) point of view, how does it look like?
|
||||||
|
|
||||||
- We need regex for: [FormatCode matching, IsCode matching,
|
- We need regex for: [FormatCode matching, IsCode matching,
|
||||||
- Variable documentation
|
- Project config
|
||||||
- Project configuration (the semantics: pass through command line (don't like simply open in dir) or use command to open?)
|
|
||||||
- IndentKind has issues with stuff still like cleaning whitespace etc.
|
- IndentKind has issues with stuff still like cleaning whitespace etc.
|
||||||
- Remedybg commands integrated! (like clicking f5 and opening up the window)
|
- Remedybg commands integrated! (like clicking f5 and opening up the window)
|
||||||
|
- Variable documentation ????? not looking too good due to formatting
|
||||||
|
- OnUpdate view hooks!
|
||||||
|
- JumpHistory maybe a smarter algorithm is needed, like accept only if line also changed
|
||||||
|
- Macros
|
||||||
|
- ctrl-shift-f should insert the selected into search
|
||||||
|
- jump history batching doesn't work ...
|
||||||
|
|
||||||
Use session 4
|
Use session 4
|
||||||
- ListVariables instead of GenerateConfig, auto saving of variables
|
- ListVariables instead of GenerateConfig, auto saving of variables
|
||||||
|
|||||||
@@ -423,19 +423,20 @@ API String SkipUntil(String *string, String str) {
|
|||||||
*string = Skip(*string, 1);
|
*string = Skip(*string, 1);
|
||||||
}
|
}
|
||||||
return begin;
|
return begin;
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
API String SkipWhitespace(String *string) {
|
API String SkipWhitespace(String *string) {
|
||||||
String begin = {string->data, 0};
|
String begin = {string->data, 0};
|
||||||
for (Int i = 0; i < string->len; i += 1) {
|
for (;string->len;) {
|
||||||
if (!IsWhitespace(string->data[i])) break;
|
if (!IsWhitespace(At(*string, 0))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
*string = Skip(*string, 1);
|
*string = Skip(*string, 1);
|
||||||
begin.len += 1;
|
begin.len += 1;
|
||||||
}
|
}
|
||||||
return begin;
|
return begin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
API String ChopNumberEx(String *string) {
|
API String ChopNumberEx(String *string) {
|
||||||
String col = {};
|
String col = {};
|
||||||
for (int64_t i = string->len - 1; i >= 0; i -= 1) {
|
for (int64_t i = string->len - 1; i >= 0; i -= 1) {
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ Glyph *GetGlyph(Font *font, uint32_t codepoint) {
|
|||||||
return &font->glyphs[index];
|
return &font->glyphs[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Font CreateFont(Atlas *atlas, int32_t size, String path) {
|
Font CreateFont(Atlas *atlas, int32_t size, String path) {
|
||||||
Allocator allocator = GetSystemAllocator();
|
Allocator allocator = GetSystemAllocator();
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ API Int GetWordEnd(Buffer *buffer, Int pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
API bool IsLoadWord(char16_t w) {
|
API bool IsLoadWord(char16_t w) {
|
||||||
bool result = w == u'-' || w == u'/' || w == u'\\' || w == u':' || w == u'$' || w == u'_' || w == u'.' || w == u'!' || w == u'@' || w == u',';
|
bool result = w == u'-' || w == u'/' || w == u'\\' || w == u':' || w == u'$' || w == u'_' || w == u'.' || w == u'!' || w == u'@';
|
||||||
if (!result) {
|
if (!result) {
|
||||||
result = !(IsSymbol(w) || IsWhitespace(w));
|
result = !(IsSymbol(w) || IsWhitespace(w));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -547,12 +547,11 @@ void Set(String string) {
|
|||||||
} ElseInvalidCodepath();
|
} ElseInvalidCodepath();
|
||||||
|
|
||||||
|
|
||||||
if (name == "FontSize" || name == "Font") {
|
if (name == "FontSize" || name == "PathToFont") {
|
||||||
ReloadFont(Font, (U32)FontSize);
|
ReloadFont(PathToFont, (U32)FontSize);
|
||||||
} else if (name == "WorkDir") {
|
} else if (name == "WorkDir") {
|
||||||
SetWorkDirHere(*var->string);
|
SetWorkDirHere(*var->string);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1150,13 +1149,13 @@ void CMD_Undo() {
|
|||||||
|
|
||||||
void CMD_MakeFontLarger() {
|
void CMD_MakeFontLarger() {
|
||||||
FontSize += 1;
|
FontSize += 1;
|
||||||
ReloadFont(Font, (U32)FontSize);
|
ReloadFont(PathToFont, (U32)FontSize);
|
||||||
} RegisterCommand(CMD_MakeFontLarger, "ctrl-equals", "Increase the font size");
|
} RegisterCommand(CMD_MakeFontLarger, "ctrl-equals", "Increase the font size");
|
||||||
|
|
||||||
void CMD_MakeFontSmaller() {
|
void CMD_MakeFontSmaller() {
|
||||||
if (FontSize > 4) {
|
if (FontSize > 4) {
|
||||||
FontSize -= 1;
|
FontSize -= 1;
|
||||||
ReloadFont(Font, (U32)FontSize);
|
ReloadFont(PathToFont, (U32)FontSize);
|
||||||
}
|
}
|
||||||
} RegisterCommand(CMD_MakeFontSmaller, "ctrl-minus", "Decrease the font size");
|
} RegisterCommand(CMD_MakeFontSmaller, "ctrl-minus", "Decrease the font size");
|
||||||
|
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ struct CachedTrigger {
|
|||||||
Array<CachedTrigger> CachedTriggers;
|
Array<CachedTrigger> CachedTriggers;
|
||||||
|
|
||||||
Trigger *ParseKeyCached(String key) {
|
Trigger *ParseKeyCached(String key) {
|
||||||
|
key = Trim(key);
|
||||||
if (key.len == 0) {
|
if (key.len == 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ WindowID BuildWindowID;
|
|||||||
ViewID BuildViewID;
|
ViewID BuildViewID;
|
||||||
BufferID BuildBufferID;
|
BufferID BuildBufferID;
|
||||||
BufferID SearchProjectBufferID;
|
BufferID SearchProjectBufferID;
|
||||||
|
BufferID GlobalConfigBufferID;
|
||||||
|
|
||||||
WindowID NextActiveWindowID;
|
WindowID NextActiveWindowID;
|
||||||
WindowID ActiveWindowID;
|
WindowID ActiveWindowID;
|
||||||
@@ -154,14 +155,15 @@ RegisterVariable(Int, WaitForEvents, 1);
|
|||||||
RegisterVariable(Int, DrawLineNumbers, 1);
|
RegisterVariable(Int, DrawLineNumbers, 1);
|
||||||
RegisterVariable(Int, DrawScrollbar, 1);
|
RegisterVariable(Int, DrawScrollbar, 1);
|
||||||
RegisterVariable(Int, IndentSize, 4);
|
RegisterVariable(Int, IndentSize, 4);
|
||||||
RegisterVariable(String, IndentKind, "spaces");
|
RegisterVariable(String, IndentKindWhichIsTabsOrSpaces, "spaces");
|
||||||
RegisterVariable(Int, FontSize, 15);
|
RegisterVariable(Int, FontSize, 15);
|
||||||
RegisterVariable(String, WorkDir, "");
|
RegisterVariable(String, WorkDir, "");
|
||||||
RegisterVariable(String, Font, "");
|
RegisterVariable(String, PathToFont, "");
|
||||||
RegisterVariable(String, VCVarsall, "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat");
|
RegisterVariable(String, WindowsVCVarsPathToLoadDevEnviroment, "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat");
|
||||||
RegisterVariable(Float, UndoMergeTime, 0.3);
|
RegisterVariable(Float, UndoMergeTime, 0.3);
|
||||||
RegisterVariable(Float, JumpHistoryMergeTime, 0.3);
|
RegisterVariable(Float, JumpHistoryMergeTime, 0.3);
|
||||||
RegisterVariable(String, InternetBrowser, "firefox");
|
RegisterVariable(String, InternetBrowser, "firefox");
|
||||||
RegisterVariable(String, NonCodePatterns_EndsWith, ".git/|.obj|.o|.pdb|.exe|.ilk|.ttf|.ico|.gif|.jpg|.png|.spall|.dll|.so|.a|.lib");
|
RegisterVariable(String, NonCodePatterns_EndsWith, ".git/|.obj|.o|.pdb|.exe|.ilk|.ttf|.ico|.gif|.jpg|.png|.spall|.dll|.so|.a|.lib");
|
||||||
RegisterVariable(Int, TrimTrailingWhitespace, 1);
|
RegisterVariable(Int, TrimTrailingWhitespace, 1);
|
||||||
RegisterVariable(Int, FormatCode, 0);
|
RegisterVariable(Int, FormatCode, 0);
|
||||||
|
RegisterVariable(Int, SetModifiesConfig, 1);
|
||||||
@@ -676,7 +676,7 @@ void Windows_SetupVCVarsall(mco_coro *co) {
|
|||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
String working_dir = WorkDir;
|
String working_dir = WorkDir;
|
||||||
String buffer_name = GetUniqueBufferName(working_dir, "vcvarsall-");
|
String buffer_name = GetUniqueBufferName(working_dir, "vcvarsall-");
|
||||||
String cmd = Format(scratch, "\"%S\" && set", VCVarsall);
|
String cmd = Format(scratch, "\"%S\" && set", WindowsVCVarsPathToLoadDevEnviroment);
|
||||||
view = ExecHidden(buffer_name, cmd, working_dir);
|
view = ExecHidden(buffer_name, cmd, working_dir);
|
||||||
}
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@@ -874,7 +874,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
InitBuffers();
|
InitBuffers();
|
||||||
InitRender();
|
InitRender();
|
||||||
ReloadFont(Font, (U32)FontSize);
|
ReloadFont(PathToFont, (U32)FontSize);
|
||||||
InitWindows();
|
InitWindows();
|
||||||
InitOS(ReportWarningf);
|
InitOS(ReportWarningf);
|
||||||
|
|
||||||
@@ -885,20 +885,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 1; i < argc; i += 1) {
|
for (int i = 1; i < argc; i += 1) {
|
||||||
String it = argv[i];
|
Open(argv[i]);
|
||||||
|
|
||||||
if (it == "--testing") {
|
|
||||||
Testing = true;
|
|
||||||
} else if (IsDir(it)) {
|
|
||||||
WorkDir = GetAbsolutePath(Perm, it);
|
|
||||||
OpenCode(WorkDir);
|
|
||||||
} else {
|
|
||||||
if (!FileExists(it)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Window *window = GetWindow({0});
|
|
||||||
WindowOpenBufferView(window, it);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -908,13 +895,9 @@ int main(int argc, char **argv)
|
|||||||
Window *window = GetWindow(NullWindowID);
|
Window *window = GetWindow(NullWindowID);
|
||||||
View *view = WindowOpenBufferView(window, config_path);
|
View *view = WindowOpenBufferView(window, config_path);
|
||||||
Buffer *buffer = GetBuffer(view->active_buffer);
|
Buffer *buffer = GetBuffer(view->active_buffer);
|
||||||
bool file_exists = buffer->file_mod_time != 0;
|
buffer->special = true;
|
||||||
if (!file_exists) {
|
GlobalConfigBufferID = buffer->id;
|
||||||
GenerateConfig(view);
|
|
||||||
} else {
|
|
||||||
EvalCommandsLineByLine({window, view, buffer});
|
EvalCommandsLineByLine({window, view, buffer});
|
||||||
}
|
|
||||||
buffer->dirty = false;
|
|
||||||
if (window->active_view == view->id) {
|
if (window->active_view == view->id) {
|
||||||
window->active_view = NullViewID;
|
window->active_view = NullViewID;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ struct Variable {
|
|||||||
|
|
||||||
struct Register_Variable {
|
struct Register_Variable {
|
||||||
Register_Variable(Array<Variable> *variables, VariableType type, String name, void *addr) {
|
Register_Variable(Array<Variable> *variables, VariableType type, String name, void *addr) {
|
||||||
Add(variables, {type, name, addr});
|
Add(variables, {type, name, {addr}});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#define RegisterVariable(type, name, ...) \
|
#define RegisterVariable(type, name, ...) \
|
||||||
@@ -199,6 +199,7 @@ struct ResolvedOpen {
|
|||||||
Int line, col;
|
Int line, col;
|
||||||
bool existing_buffer;
|
bool existing_buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
ResolvedOpen ResolveOpen(Allocator scratch, String path, ResolveOpenMeta meta);
|
ResolvedOpen ResolveOpen(Allocator scratch, String path, ResolveOpenMeta meta);
|
||||||
BSet Open(String path, ResolveOpenMeta meta = ResolveOpenMeta_Normal);
|
BSet Open(String path, ResolveOpenMeta meta = ResolveOpenMeta_Normal);
|
||||||
BSet Open(String16 path, ResolveOpenMeta meta = ResolveOpenMeta_Normal);
|
BSet Open(String16 path, ResolveOpenMeta meta = ResolveOpenMeta_Normal);
|
||||||
|
|||||||
@@ -508,12 +508,12 @@ Array<Range> GetSelectedLinesSorted(Allocator allocator, View *view) {
|
|||||||
|
|
||||||
char16_t GetIndentChar() {
|
char16_t GetIndentChar() {
|
||||||
char16_t c = u' ';
|
char16_t c = u' ';
|
||||||
if (IndentKind == "spaces") {
|
if (IndentKindWhichIsTabsOrSpaces == "spaces") {
|
||||||
c = u' ';
|
c = u' ';
|
||||||
} else if (IndentKind == "tabs") {
|
} else if (IndentKindWhichIsTabsOrSpaces == "tabs") {
|
||||||
c = u'\t';
|
c = u'\t';
|
||||||
} else {
|
} else {
|
||||||
ReportErrorf("Invalid IndentKind value: %S", IndentKind);
|
ReportErrorf("Invalid IndentKindWhichIsTabsOrSpaces value: %S", IndentKindWhichIsTabsOrSpaces);
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,18 @@ struct View;
|
|||||||
struct ViewID { Int id; View *o; };
|
struct ViewID { Int id; View *o; };
|
||||||
|
|
||||||
typedef void Function();
|
typedef void Function();
|
||||||
struct FunctionData { String name; Function *function; };
|
struct FunctionData {
|
||||||
struct CommandData { String name; String binding; Function *function; String doc; struct Trigger *trigger; };
|
String name;
|
||||||
|
Function *function;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CommandData {
|
||||||
|
String name;
|
||||||
|
String binding;
|
||||||
|
Function *function;
|
||||||
|
String doc;
|
||||||
|
struct Trigger *trigger;
|
||||||
|
};
|
||||||
|
|
||||||
enum ViewKind {
|
enum ViewKind {
|
||||||
ViewKind_Normal,
|
ViewKind_Normal,
|
||||||
|
|||||||
@@ -13,15 +13,49 @@ void CMD_ShowCommands() {
|
|||||||
if (it.name == "OpenCommand") {
|
if (it.name == "OpenCommand") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
RawAppendf(command_bar.buffer, "\n:%-30S <|| :Set %-30S '%-30S'", it.name, it.name, it.binding);
|
// RawAppendf(command_bar.buffer, "\n:%-30S <|| :Set %-30S '%-30S'", it.name, it.name, it.binding);
|
||||||
|
RawAppendf(command_bar.buffer, "\n:%-30S <|| ", it.name);
|
||||||
if (it.doc.len) {
|
if (it.doc.len) {
|
||||||
RawAppendf(command_bar.buffer, " |::| %S", it.doc);
|
RawAppendf(command_bar.buffer, "%S", it.doc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
command_bar.view->update_scroll = true;
|
command_bar.view->update_scroll = true;
|
||||||
SelectRange(command_bar.view, GetBufferBeginAsRange(command_bar.buffer));
|
SelectRange(command_bar.view, GetBufferBeginAsRange(command_bar.buffer));
|
||||||
} RegisterCommand(CMD_ShowCommands, "ctrl-shift-p", "List available commands and their documentation inside the command window");
|
} RegisterCommand(CMD_ShowCommands, "ctrl-shift-p", "List available commands and their documentation inside the command window");
|
||||||
|
|
||||||
|
void CMD_OpenConfig() {
|
||||||
|
Buffer *buffer = GetBuffer(GlobalConfigBufferID);
|
||||||
|
Open(buffer->name);
|
||||||
|
} RegisterCommand(CMD_OpenConfig, "", "Open the global config file");
|
||||||
|
|
||||||
|
void CMD_OpenConfigOptions() {
|
||||||
|
if (ActiveWindowID == CommandWindowID && LastExecutedManualCommand == CMD_OpenConfigOptions) {
|
||||||
|
NextActiveWindowID = PrimaryWindowID;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ProfileFunction();
|
||||||
|
|
||||||
|
BSet command_bar = GetBSet(CommandWindowID);
|
||||||
|
command_bar.window->visible = true;
|
||||||
|
NextActiveWindowID = command_bar.window->id;
|
||||||
|
ResetBuffer(command_bar.buffer);
|
||||||
|
For (Variables) {
|
||||||
|
RawAppendf(command_bar.buffer, "\n:Set %-50S ", it.name);
|
||||||
|
switch(it.type) {
|
||||||
|
case VariableType_Color: RawAppendf(command_bar.buffer, "%x", it.color->value); break;
|
||||||
|
case VariableType_String: RawAppendf(command_bar.buffer, "'%S'", *it.string); break;
|
||||||
|
case VariableType_Int: RawAppendf(command_bar.buffer, "%lld", (long long)*it.i); break;
|
||||||
|
case VariableType_Float: RawAppendf(command_bar.buffer, "%f", *it.f); break;
|
||||||
|
default: InvalidCodepath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
For (CommandFunctions) {
|
||||||
|
RawAppendf(command_bar.buffer, "\n:Set %-50S '%S'", it.name, it.binding);
|
||||||
|
}
|
||||||
|
command_bar.view->update_scroll = true;
|
||||||
|
SelectRange(command_bar.view, GetBufferBeginAsRange(command_bar.buffer));
|
||||||
|
} RegisterCommand(CMD_OpenConfigOptions, "", "List available variables and associated documentation inside the command window");
|
||||||
|
|
||||||
void CMD_ShowDebugBufferList() {
|
void CMD_ShowDebugBufferList() {
|
||||||
if (ActiveWindowID == CommandWindowID && LastExecutedManualCommand == CMD_ShowDebugBufferList) {
|
if (ActiveWindowID == CommandWindowID && LastExecutedManualCommand == CMD_ShowDebugBufferList) {
|
||||||
NextActiveWindowID = PrimaryWindowID;
|
NextActiveWindowID = PrimaryWindowID;
|
||||||
@@ -34,6 +68,10 @@ void CMD_ShowDebugBufferList() {
|
|||||||
NextActiveWindowID = command_bar.window->id;
|
NextActiveWindowID = command_bar.window->id;
|
||||||
ResetBuffer(command_bar.buffer);
|
ResetBuffer(command_bar.buffer);
|
||||||
For (Buffers) {
|
For (Buffers) {
|
||||||
|
bool is_special = it->special || it->temp || it->is_dir || it->dont_try_to_save_in_bulk_ops;
|
||||||
|
if (!is_special) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
RawAppendf(command_bar.buffer, "\n%S", it->name);
|
RawAppendf(command_bar.buffer, "\n%S", it->name);
|
||||||
}
|
}
|
||||||
command_bar.view->update_scroll = true;
|
command_bar.view->update_scroll = true;
|
||||||
@@ -52,8 +90,9 @@ void CMD_ShowBufferList() {
|
|||||||
NextActiveWindowID = command_bar.window->id;
|
NextActiveWindowID = command_bar.window->id;
|
||||||
ResetBuffer(command_bar.buffer);
|
ResetBuffer(command_bar.buffer);
|
||||||
For (Buffers) {
|
For (Buffers) {
|
||||||
if (it->special || it->temp || it->is_dir) {
|
bool is_special = it->special || it->temp || it->is_dir || it->dont_try_to_save_in_bulk_ops;
|
||||||
if (it->id != NullBufferID) continue;
|
if (is_special) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
RawAppendf(command_bar.buffer, "\n%S", it->name);
|
RawAppendf(command_bar.buffer, "\n%S", it->name);
|
||||||
}
|
}
|
||||||
@@ -148,8 +187,15 @@ struct SearchProjectParams {
|
|||||||
|
|
||||||
void Coro_SearchProject(mco_coro *co) {
|
void Coro_SearchProject(mco_coro *co) {
|
||||||
SearchProjectParams *param = (SearchProjectParams *)CoCurr->user_ctx;
|
SearchProjectParams *param = (SearchProjectParams *)CoCurr->user_ctx;
|
||||||
|
|
||||||
|
Array<BufferID> buffers = {CoCurr->arena};
|
||||||
For (Buffers) {
|
For (Buffers) {
|
||||||
if (it->special || it->is_dir || it->temp || it->dont_try_to_save_in_bulk_ops) {
|
Add(&buffers, it->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
ForItem (id, buffers) {
|
||||||
|
Buffer *it = GetBuffer(id, NULL);
|
||||||
|
if (it == NULL || it->special || it->is_dir || it->temp || it->dont_try_to_save_in_bulk_ops) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,6 +294,11 @@ void FuzzySearchViewUpdate() {
|
|||||||
|
|
||||||
void CMD_SearchProject() {
|
void CMD_SearchProject() {
|
||||||
BSet main = GetBSet(PrimaryWindowID);
|
BSet main = GetBSet(PrimaryWindowID);
|
||||||
|
String16 string = {};
|
||||||
|
if (main.view->carets.len == 1 && GetSize(main.view->carets[0]) > 0) {
|
||||||
|
string = GetString(main.buffer, main.view->carets[0].range);
|
||||||
|
}
|
||||||
|
|
||||||
NextActiveWindowID = main.window->id;
|
NextActiveWindowID = main.window->id;
|
||||||
Buffer *search_project_buffer = GetBuffer(SearchProjectBufferID);
|
Buffer *search_project_buffer = GetBuffer(SearchProjectBufferID);
|
||||||
View *view = WindowOpenBufferView(main.window, search_project_buffer->name);
|
View *view = WindowOpenBufferView(main.window, search_project_buffer->name);
|
||||||
@@ -255,6 +306,10 @@ void CMD_SearchProject() {
|
|||||||
view->kind = ViewKind_ActiveSearch;
|
view->kind = ViewKind_ActiveSearch;
|
||||||
AddHook(&view->hooks, "Open", "ctrl-q | enter", CMD_CommandWindowOpen);
|
AddHook(&view->hooks, "Open", "ctrl-q | enter", CMD_CommandWindowOpen);
|
||||||
SelectRange(view, GetLineRangeWithoutNL(search_project_buffer, 0));
|
SelectRange(view, GetLineRangeWithoutNL(search_project_buffer, 0));
|
||||||
|
if (string.len) {
|
||||||
|
Replace(view, string);
|
||||||
|
SelectEntireBuffer(view);
|
||||||
|
}
|
||||||
} RegisterCommand(CMD_SearchProject, "ctrl-shift-f", "Interactive search over the entire project in a new buffer view");
|
} RegisterCommand(CMD_SearchProject, "ctrl-shift-f", "Interactive search over the entire project in a new buffer view");
|
||||||
|
|
||||||
void SetFuzzy(View *view) {
|
void SetFuzzy(View *view) {
|
||||||
|
|||||||
Reference in New Issue
Block a user