Compare commits

...

3 Commits

Author SHA1 Message Date
Krzosa Karol
1767b2767e SetWorkDirAt, OpenCodeAt, fix bug there, fill more doc strings 2026-01-02 19:57:53 +01:00
Krzosa Karol
215dd4a03f Layout window to PrimaryWindow, command documentation 2026-01-02 16:05:56 +01:00
Krzosa Karol
9730aa944d Expanding go to next in list functionality 2026-01-02 15:21:33 +01:00
16 changed files with 277 additions and 176 deletions

View File

@@ -1,13 +1,19 @@
! What precise workflow do I need for me to be viable to use this?
! From a user (novice) point of view, how does it look like?
Use session 4
- SkipLoadWord
- Delete file command
- :Close Fuzzy search exact match doesn't match with Close
- Maybe search everything window should have a special buffer
- Setting variables maybe should create and modify config, commit these changes immediately? So user can change keybindings in command window and commit immediately
- Make the special view hooks also available for modification and registered but maybe under different name or something
- Make a fuzzy command !> grep and fuzzy over it??? (doesn't seem very useful for grep)
- Make the equivalent of SearchProject but for cmds like !@git grep -n "@>"
- Add Bool variable
- Initialize all keybindings at the start and refer using global variables?
- RegisterCommand should_appear_in_listing variable
- RegisterCommand docs
- Maybe one list for all variables including the commands etc?
Use session 3:

View File

@@ -479,6 +479,22 @@ String16 SkipIdent(String16 *string) {
return begin;
}
String16 SkipString(String16 *string) {
String16 saved_string = *string;
char16_t c = At(*string, 0);
String16 q = {&c, 1};
if (c == u'"' || c == u'\'') {
*string = Skip(*string, 1);
String16 quote = SkipUntil(string, q);
if (At(*string, 0) != c) {
*string = saved_string;
return {};
}
return quote;
}
return {};
}
bool MatchIdent(String16 *string, String16 expect) {
String16 copy = *string;
String16 ident = SkipIdent(&copy);

View File

@@ -29,7 +29,7 @@ String GetDir(Buffer *buffer) {
}
String GetMainDir() {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
return GetDir(main.buffer);
}
@@ -42,7 +42,7 @@ void JumpTempBuffer(BSet *set, String buffer_name) {
set->buffer->temp = true;
}
void MouseLoadWord(Event event, String meta = "") {
void MouseLoadWord(Event event, ResolveOpenMeta meta = ResolveOpenMeta_Normal) {
Vec2I mouse = MouseVec2I();
BSet active = GetBSet(ActiveWindowID);
@@ -162,7 +162,7 @@ void Appendf(View *view, const char *fmt, ...) {
void UIMessagef(const char *fmt, ...) {
Scratch scratch;
STRING_FORMAT(scratch, fmt, string);
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
JumpTempBuffer(&main);
NextActiveWindowID = main.window->id;
RawAppendf(main.buffer, "\n %S\n :Close\n", string);
@@ -217,7 +217,7 @@ void CenterView(WindowID window) {
}
void CMD_CenterView() {
CenterView(LastActiveLayoutWindowID);
CenterView(PrimaryWindowID);
} RegisterCommand(CMD_CenterView, "");
void MoveCursorByPageSize(Window *window, int direction, bool shift = false) {
@@ -327,20 +327,29 @@ void GotoNextInList(Window *window, Int line_offset = 1) {
Assert(line_offset == 1 || line_offset == -1);
View *active_view = GetView(window->active_view);
View *view_goto = GetView(window->active_goto_list);
View *view_goto = GetView(window->active_goto_list);
window->active_view = view_goto->id;
Buffer *buffer_goto = GetBuffer(view_goto->active_buffer);
int64_t pos = window->goto_list_pos;
Int line = PosToLine(buffer_goto, pos);
int64_t pos = window->goto_list_pos;
Int line = PosToLine(buffer_goto, pos);
bool opened = false;
for (Int i = line + line_offset; i >= 0 && i < buffer_goto->line_starts.len; i += line_offset) {
Range line_range = GetLineRangeWithoutNL(buffer_goto, i);
String16 line = GetString(buffer_goto, line_range);
String16 line = GetString(buffer_goto, line_range);
{
Int idx = 0;
String16 delim = u"||>";
if (Seek(line, delim, &idx, SeekFlag_None)) {
line = Skip(line, idx + delim.len);
}
}
view_goto->carets[0] = MakeCaret(line_range.min);
window->goto_list_pos = line_range.min;
line = Trim(line);
line = Trim(line);
MergeCarets(buffer_goto, &view_goto->carets);
IF_DEBUG(AssertRanges(view_goto->carets));
@@ -348,11 +357,22 @@ void GotoNextInList(Window *window, Int line_offset = 1) {
continue;
}
BSet set = Open(line, "dont_error");
Buffer *active_view_buffer = GetBuffer(active_view->active_buffer);
Int p = active_view->carets[0].range.min;
Int active_view_line = PosToLine(active_view_buffer, p);
BSet set = Open(line, ResolveOpenMeta_DontError | ResolveOpenMeta_DontExec);
if (set.window == NULL) {
continue;
}
if (set.view == active_view) {
Int new_line = PosToLine(set.buffer, set.view->carets[0].range.min);
if (active_view_line == new_line) {
continue;
}
}
opened = true;
break;
}
@@ -405,7 +425,7 @@ View *ExecHidden(String buffer_name, String cmd, String working_dir) {
}
BSet Exec(String cmd, String working_dir, bool set_active = true) {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
if (set_active) {
NextActiveWindowID = main.window->id;
}
@@ -416,7 +436,7 @@ BSet Exec(String cmd, String working_dir, bool set_active = true) {
BSet ExecBuild(String cmd) {
BSet build = GetBSet(BuildWindowID);
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
SelectRange(build.view, Range{});
ResetBuffer(build.buffer);
Exec(build.view->id, true, cmd, WorkDir);
@@ -443,29 +463,29 @@ void CMD_Build() {
#endif
BSet main = GetBSet(BuildWindowID);
main.window->visible = true;
} RegisterCommand(CMD_Build, "f1");
} RegisterCommand(CMD_Build, "f1", "Run build.sh or build.bat in working directory, output is printed in a popup console and a special build buffer");
void CMD_GotoNextInList() {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
GotoNextInList(main.window, 1);
} RegisterCommand(CMD_GotoNextInList, "ctrl-e");
} RegisterCommand(CMD_GotoNextInList, "ctrl-e", "For example: when jumping from build panel to build error, a jump point is setup, user can click this button to go over to the next compiler error");
void CMD_GotoPrevInList() {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
GotoNextInList(main.window, -1);
} RegisterCommand(CMD_GotoPrevInList, "alt-e");
} RegisterCommand(CMD_GotoPrevInList, "alt-e", "For example: when jumping from build panel to build error, a jump point is setup, user can click this button to go over to the previous compiler error");
bool IsOpenBoundary(char c) {
bool result = c == 0 || IsParen(c) || IsBrace(c) || c == ':' || c == '\t' || c == '\n' || c == '"' || c == '\'';
return result;
}
ResolvedOpen ResolveOpen(Allocator alo, String path, String meta) {
ResolvedOpen ResolveOpen(Allocator alo, String path, ResolveOpenMeta meta) {
ResolvedOpen result = {};
path = Trim(path);
// Editor command
{
if(!(ResolveOpenMeta_DontExec & meta)) {
if (StartsWith(path, ":")) {
result.kind = OpenKind_Command;
path = Skip(path, 1);
@@ -481,7 +501,7 @@ ResolvedOpen ResolveOpen(Allocator alo, String path, String meta) {
}
// Shell
{
if (!(ResolveOpenMeta_DontExec & meta)) {
if (StartsWith(path, "!!")) {
result.kind = OpenKind_BackgroundExec;
result.path = Skip(path, 2);
@@ -495,7 +515,7 @@ ResolvedOpen ResolveOpen(Allocator alo, String path, String meta) {
}
// Web
{
if (!(ResolveOpenMeta_DontExec & meta)) {
if (StartsWith(path, "https://") || StartsWith(path, "http://")) {
result.path = Format(alo, "%S %S", InternetBrowser, path);
result.kind = OpenKind_BackgroundExec;
@@ -504,7 +524,7 @@ ResolvedOpen ResolveOpen(Allocator alo, String path, String meta) {
}
// Commit
{
if (!(ResolveOpenMeta_DontExec & meta)) {
if (StartsWith(path, "commit ")) {
path = Skip(path, 7);
result.path = Format(alo, "git --no-pager show %S", path);
@@ -586,7 +606,7 @@ ResolvedOpen ResolveOpen(Allocator alo, String path, String meta) {
}
if (meta == "dont_error") {
if (meta & ResolveOpenMeta_DontError) {
result.path = path;
result.kind = OpenKind_Skip;
return result;
@@ -595,7 +615,7 @@ ResolvedOpen ResolveOpen(Allocator alo, String path, String meta) {
return result;
}
BSet Open(Window *window, String path, String meta, bool set_active = true) {
BSet Open(Window *window, String path, ResolveOpenMeta meta, bool set_active = true) {
Scratch scratch;
BSet set = GetBSet(window);
ResolvedOpen o = ResolveOpen(scratch, path, meta);
@@ -643,33 +663,33 @@ BSet Open(Window *window, String path, String meta, bool set_active = true) {
return GetBSet(window);
}
BSet Open(String path, String meta) {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet Open(String path, ResolveOpenMeta meta) {
BSet main = GetBSet(PrimaryWindowID);
main = Open(main.window, path, meta);
return main;
}
BSet Open(String16 path, String meta) {
BSet Open(String16 path, ResolveOpenMeta meta) {
Scratch scratch;
String string = ToString(scratch, path);
return Open(string, meta);
}
void CMD_Save() {
BSet active = GetBSet(LastActiveLayoutWindowID);
BSet active = GetBSet(PrimaryWindowID);
SaveBuffer(active.buffer);
} RegisterCommand(CMD_Save, "ctrl-s");
} RegisterCommand(CMD_Save, "ctrl-s", "Save buffer currently open in the last primary window");
void CMD_Reopen() {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
ReopenBuffer(main.buffer);
NextActiveWindowID = main.window->id;
} RegisterCommand(CMD_Reopen, "");
void CMD_New() {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
New(main.window, "");
} RegisterCommand(CMD_New, "ctrl-n");
} RegisterCommand(CMD_New, "ctrl-n", "Open a new buffer with automatically generated name, use :Rename");
void CMD_ToggleFullscreen() {
if (IsInFullscreen) {
@@ -688,23 +708,51 @@ void CMD_ToggleFullscreen() {
IsInFullscreen = !IsInFullscreen;
} RegisterCommand(CMD_ToggleFullscreen, "f11");
void CMD_SetWorkDir() {
String16 FetchStringForCommandParsing() {
BSet set = GetBSet(ActiveWindowID);
Range range = set.view->carets[0].range;
range.max = range.min; // We only scan for :Set
if (GetSize(range) == 0) {
range = EncloseLoadWord(set.buffer, range.min);
}
Int line_end = GetLineEnd(set.buffer, range.min);
String16 string = GetString(set.buffer, {range.min, line_end});
return string;
}
void SetWorkDir(String string) {
Scratch scratch;
BSet main = GetBSet(LastActiveLayoutWindowID);
WorkDir = GetDir(main.buffer);
WorkDir = Intern(&GlobalInternTable, string);
For (Buffers) {
if (it->special) {
String name = SkipToLastSlash(it->name);
it->name = Intern(&GlobalInternTable, Format(scratch, "%S/%S", WorkDir, name));
}
}
} RegisterCommand(CMD_SetWorkDir, "");
}
void CMD_SetWorkDir() {
Scratch scratch;
BSet main = GetBSet(PrimaryWindowID);
SetWorkDir(GetDir(main.buffer));
} RegisterCommand(CMD_SetWorkDir, "", "Sets work directory to the directory of the current buffer, it also renames couple special buffers to make them accomodate the new WorkDir");
void CMD_SetWorkDirAt() {
String16 string = FetchStringForCommandParsing();
string = Skip(string, 1);
SkipIdent(&string);
SkipWhitespace(&string);
Scratch scratch;
String16 arg = SkipString(&string);
String arg8 = ToString(scratch, arg);
SetWorkDir(arg8);
} RegisterCommand(CMD_SetWorkDirAt, "", "Sets work directory using the argument string passed here, it also renames couple special buffers to make them accomodate the new WorkDir");
String Coro_OpenCodeDir;
void Coro_OpenCode(mco_coro *co) {
Array<String> patterns = Split(CoCurr->arena, NonCodePatterns_EndsWith, "|");
Array<String> dirs = {CoCurr->arena};
Add(&dirs, Coro_OpenCodeDir);
String *param_dir = (String *)CoCurr->user_ctx;
Add(&dirs, *param_dir);
for (int diri = 0; diri < dirs.len; diri += 1) {
for (FileIter it = IterateFiles(CoCurr->arena, dirs[diri]); IsValid(it); Advance(&it)) {
bool match = false;
@@ -729,33 +777,46 @@ void Coro_OpenCode(mco_coro *co) {
}
void OpenCode(String dir) {
Coro_OpenCodeDir = dir;
CoRemove("Coro_OpenCode");
CoData *data = CoAdd(Coro_OpenCode);
String *string_param = AllocType(data->arena, String);
*string_param = Copy(data->arena, dir);
data->user_ctx = string_param;
data->dont_wait_until_resolved = true;
CoResume(data);
}
void CMD_OpenCode() {
OpenCode(WorkDir);
} RegisterCommand(CMD_OpenCode, "");
} RegisterCommand(CMD_OpenCode, "", "Open all code files in current WorkDir, the code files are determined through NonCodePatterns_EndsWith config variable list");
void CMD_OpenCodeAt() {
String16 string = FetchStringForCommandParsing();
string = Skip(string, 1);
SkipIdent(&string);
SkipWhitespace(&string);
Scratch scratch;
String16 arg = SkipString(&string);
String arg8 = ToString(scratch, arg);
OpenCode(arg8);
} RegisterCommand(CMD_OpenCodeAt, "", "Open all code files pointed to by string argument following the command");
void CMD_KillProcess() {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
KillProcess(main.view);
} RegisterCommand(CMD_KillProcess, "");
} RegisterCommand(CMD_KillProcess, "", "Kill process in the last active primary window");
void CMD_CloseWindow() {
Close(LastActiveLayoutWindowID);
} RegisterCommand(CMD_CloseWindow, "");
Close(PrimaryWindowID);
} RegisterCommand(CMD_CloseWindow, "", "Close the last active primary window");
void AddHook(Array<CommandData> *arr, String name, String binding, Function *function) {
CommandData n = {name, binding, function, ParseKeyCached(binding)};
CommandData n = {name, binding, function, "Not listing hooks anywhere currently", ParseKeyCached(binding)};
Add(arr, n);
}
void Coro_Rename(mco_coro *co) {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
Buffer *buffer = main.buffer;
JumpTempBuffer(&main);
NextActiveWindowID = main.window->id;
@@ -767,7 +828,7 @@ void Coro_Rename(mco_coro *co) {
AddHook(&main.view->hooks, "Cancel", "escape", [](){BSet active = GetBSet(ActiveWindowID); active.view->hook_cmd = "Cancel";});
String result = "Cancel";
for (;;) {
if (main.window->active_view != main.view->id || (main.window->id != LastActiveLayoutWindowID && main.window->id != ActiveWindowID) || main.window->close) {
if (main.window->active_view != main.view->id || (main.window->id != PrimaryWindowID && main.window->id != ActiveWindowID) || main.window->close) {
break;
}
@@ -797,7 +858,7 @@ void CMD_Rename() {
CoRemove("Coro_Rename");
CoData *data = CoAdd(Coro_Rename);
CoResume(data);
} RegisterCommand(CMD_Rename, "");
} RegisterCommand(CMD_Rename, "", "Opens a UI asking for a new name of a buffer open in the last active primary window");
String Coro_YesNoCancel(mco_coro *co, BSet main, String question) {
JumpTempBuffer(&main);
@@ -814,7 +875,7 @@ String Coro_YesNoCancel(mco_coro *co, BSet main, String question) {
AddHook(&main.view->hooks, "Cancel", "escape", [](){BSet active = GetBSet(ActiveWindowID); active.view->hook_cmd = "Cancel";});
String result = "Cancel";
for (;;) {
if (main.window->active_view != main.view->id || (main.window->id != LastActiveLayoutWindowID && main.window->id != ActiveWindowID) || main.window->close) {
if (main.window->active_view != main.view->id || (main.window->id != PrimaryWindowID && main.window->id != ActiveWindowID) || main.window->close) {
break;
}
@@ -830,7 +891,7 @@ String Coro_YesNoCancel(mco_coro *co, BSet main, String question) {
}
void Coro_Close(mco_coro *co) {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
if (main.buffer->special || main.buffer->temp) {
Close(main.view->id);
return;
@@ -873,15 +934,14 @@ void CMD_Close() {
CoRemove("Coro_Close");
CoData *data = CoAdd(Coro_Close);
CoResume(data);
} RegisterCommand(CMD_Close, "ctrl-w");
} RegisterCommand(CMD_Close, "ctrl-w", "Close open view in the last active primary window");
// Considerations with coroutines:
// 1. Does scratch memory leak across Yield boundary? Or interacts badly with Yield stuff in any way?
// 2. Are pointers and globals correct over time? Or might they get deleted etc.
// 3. Imagine a scenario where the coroutine gets deleted before completion, will the memory leak?
String Coro_CloseAllEx(mco_coro *co) {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
Array<BufferID> buffers = {CoCurr->arena};
For (Buffers) Add(&buffers, it->id);
ForItem (id, buffers) {
@@ -921,11 +981,11 @@ void CMD_Quit() {
CoRemove("Coro_Quit");
CoData *data = CoAdd(Coro_Quit);
CoResume(data);
} RegisterCommand(CMD_Quit, "");
} RegisterCommand(CMD_Quit, "", "Ask user which files he would like to save and exit");
void CMD_QuitWithoutSaving() {
AppIsRunning = false;
} RegisterCommand(CMD_QuitWithoutSaving, "");
} RegisterCommand(CMD_QuitWithoutSaving, "", "Self explanatory");
void Coro_CloseAll(mco_coro *co) {
Coro_CloseAllEx(co);
@@ -935,71 +995,77 @@ void CMD_CloseAll() {
CoRemove("Coro_CloseAll");
CoData *data = CoAdd(Coro_CloseAll);
CoResume(data);
} RegisterCommand(CMD_CloseAll, "");
} RegisterCommand(CMD_CloseAll, "", "Ask user which files to save and close all open normal views and buffers");
void CMD_JumpPrev() {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
JumpToLastValidView(main.window);
NextActiveWindowID = main.window->id;
} RegisterCommand(CMD_JumpPrev, "ctrl-tab");
} RegisterCommand(CMD_JumpPrev, "ctrl-tab", "Go to the previous open view in primary window");
void CMD_Prev() {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
main.window->skip_checkpoint = true;
JumpBack(main.window);
NextActiveWindowID = main.window->id;
} RegisterCommand(CMD_Prev, "alt-q | mousex1");
} RegisterCommand(CMD_Prev, "alt-q | mousex1", "Go to previous position (either previous view that was open or caret position) in the primary window");
void CMD_Next() {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
main.window->skip_checkpoint = true;
JumpForward(main.window);
NextActiveWindowID = main.window->id;
} RegisterCommand(CMD_Next, "alt-shift-q | mousex2");
} RegisterCommand(CMD_Next, "alt-shift-q | mousex2", "Go to next position, after backtracking, in the primary window");
void CMD_OpenUpFolder() {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
String name = ChopLastSlash(main.buffer->name);
Open(name);
} RegisterCommand(CMD_OpenUpFolder, "ctrl-period");
} RegisterCommand(CMD_OpenUpFolder, "ctrl-period", "Open current's file directory or up directory in other cases");
void CMD_EncloseLine() {
BSet active = GetBSet(ActiveWindowID);
EncloseLine(active.view);
} RegisterCommand(CMD_EncloseLine, "ctrl-l");
} RegisterCommand(CMD_EncloseLine, "ctrl-l", "Select the entire line on which your caret is placed");
void CMD_SelectAll() {
BSet active = GetBSet(ActiveWindowID);
SelectEntireBuffer(active.view);
active.view->update_scroll = false;
} RegisterCommand(CMD_SelectAll, "ctrl-a");
} RegisterCommand(CMD_SelectAll, "ctrl-a", "Select the entire buffer");
void CMD_Redo() {
BSet active = GetBSet(ActiveWindowID);
RedoEdit(active.buffer, &active.view->carets);
} RegisterCommand(CMD_Redo, "ctrl-shift-z");
} RegisterCommand(CMD_Redo, "ctrl-shift-z", "Redo after undoing changes to the buffer");
void CMD_Undo() {
BSet active = GetBSet(ActiveWindowID);
UndoEdit(active.buffer, &active.view->carets);
} RegisterCommand(CMD_Undo, "ctrl-z");
} RegisterCommand(CMD_Undo, "ctrl-z", "Undo last change you made to the buffer");
void CMD_MakeFontLarger() {
FontSize += 1;
ReloadFont(Font, (U32)FontSize);
} RegisterCommand(CMD_MakeFontLarger, "ctrl-equals");
} RegisterCommand(CMD_MakeFontLarger, "ctrl-equals", "Increase the font size");
void CMD_MakeFontSmaller() {
if (FontSize > 4) {
FontSize -= 1;
ReloadFont(Font, (U32)FontSize);
}
} RegisterCommand(CMD_MakeFontSmaller, "ctrl-minus");
} RegisterCommand(CMD_MakeFontSmaller, "ctrl-minus", "Decrease the font size");
void CMD_Open() {
void CMD_OpenLoadWord() {
Scratch scratch;
BSet active = GetBSet(ActiveWindowID);
Open(FetchLoadWord(active.view));
} RegisterCommand(CMD_Open, "ctrl-q");
String16 load_word = FetchLoadWord(active.view);
// String load_word = ToString(scratch, load_word16);
// Window *window = GetWindow(PrimaryWindowID);
// window->active_goto_list = active.view->id;
// window->goto_list_pos = active.view->carets[0].range.min;
Open(load_word);
} RegisterCommand(CMD_OpenLoadWord, "ctrl-q", "Open a link under the caret (file link, url, command) or open the selection");
void CMD_KillSelectedLines() {
BSet active = GetBSet(ActiveWindowID);
@@ -1263,10 +1329,10 @@ void CMD_ClearCarets() {
active.view->carets[0] = MakeCaret(GetFront(active.view->carets[0]));
if (active.window->lose_focus_on_escape && active.window->id == ActiveWindowID) {
if (active.window->layout) {
if (active.window->primary) {
//
} else {
NextActiveWindowID = LastActiveLayoutWindowID;
NextActiveWindowID = PrimaryWindowID;
}
}
@@ -1275,7 +1341,7 @@ void CMD_ClearCarets() {
it->visible = false;
}
}
} RegisterCommand(CMD_ClearCarets, "escape");
} RegisterCommand(CMD_ClearCarets, "escape", "Clear all carets and reset to 1 caret, also do some windowing stuff that closes things on escape");
void Set(String16 string) {
Scratch scratch;
@@ -1407,25 +1473,17 @@ void Set(String16 string) {
}
void CMD_Set() {
BSet set = GetBSet(ActiveWindowID);
Range range = set.view->carets[0].range;
range.max = range.min; // We only scan for :Set
if (GetSize(range) == 0) {
range = EncloseLoadWord(set.buffer, range.min);
}
Int line_end = GetLineEnd(set.buffer, range.min);
String16 string = GetString(set.buffer, {range.min, line_end});
String16 string = FetchStringForCommandParsing();
Set(string);
} RegisterCommand(CMD_Set, "");
} RegisterCommand(CMD_Set, "", "Sets a named editor variable to the text argument following the command, the format is ':Set FormatCode 0'");
void EvalCommandsLineByLine(BSet set) {
WindowID save_last = LastActiveLayoutWindowID;
WindowID save_last = PrimaryWindowID;
WindowID save_active = ActiveWindowID;
WindowID save_next = NextActiveWindowID;
Caret save_caret = set.view->carets[0];
ActiveWindowID = set.window->id;
LastActiveLayoutWindowID = set.window->id;
PrimaryWindowID = set.window->id;
NextActiveWindowID = set.window->id;
for (Int i = 0; i < set.buffer->line_starts.len; i += 1) {
Int pos = GetLineRangeWithoutNL(set.buffer, i).min;
@@ -1442,29 +1500,29 @@ void EvalCommandsLineByLine(BSet set) {
Open(string);
}
set.view->carets[0] = save_caret;
LastActiveLayoutWindowID = save_last;
PrimaryWindowID = save_last;
ActiveWindowID = save_active;
NextActiveWindowID = save_next;
}
void CMD_EvalCommandsLineByLine() {
BSet set = GetBSet(LastActiveLayoutWindowID);
BSet set = GetBSet(PrimaryWindowID);
EvalCommandsLineByLine(set);
} RegisterCommand(CMD_EvalCommandsLineByLine, "");
} RegisterCommand(CMD_EvalCommandsLineByLine, "", "Goes line by line over a buffer and evaluates every line as a command, ignores empty or lines starting with '//'");
void GenerateConfig(Buffer *buffer) {
void GenerateConfig(View *view) {
For (Variables) {
if (it.type == VariableType_String) {
RawAppendf(buffer, "// :Set %S '%S'\n", it.name, *it.string);
Appendf(view, "// :Set %S '%S'\n", it.name, *it.string);
} else if (it.type == VariableType_Int) {
RawAppendf(buffer, "// :Set %S '%lld'\n", it.name, (long long)*it.i);
Appendf(view, "// :Set %S '%lld'\n", it.name, (long long)*it.i);
} else if (it.type == VariableType_Float) {
RawAppendf(buffer, "// :Set %S '%f'\n", it.name, *it.f);
Appendf(view, "// :Set %S '%f'\n", it.name, *it.f);
} else if (it.type == VariableType_Color) {
RawAppendf(buffer, "// :Set %S %x\n", it.name, it.color->value);
Appendf(view, "// :Set %S %x\n", it.name, it.color->value);
} ElseInvalidCodepath();
}
For (CommandFunctions) {
RawAppendf(buffer, "// :Set %S '%S'\n", it.name, it.binding);
Appendf(view, "// :Set %S '%S'\n", it.name, it.binding);
}
}

View File

@@ -107,7 +107,7 @@ void DrawWindow(Window *window, Event &event) {
SetScissor(screen_rect);
bool is_active = window->id == ActiveWindowID;
bool active_layed_out_doc = window->id == LastActiveLayoutWindowID;
bool active_layed_out_doc = window->id == PrimaryWindowID;
Color color_whitespace_during_selection = SelectedWhitespaceColor;
Color color_background = BackgroundColor;

View File

@@ -38,7 +38,7 @@ BufferID BuildBufferID;
WindowID NextActiveWindowID;
WindowID ActiveWindowID;
WindowID LastActiveLayoutWindowID;
WindowID PrimaryWindowID;
WindowID ScrollbarSelected = {-1};
WindowID DocumentSelected = {-1};
WindowID ResizerSelected = {-1};
@@ -160,6 +160,6 @@ RegisterVariable(String, VCVarsall, "C:/Program Files/Microsoft Visual Studio/20
RegisterVariable(Float, UndoMergeTime, 0.3);
RegisterVariable(Float, JumpHistoryMergeTime, 0.3);
RegisterVariable(String, InternetBrowser, "firefox");
RegisterVariable(String, NonCodePatterns_EndsWith, ".git/|.obj|.o|.pdb|.exe|.ilk|.ttf|.ico|.gif|.jpg|.png|.spall");
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, FormatCode, 0);

View File

@@ -88,7 +88,7 @@ void SetMouseCursor(Event event) {
if (ResizerSelected.id != -1) {
Window *window = GetWindow(ResizerSelected);
if (window->layout) {
if (window->primary) {
SetMouseCursor(SDL_SYSTEM_CURSOR_EW_RESIZE);
} else {
SetMouseCursor(SDL_SYSTEM_CURSOR_NS_RESIZE);
@@ -98,7 +98,7 @@ void SetMouseCursor(Event event) {
if (ResizerHover.id != -1) {
Window *window = GetWindow(ResizerHover);
if (window->layout) {
if (window->primary) {
SetMouseCursor(SDL_SYSTEM_CURSOR_EW_RESIZE);
} else {
SetMouseCursor(SDL_SYSTEM_CURSOR_NS_RESIZE);
@@ -256,7 +256,7 @@ void OnCommand(Event event) {
ResizerSelected.id = {-1};
} else if (ResizerSelected.id != -1) {
Window *window = GetWindow(ResizerSelected);
if (window->layout) {
if (window->primary) {
Vec2I mouse = MouseVec2I();
Int offx = mouse.x - window->resizer_rect.min.x;
window->weight += (double)offx / (double)WindowCalcEvenResizerValue(event.xwindow);
@@ -403,7 +403,7 @@ void OnCommand(Event event) {
}
}
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
BSet active = GetBSet(ActiveWindowID);
bool executed = false;
@@ -630,7 +630,7 @@ void Update(Event event) {
ActiveWindowID = NextActiveWindowID;
Window *window = GetWindow(ActiveWindowID, NULL);
if (window == NULL || window->visible == false) {
ActiveWindowID = NextActiveWindowID = LastActiveLayoutWindowID;
ActiveWindowID = NextActiveWindowID = PrimaryWindowID;
window = GetWindow(ActiveWindowID, NULL);
if (window == NULL) {
ActiveWindowID = NullWindowID;
@@ -653,10 +653,10 @@ void Update(Event event) {
}
}
if (ActiveWindowID != LastActiveLayoutWindowID) {
if (ActiveWindowID != PrimaryWindowID) {
Window *window = GetWindow(ActiveWindowID, NULL);
if (window->layout) {
LastActiveLayoutWindowID = ActiveWindowID;
if (window->primary) {
PrimaryWindowID = ActiveWindowID;
}
}
}
@@ -904,7 +904,7 @@ int main(int argc, char **argv)
Buffer *buffer = GetBuffer(view->active_buffer);
bool file_exists = buffer->file_mod_time != 0;
if (!file_exists) {
GenerateConfig(buffer);
GenerateConfig(view);
} else {
EvalCommandsLineByLine({window, view, buffer});
}

View File

@@ -75,8 +75,6 @@ float DPIScale = 1.0f;
void AfterEdit(View *view, Array<Edit> edits);
Scroller ComputeScrollerRect(Window *window);
BSet Open(String path, String meta = "");
BSet Open(String16 path, String meta = "");
void UpdateScroll(Window *window, bool update_caret_scrolling);
String GetMainDir();
@@ -136,8 +134,8 @@ struct Register_Function {
};
#define RegisterFunction(functions, name) Register_Function RF__##name(functions, #name, name)
struct Register_Command { Register_Command(Array<CommandData> *fucs, Function *function, String name, String binding) { if (StartsWith(name, "CMD_")) name = Skip(name, sizeof("CMD_") - 1); Add(fucs, {name, binding, function}); } };
#define RegisterCommand(name, binding) Register_Command RC__##name(&CommandFunctions, name, #name, binding)
struct Register_Command { Register_Command(Array<CommandData> *fucs, Function *function, String name, String binding, String doc = "") { if (StartsWith(name, "CMD_")) name = Skip(name, sizeof("CMD_") - 1); Add(fucs, {name, binding, function, doc}); } };
#define RegisterCommand(name, ...) Register_Command RC__##name(&CommandFunctions, name, #name, __VA_ARGS__)
const int DIR_RIGHT = 0;
const int DIR_LEFT = 1;
@@ -187,14 +185,24 @@ enum OpenKind {
OpenKind_Command,
};
typedef uint32_t ResolveOpenMeta;
enum {
ResolveOpenMeta_Normal = 0,
ResolveOpenMeta_DontError = 2,
ResolveOpenMeta_DontExec = 4, // dont error +
};
struct ResolvedOpen {
OpenKind kind;
String path;
Int line, col;
bool existing_buffer;
};
ResolvedOpen ResolveOpen(Allocator scratch, String path, String meta);
ResolvedOpen ResolveOpen(Allocator scratch, String path, ResolveOpenMeta meta);
BSet Open(String path, ResolveOpenMeta meta = ResolveOpenMeta_Normal);
BSet Open(String16 path, ResolveOpenMeta meta = ResolveOpenMeta_Normal);
void CenterView(WindowID window);
void TrimWhitespace(Buffer *buffer, bool trim_lines_with_caret = false);
void ApplyFormattingTool(Buffer *buffer, String tool);
void JumpTempBuffer(BSet *set, String buffer_name = "");
void JumpTempBuffer(BSet *set, String buffer_name = "");

View File

@@ -114,6 +114,26 @@ String16 FetchLoadWord(View *view) {
return string;
}
String16 FetchFuzzyViewLoadLine(View *view) {
Buffer *buffer = GetBuffer(view->active_buffer);
Range range = view->carets[0].range;
String16 string = GetString(buffer, range);
if (GetSize(range) == 0) {
Int line = PosToLine(buffer, range.min);
if (line == 0) {
line = ClampTop(1ll, buffer->line_starts.len - 1ll);
}
string = GetLineStringWithoutNL(buffer, line);
Int idx = 0;
String16 delim = u"||>";
if (Seek(string, delim, &idx, SeekFlag_None)) {
string = Skip(string, idx + delim.len);
}
}
return string;
}
void IdentedNewLine(View *view) {
Buffer *buffer = GetBuffer(view->active_buffer);
Scratch scratch;

View File

@@ -3,7 +3,7 @@ struct ViewID { Int id; View *o; };
typedef void Function();
struct FunctionData { String name; Function *function; };
struct CommandData { String name; String binding; Function *function; struct Trigger *trigger; };
struct CommandData { String name; String binding; Function *function; String doc; struct Trigger *trigger; };
enum ViewKind {
ViewKind_Normal,

View File

@@ -7,7 +7,7 @@ Window *CreateWind() {
Window *w = AllocType(allocator, Window);
w->font = &PrimaryFont;
w->visible = true;
w->layout = true;
w->primary = true;
w->draw_scrollbar = true;
w->draw_line_numbers = true;
w->draw_line_highlight = true;
@@ -134,7 +134,7 @@ double WindowCalcEvenResizerValue(Int screen_size_x, Int *out_count = NULL) {
double w = 0;
Int c = 0;
ForItem(n, Windows) {
if (n->layout) {
if (n->primary) {
w += n->weight;
c += 1;
}
@@ -162,7 +162,7 @@ void LayoutWindows(int16_t wx, int16_t wy) {
int i = 0;
ForItem(n, Windows) {
if (!n->layout) {
if (!n->primary) {
continue;
}

View File

@@ -30,7 +30,7 @@ struct Window {
uint32_t secondary_window_style : 1;
uint32_t draw_line_highlight : 1;
uint32_t visible : 1;
uint32_t layout : 1;
uint32_t primary : 1;
uint32_t close : 1;
uint32_t sync_visibility_with_focus : 1;
uint32_t lose_focus_on_escape : 1;

View File

@@ -11,7 +11,7 @@ void BuildWindowInit() {
window->active_view = view->id;
window->secondary_window_style = true;
window->draw_line_highlight = true;
window->layout = false;
window->primary = false;
window->visible = false;
window->lose_visibility_on_escape = true;
window->jump_history = false;

View File

@@ -1,6 +1,6 @@
void CMD_ShowCommands() {
if (ActiveWindowID == CommandWindowID && LastExecutedManualCommand == CMD_ShowCommands) {
NextActiveWindowID = LastActiveLayoutWindowID;
NextActiveWindowID = PrimaryWindowID;
return;
}
ProfileFunction();
@@ -13,15 +13,18 @@ void CMD_ShowCommands() {
if (it.name == "OpenCommand") {
continue;
}
RawAppendf(command_bar.buffer, "\n:%S", it.name);
RawAppendf(command_bar.buffer, "\n:%-30S <|| :Set %-30S '%-30S'", it.name, it.name, it.binding);
if (it.doc.len) {
RawAppendf(command_bar.buffer, " |::| %S", it.doc);
}
}
command_bar.view->update_scroll = true;
SelectRange(command_bar.view, GetBufferBeginAsRange(command_bar.buffer));
} RegisterCommand(CMD_ShowCommands, "ctrl-shift-p");
} RegisterCommand(CMD_ShowCommands, "ctrl-shift-p", "List available commands and their documentation inside the command window");
void CMD_ShowDebugBufferList() {
if (ActiveWindowID == CommandWindowID && LastExecutedManualCommand == CMD_ShowDebugBufferList) {
NextActiveWindowID = LastActiveLayoutWindowID;
NextActiveWindowID = PrimaryWindowID;
return;
}
ProfileFunction();
@@ -35,11 +38,11 @@ void CMD_ShowDebugBufferList() {
}
command_bar.view->update_scroll = true;
SelectRange(command_bar.view, GetBufferBeginAsRange(command_bar.buffer));
} RegisterCommand(CMD_ShowDebugBufferList, "");
} RegisterCommand(CMD_ShowDebugBufferList, "", "Show full list of buffers, including the special ones that normally just clutter list");
void CMD_ShowBufferList() {
if (ActiveWindowID == CommandWindowID && LastExecutedManualCommand == CMD_ShowBufferList) {
NextActiveWindowID = LastActiveLayoutWindowID;
NextActiveWindowID = PrimaryWindowID;
return;
}
ProfileFunction();
@@ -49,42 +52,28 @@ void CMD_ShowBufferList() {
NextActiveWindowID = command_bar.window->id;
ResetBuffer(command_bar.buffer);
For (Buffers) {
if (it->special || it->temp) {
if (it->id != NullBufferID && it->id != BuildBufferID) continue;
}
RawAppendf(command_bar.buffer, "\n%S", it->name);
}
command_bar.view->update_scroll = true;
SelectRange(command_bar.view, GetBufferBeginAsRange(command_bar.buffer));
} RegisterCommand(CMD_ShowBufferList, "ctrl-p");
} RegisterCommand(CMD_ShowBufferList, "ctrl-p", "List open buffers inside the command window that you can fuzzy search over");
void OpenCommand(BSet active) {
ProfileFunction();
Range range = active.view->carets[0].range;
String16 string = FetchLoadWord(active.view);
if (GetSize(range) == 0) {
Int line = PosToLine(active.buffer, range.min);
if (line == 0) {
line = ClampTop(1ll, active.buffer->line_starts.len - 1ll);
}
string = GetLineStringWithoutNL(active.buffer, line);
Int idx = 0;
String16 delim = u"|::|";
if (Seek(string, delim, &idx, SeekFlag_None)) {
string = Skip(string, idx + delim.len);
}
}
String16 string = FetchFuzzyViewLoadLine(active.view);
Open(string);
}
void CMD_CommandWindowOpen() {
BSet active = GetBSet(ActiveWindowID);
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
NextActiveWindowID = main.window->id;
OpenCommand(active);
String16 string = FetchFuzzyViewLoadLine(active.view);
if (active.view->kind == ViewKind_ActiveSearch) {
main.window->active_goto_list = active.view->id;
main.window->goto_list_pos = active.view->carets[0].range.min;
}
Open(string);
}
void CommandWindowLayout(Rect2I *rect, Int wx, Int wy) {
@@ -134,8 +123,9 @@ Array<FuzzyPair> FuzzySearchLines(Allocator allocator, Buffer *buffer, Int line_
String16 s = GetLineStringWithoutNL(buffer, i);
Int idx = 0;
String16 delim = u"|::|";
if (Seek(s, delim, &idx, SeekFlag_None)) {
if (Seek(s, u"||>", &idx, SeekFlag_None)) {
s = GetPrefix(s, idx);
} else if (Seek(s, u"<||", &idx, SeekFlag_None)) {
s = GetPrefix(s, idx);
}
s = Trim(s);
@@ -169,7 +159,7 @@ void Coro_SearchProject(mco_coro *co) {
Int line = PosToLine(it, pos);
String16 line_string = GetLineStringWithoutNL(it, line);
String line_string8 = ToString(scratch, line_string);
RawAppendf(out_buffer, "%-150S |::| %S:%lld\n", line_string8, it->name, (long long)line + 1);
RawAppendf(out_buffer, "%S ||> %S:%lld\n", line_string8, it->name, (long long)line + 1);
}
}
CoYield(co);
@@ -177,7 +167,7 @@ void Coro_SearchProject(mco_coro *co) {
}
void CMD_ReplaceAll() {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
String16 string = FetchLoadWord(main.view);
Scratch scratch;
Array<String16> parts = Split(scratch, string, u"@>");
@@ -197,7 +187,7 @@ void CMD_ReplaceAll() {
SelectAllOccurences(view, needle);
Replace(view, replace);
}
} RegisterCommand(CMD_ReplaceAll, "");
} RegisterCommand(CMD_ReplaceAll, "", "Search and replace over the entire project, you need to select a text with format like this 'FindAnd@>ReplaceWith' and executing the command will change all occurences of FindAnd to ReplaceWith");
void FuzzySearchViewUpdate() {
ProfileFunction();
@@ -210,6 +200,7 @@ void FuzzySearchViewUpdate() {
active.view->prev_search_line_hash = hash;
if (line_string.len > 0) {
// @todo: do we reintroduce history here?
Caret caret = active.view->carets[0];
SelectEntireBuffer(active.view);
Replace(active.view, line_string);
Append(active.view, "\n", false);
@@ -222,6 +213,8 @@ void FuzzySearchViewUpdate() {
dat->user_ctx = param;
dat->dont_wait_until_resolved = true;
CoResume(dat);
active.view->carets[0] = caret;
}
}
} else if (active.view->kind == ViewKind_FuzzySearch) {
@@ -251,13 +244,13 @@ void FuzzySearchViewUpdate() {
}
void CMD_SearchProject() {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
JumpTempBuffer(&main);
NextActiveWindowID = main.window->id;
main.view->kind = ViewKind_ActiveSearch;
AddHook(&main.view->hooks, "Open", "ctrl-q | enter", CMD_CommandWindowOpen);
main.buffer->no_history = true;
} RegisterCommand(CMD_SearchProject, "ctrl-shift-f");
} RegisterCommand(CMD_SearchProject, "ctrl-shift-f", "Interactive search over the entire project in a new buffer view");
void SetFuzzy(View *view) {
view->kind = ViewKind_FuzzySearch;
@@ -278,7 +271,7 @@ void CommandWindowInit() {
window->draw_scrollbar = false;
window->secondary_window_style = true;
window->draw_line_highlight = true;
window->layout = false;
window->primary = false;
window->visible = false;
window->sync_visibility_with_focus = true;
window->lose_focus_on_escape = true;

View File

@@ -5,7 +5,7 @@ void DebugWindowInit() {
window->draw_scrollbar = false;
window->visible = false;
window->z = 2;
window->layout = false;
window->primary = false;
window->jump_history = false;
Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(WorkDir, "debug"));
@@ -43,7 +43,7 @@ void DebugWindowUpdate() {
return;
}
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
Scratch scratch;
String s = Format(scratch, "wid: %d\nvid: %d\nbid: %d\nframe: %lld\n", (int)main.window->id.id, (int)main.view->id.id, (int)main.buffer->id.id, (long long)FrameID);
@@ -82,4 +82,4 @@ void DebugWindowUpdate() {
void CMD_ToggleDebug() {
Window *window = GetWindow(DebugWindowID);
window->visible = !window->visible;
} RegisterCommand(CMD_ToggleDebug, "ctrl-0");
} RegisterCommand(CMD_ToggleDebug, "ctrl-0", "Open a floating window that might become useful for debugging");

View File

@@ -12,15 +12,15 @@ void CMD_Search() {
Replace(set.view, string);
SelectEntireBuffer(set.view);
}
} RegisterCommand(CMD_Search, "ctrl-f");
} RegisterCommand(CMD_Search, "ctrl-f", "Open up a search window");
void SearchWindowFindNext(bool forward = true) {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
BSet set = GetBSet(SearchWindowID);
String16 seek = GetString(set.buffer, GetRange(set.buffer));
Find(main.view, seek, forward);
main.window->search_bar_anchor = main.view->carets[0];
CenterView(LastActiveLayoutWindowID);
CenterView(PrimaryWindowID);
}
void CMD_SearchNextInSearch() {
@@ -33,32 +33,32 @@ void CMD_SearchPrevInSearch() {
void CMD_SearchNext() {
SearchWindowFindNext(true);
} RegisterCommand(CMD_SearchNext, "f3");
} RegisterCommand(CMD_SearchNext, "f3", "Go to the next occurence of the search window needle");
void CMD_SearchPrev() {
SearchWindowFindNext(false);
} RegisterCommand(CMD_SearchPrev, "shift-f3");
} RegisterCommand(CMD_SearchPrev, "shift-f3", "Go to the previous occurence of the search window needle");
void CMD_SearchAll() {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
BSet set = GetBSet(SearchWindowID);
String16 needle = GetString(set.buffer, GetRange(set.buffer));
SelectAllOccurences(main.view, needle);
set.window->visible = false;
} RegisterCommand(CMD_SearchAll, "alt-f3");
} RegisterCommand(CMD_SearchAll, "alt-f3", "Use the search window needle and seek all the possible occurences in current buffer");
void CMD_ToggleCaseSensitiveSearch() {
SearchCaseSensitive = !SearchCaseSensitive;
} RegisterCommand(CMD_ToggleCaseSensitiveSearch, "alt-c");
} RegisterCommand(CMD_ToggleCaseSensitiveSearch, "alt-c", "Text editor wide search toggle, should apply to most search things");
void CMD_ToggleSearchWordBoundary() {
SearchWordBoundary = !SearchWordBoundary;
} RegisterCommand(CMD_ToggleSearchWordBoundary, "alt-w");
} RegisterCommand(CMD_ToggleSearchWordBoundary, "alt-w", "Text editor wide search toggle, should apply to most search things");
void SearchWindowUpdate() {
BSet active = GetBSet(ActiveWindowID);
if (active.window->id == SearchWindowID && active.buffer->begin_frame_change_id != active.buffer->change_id) {
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
BSet set = GetBSet(SearchWindowID);
main.view->carets[0] = main.window->search_bar_anchor;
String16 seek = GetString(set.buffer, GetRange(set.buffer));
@@ -92,7 +92,7 @@ void SearchWindowInit() {
window->draw_scrollbar = false;
window->secondary_window_style = true;
window->draw_line_highlight = false;
window->layout = false;
window->primary = false;
window->visible = false;
window->lose_visibility_on_escape = true;
window->jump_history = false;

View File

@@ -11,7 +11,7 @@ void StatusWindowInit() {
window->draw_scrollbar = false;
window->draw_line_highlight = true;
window->secondary_window_style = true;
window->layout = false;
window->primary = false;
window->jump_history = false;
window->lose_focus_on_escape = true;
}
@@ -30,7 +30,7 @@ void StatusWindowUpdate() {
ProfileFunction();
Window *status_bar_window = GetWindow(StatusBarWindowID, NULL);
Scratch scratch;
BSet main = GetBSet(LastActiveLayoutWindowID);
BSet main = GetBSet(PrimaryWindowID);
BSet title = GetBSet(status_bar_window);
title.view->scroll.y = 0;