|
|
|
@@ -203,7 +203,7 @@ void ReportDebugf(const char *fmt, ...) {
|
|
|
|
RawAppendf(TraceBuffer, "%S\n", string);
|
|
|
|
RawAppendf(TraceBuffer, "%S\n", string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Command_CenterView() {
|
|
|
|
void CMD_CenterView() {
|
|
|
|
BSet set = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
BSet set = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
Caret c = set.view->carets[0];
|
|
|
|
Caret c = set.view->carets[0];
|
|
|
|
Int front = GetFront(c);
|
|
|
|
Int front = GetFront(c);
|
|
|
|
@@ -214,7 +214,7 @@ void Command_CenterView() {
|
|
|
|
if (xy.line > y) {
|
|
|
|
if (xy.line > y) {
|
|
|
|
set.view->scroll.y = (xy.line) * set.window->font->line_spacing - (size.y / 2);
|
|
|
|
set.view->scroll.y = (xy.line) * set.window->font->line_spacing - (size.y / 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} RegisterCommand(Command_CenterView, "");
|
|
|
|
} RegisterCommand(CMD_CenterView, "");
|
|
|
|
|
|
|
|
|
|
|
|
void MoveCursorByPageSize(Window *window, int direction, bool shift = false) {
|
|
|
|
void MoveCursorByPageSize(Window *window, int direction, bool shift = false) {
|
|
|
|
Assert(direction == DIR_UP || direction == DIR_DOWN);
|
|
|
|
Assert(direction == DIR_UP || direction == DIR_DOWN);
|
|
|
|
@@ -421,17 +421,17 @@ BSet ExecBuild(String cmd) {
|
|
|
|
return build;
|
|
|
|
return build;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Command_SaveAll() {
|
|
|
|
void CMD_SaveAll() {
|
|
|
|
For(Buffers) {
|
|
|
|
For(Buffers) {
|
|
|
|
// NOTE: file_mod_time is only set when buffer got read or written to disk already so should be saved
|
|
|
|
// NOTE: file_mod_time is only set when buffer got read or written to disk already so should be saved
|
|
|
|
if (it->file_mod_time) {
|
|
|
|
if (it->file_mod_time) {
|
|
|
|
SaveBuffer(it);
|
|
|
|
SaveBuffer(it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} RegisterCommand(Command_SaveAll, "ctrl-shift-s");
|
|
|
|
} RegisterCommand(CMD_SaveAll, "ctrl-shift-s");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_Build() {
|
|
|
|
void CMD_Build() {
|
|
|
|
Command_SaveAll();
|
|
|
|
CMD_SaveAll();
|
|
|
|
#if OS_WINDOWS
|
|
|
|
#if OS_WINDOWS
|
|
|
|
ExecBuild("build.bat");
|
|
|
|
ExecBuild("build.bat");
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
@@ -439,17 +439,17 @@ void Command_Build() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
BSet main = GetBSet(BuildWindowID);
|
|
|
|
BSet main = GetBSet(BuildWindowID);
|
|
|
|
main.window->visible = true;
|
|
|
|
main.window->visible = true;
|
|
|
|
} RegisterCommand(Command_Build, "f1");
|
|
|
|
} RegisterCommand(CMD_Build, "f1");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_GotoNextInList() {
|
|
|
|
void CMD_GotoNextInList() {
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
GotoNextInList(main.window, 1);
|
|
|
|
GotoNextInList(main.window, 1);
|
|
|
|
} RegisterCommand(Command_GotoNextInList, "ctrl-e");
|
|
|
|
} RegisterCommand(CMD_GotoNextInList, "ctrl-e");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_GotoPrevInList() {
|
|
|
|
void CMD_GotoPrevInList() {
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
GotoNextInList(main.window, -1);
|
|
|
|
GotoNextInList(main.window, -1);
|
|
|
|
} RegisterCommand(Command_GotoPrevInList, "alt-e");
|
|
|
|
} RegisterCommand(CMD_GotoPrevInList, "alt-e");
|
|
|
|
|
|
|
|
|
|
|
|
bool IsOpenBoundary(char c) {
|
|
|
|
bool IsOpenBoundary(char c) {
|
|
|
|
bool result = c == 0 || IsParen(c) || IsBrace(c) || c == ':' || c == '\t' || c == '\n' || c == '"' || c == '\'';
|
|
|
|
bool result = c == 0 || IsParen(c) || IsBrace(c) || c == ':' || c == '\t' || c == '\n' || c == '"' || c == '\'';
|
|
|
|
@@ -611,7 +611,7 @@ BSet Open(Window *window, String path, String meta, bool set_active = true) {
|
|
|
|
view->carets[0] = MakeCaret(pos);
|
|
|
|
view->carets[0] = MakeCaret(pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Command_CenterView();
|
|
|
|
CMD_CenterView();
|
|
|
|
} else if (o.kind == OpenKind_Exec) {
|
|
|
|
} else if (o.kind == OpenKind_Exec) {
|
|
|
|
if (set_active) {
|
|
|
|
if (set_active) {
|
|
|
|
NextActiveWindowID = set.window->id;
|
|
|
|
NextActiveWindowID = set.window->id;
|
|
|
|
@@ -644,23 +644,23 @@ BSet Open(String16 path, String meta) {
|
|
|
|
return Open(string, meta);
|
|
|
|
return Open(string, meta);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Command_Save() {
|
|
|
|
void CMD_Save() {
|
|
|
|
BSet active = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
BSet active = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
SaveBuffer(active.buffer);
|
|
|
|
SaveBuffer(active.buffer);
|
|
|
|
} RegisterCommand(Command_Save, "ctrl-s");
|
|
|
|
} RegisterCommand(CMD_Save, "ctrl-s");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_Reopen() {
|
|
|
|
void CMD_Reopen() {
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
ReopenBuffer(main.buffer);
|
|
|
|
ReopenBuffer(main.buffer);
|
|
|
|
NextActiveWindowID = main.window->id;
|
|
|
|
NextActiveWindowID = main.window->id;
|
|
|
|
} RegisterCommand(Command_Reopen, "");
|
|
|
|
} RegisterCommand(CMD_Reopen, "");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_New() {
|
|
|
|
void CMD_New() {
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
New(main.window, "");
|
|
|
|
New(main.window, "");
|
|
|
|
} RegisterCommand(Command_New, "ctrl-n");
|
|
|
|
} RegisterCommand(CMD_New, "ctrl-n");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_ToggleFullscreen() {
|
|
|
|
void CMD_ToggleFullscreen() {
|
|
|
|
if (IsInFullscreen) {
|
|
|
|
if (IsInFullscreen) {
|
|
|
|
SDL_SetWindowSize(SDLWindow, FullScreenSizeX, FullScreenSizeY);
|
|
|
|
SDL_SetWindowSize(SDLWindow, FullScreenSizeX, FullScreenSizeY);
|
|
|
|
SDL_SetWindowPosition(SDLWindow, FullScreenPositionX, FullScreenPositionY);
|
|
|
|
SDL_SetWindowPosition(SDLWindow, FullScreenPositionX, FullScreenPositionY);
|
|
|
|
@@ -675,12 +675,12 @@ void Command_ToggleFullscreen() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IsInFullscreen = !IsInFullscreen;
|
|
|
|
IsInFullscreen = !IsInFullscreen;
|
|
|
|
} RegisterCommand(Command_ToggleFullscreen, "f11");
|
|
|
|
} RegisterCommand(CMD_ToggleFullscreen, "f11");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_SetWorkDir() {
|
|
|
|
void CMD_SetWorkDir() {
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
WorkDir = GetDir(main.buffer);
|
|
|
|
WorkDir = GetDir(main.buffer);
|
|
|
|
} RegisterCommand(Command_SetWorkDir, "");
|
|
|
|
} RegisterCommand(CMD_SetWorkDir, "");
|
|
|
|
|
|
|
|
|
|
|
|
String CodeSkipPatterns[] = {".git/", ".obj", ".o", ".pdb", ".exe"};
|
|
|
|
String CodeSkipPatterns[] = {".git/", ".obj", ".o", ".pdb", ".exe"};
|
|
|
|
String Coro_OpenCodeDir;
|
|
|
|
String Coro_OpenCodeDir;
|
|
|
|
@@ -718,18 +718,18 @@ void OpenCode(String dir) {
|
|
|
|
data->dont_wait_until_resolved = true;
|
|
|
|
data->dont_wait_until_resolved = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Command_OpenCode() {
|
|
|
|
void CMD_OpenCode() {
|
|
|
|
OpenCode(WorkDir);
|
|
|
|
OpenCode(WorkDir);
|
|
|
|
} RegisterCommand(Command_OpenCode, "");
|
|
|
|
} RegisterCommand(CMD_OpenCode, "");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_KillProcess() {
|
|
|
|
void CMD_KillProcess() {
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
KillProcess(main.view);
|
|
|
|
KillProcess(main.view);
|
|
|
|
} RegisterCommand(Command_KillProcess, "");
|
|
|
|
} RegisterCommand(CMD_KillProcess, "");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_CloseWindow() {
|
|
|
|
void CMD_CloseWindow() {
|
|
|
|
Close(LastActiveLayoutWindowID);
|
|
|
|
Close(LastActiveLayoutWindowID);
|
|
|
|
} RegisterCommand(Command_CloseWindow, "");
|
|
|
|
} RegisterCommand(CMD_CloseWindow, "");
|
|
|
|
|
|
|
|
|
|
|
|
void AddHook(Array<CommandData> *arr, String name, String binding, Function *function) {
|
|
|
|
void AddHook(Array<CommandData> *arr, String name, String binding, Function *function) {
|
|
|
|
CommandData n = {name, binding, function, ParseKeyCached(binding)};
|
|
|
|
CommandData n = {name, binding, function, ParseKeyCached(binding)};
|
|
|
|
@@ -774,9 +774,9 @@ void Coro_Rename(mco_coro *co) {
|
|
|
|
buffer->name = Intern(&GlobalInternTable, string);
|
|
|
|
buffer->name = Intern(&GlobalInternTable, string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void Command_Rename() {
|
|
|
|
void CMD_Rename() {
|
|
|
|
CoAdd(Coro_Rename);
|
|
|
|
CoAdd(Coro_Rename);
|
|
|
|
} RegisterCommand(Command_Rename, "");
|
|
|
|
} RegisterCommand(CMD_Rename, "");
|
|
|
|
|
|
|
|
|
|
|
|
String Coro_YesNoCancel(mco_coro *co, BSet main, String question) {
|
|
|
|
String Coro_YesNoCancel(mco_coro *co, BSet main, String question) {
|
|
|
|
JumpTempBuffer(&main);
|
|
|
|
JumpTempBuffer(&main);
|
|
|
|
@@ -848,9 +848,9 @@ void Coro_Close(mco_coro *co) {
|
|
|
|
} ElseInvalidCodepath();
|
|
|
|
} ElseInvalidCodepath();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Command_Close() {
|
|
|
|
void CMD_Close() {
|
|
|
|
CoAdd(Coro_Close);
|
|
|
|
CoAdd(Coro_Close);
|
|
|
|
} RegisterCommand(Command_Close, "ctrl-w");
|
|
|
|
} RegisterCommand(CMD_Close, "ctrl-w");
|
|
|
|
|
|
|
|
|
|
|
|
// Considerations with coroutines:
|
|
|
|
// Considerations with coroutines:
|
|
|
|
// 1. Does scratch memory leak across Yield boundary? Or interacts badly with Yield stuff in any way?
|
|
|
|
// 1. Does scratch memory leak across Yield boundary? Or interacts badly with Yield stuff in any way?
|
|
|
|
@@ -893,322 +893,322 @@ void Coro_Quit(mco_coro *co) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Command_Quit() {
|
|
|
|
void CMD_Quit() {
|
|
|
|
CoAdd(Coro_Quit);
|
|
|
|
CoAdd(Coro_Quit);
|
|
|
|
} RegisterCommand(Command_Quit, "");
|
|
|
|
} RegisterCommand(CMD_Quit, "");
|
|
|
|
|
|
|
|
|
|
|
|
void Coro_CloseAll(mco_coro *co) {
|
|
|
|
void Coro_CloseAll(mco_coro *co) {
|
|
|
|
Coro_CloseAllEx(co);
|
|
|
|
Coro_CloseAllEx(co);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Command_CloseAll() {
|
|
|
|
void CMD_CloseAll() {
|
|
|
|
CoAdd(Coro_CloseAll);
|
|
|
|
CoAdd(Coro_CloseAll);
|
|
|
|
} RegisterCommand(Command_CloseAll, "");
|
|
|
|
} RegisterCommand(CMD_CloseAll, "");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_JumpPrev() {
|
|
|
|
void CMD_JumpPrev() {
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
JumpToLastValidView(main.window);
|
|
|
|
JumpToLastValidView(main.window);
|
|
|
|
NextActiveWindowID = main.window->id;
|
|
|
|
NextActiveWindowID = main.window->id;
|
|
|
|
} RegisterCommand(Command_JumpPrev, "ctrl-tab");
|
|
|
|
} RegisterCommand(CMD_JumpPrev, "ctrl-tab");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_Prev() {
|
|
|
|
void CMD_Prev() {
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
main.window->skip_checkpoint = true;
|
|
|
|
main.window->skip_checkpoint = true;
|
|
|
|
JumpBack(main.window);
|
|
|
|
JumpBack(main.window);
|
|
|
|
NextActiveWindowID = main.window->id;
|
|
|
|
NextActiveWindowID = main.window->id;
|
|
|
|
} RegisterCommand(Command_Prev, "alt-q | mousex1");
|
|
|
|
} RegisterCommand(CMD_Prev, "alt-q | mousex1");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_Next() {
|
|
|
|
void CMD_Next() {
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
main.window->skip_checkpoint = true;
|
|
|
|
main.window->skip_checkpoint = true;
|
|
|
|
JumpForward(main.window);
|
|
|
|
JumpForward(main.window);
|
|
|
|
NextActiveWindowID = main.window->id;
|
|
|
|
NextActiveWindowID = main.window->id;
|
|
|
|
} RegisterCommand(Command_Next, "alt-shift-q | mousex2");
|
|
|
|
} RegisterCommand(CMD_Next, "alt-shift-q | mousex2");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_OpenUpFolder() {
|
|
|
|
void CMD_OpenUpFolder() {
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
String name = ChopLastSlash(main.buffer->name);
|
|
|
|
String name = ChopLastSlash(main.buffer->name);
|
|
|
|
Open(name);
|
|
|
|
Open(name);
|
|
|
|
} RegisterCommand(Command_OpenUpFolder, "ctrl-period");
|
|
|
|
} RegisterCommand(CMD_OpenUpFolder, "ctrl-period");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_EncloseLine() {
|
|
|
|
void CMD_EncloseLine() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
EncloseLine(active.view);
|
|
|
|
EncloseLine(active.view);
|
|
|
|
} RegisterCommand(Command_EncloseLine, "ctrl-l");
|
|
|
|
} RegisterCommand(CMD_EncloseLine, "ctrl-l");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_SelectAll() {
|
|
|
|
void CMD_SelectAll() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
SelectEntireBuffer(active.view);
|
|
|
|
SelectEntireBuffer(active.view);
|
|
|
|
active.view->update_scroll = false;
|
|
|
|
active.view->update_scroll = false;
|
|
|
|
} RegisterCommand(Command_SelectAll, "ctrl-a");
|
|
|
|
} RegisterCommand(CMD_SelectAll, "ctrl-a");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_Redo() {
|
|
|
|
void CMD_Redo() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
RedoEdit(active.buffer, &active.view->carets);
|
|
|
|
RedoEdit(active.buffer, &active.view->carets);
|
|
|
|
} RegisterCommand(Command_Redo, "ctrl-shift-z");
|
|
|
|
} RegisterCommand(CMD_Redo, "ctrl-shift-z");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_Undo() {
|
|
|
|
void CMD_Undo() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
UndoEdit(active.buffer, &active.view->carets);
|
|
|
|
UndoEdit(active.buffer, &active.view->carets);
|
|
|
|
} RegisterCommand(Command_Undo, "ctrl-z");
|
|
|
|
} RegisterCommand(CMD_Undo, "ctrl-z");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MakeFontLarger() {
|
|
|
|
void CMD_MakeFontLarger() {
|
|
|
|
ConfigFontSize += 1;
|
|
|
|
ConfigFontSize += 1;
|
|
|
|
ReloadFont(ConfigFont, (U32)ConfigFontSize);
|
|
|
|
ReloadFont(ConfigFont, (U32)ConfigFontSize);
|
|
|
|
} RegisterCommand(Command_MakeFontLarger, "ctrl-equals");
|
|
|
|
} RegisterCommand(CMD_MakeFontLarger, "ctrl-equals");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MakeFontSmaller() {
|
|
|
|
void CMD_MakeFontSmaller() {
|
|
|
|
if (ConfigFontSize > 4) {
|
|
|
|
if (ConfigFontSize > 4) {
|
|
|
|
ConfigFontSize -= 1;
|
|
|
|
ConfigFontSize -= 1;
|
|
|
|
ReloadFont(ConfigFont, (U32)ConfigFontSize);
|
|
|
|
ReloadFont(ConfigFont, (U32)ConfigFontSize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} RegisterCommand(Command_MakeFontSmaller, "ctrl-minus");
|
|
|
|
} RegisterCommand(CMD_MakeFontSmaller, "ctrl-minus");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_Open() {
|
|
|
|
void CMD_Open() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
Open(FetchLoadWord(active.view));
|
|
|
|
Open(FetchLoadWord(active.view));
|
|
|
|
} RegisterCommand(Command_Open, "ctrl-q");
|
|
|
|
} RegisterCommand(CMD_Open, "ctrl-q");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_KillSelectedLines() {
|
|
|
|
void CMD_KillSelectedLines() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
KillSelectedLines(active.view);
|
|
|
|
KillSelectedLines(active.view);
|
|
|
|
} RegisterCommand(Command_KillSelectedLines, "ctrl-shift-k");
|
|
|
|
} RegisterCommand(CMD_KillSelectedLines, "ctrl-shift-k");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_IndentSelectedLines() {
|
|
|
|
void CMD_IndentSelectedLines() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
IndentSelectedLines(active.view);
|
|
|
|
IndentSelectedLines(active.view);
|
|
|
|
} RegisterCommand(Command_IndentSelectedLines, "ctrl-rightbracket | tab");
|
|
|
|
} RegisterCommand(CMD_IndentSelectedLines, "ctrl-rightbracket | tab");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_DedentSelectedLines() {
|
|
|
|
void CMD_DedentSelectedLines() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
IndentSelectedLines(active.view, true);
|
|
|
|
IndentSelectedLines(active.view, true);
|
|
|
|
} RegisterCommand(Command_DedentSelectedLines, "ctrl-leftbracket | shift-tab");
|
|
|
|
} RegisterCommand(CMD_DedentSelectedLines, "ctrl-leftbracket | shift-tab");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_DuplicateLineDown() {
|
|
|
|
void CMD_DuplicateLineDown() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
DuplicateLine(active.view, DIR_DOWN);
|
|
|
|
DuplicateLine(active.view, DIR_DOWN);
|
|
|
|
} RegisterCommand(Command_DuplicateLineDown, "ctrl-alt-down");
|
|
|
|
} RegisterCommand(CMD_DuplicateLineDown, "ctrl-alt-down");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_CreateCursorDown() {
|
|
|
|
void CMD_CreateCursorDown() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
CreateCursorVertical(active.view, DIR_DOWN);
|
|
|
|
CreateCursorVertical(active.view, DIR_DOWN);
|
|
|
|
} RegisterCommand(Command_CreateCursorDown, "alt-shift-down");
|
|
|
|
} RegisterCommand(CMD_CreateCursorDown, "alt-shift-down");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_SelectDownToEmptyLine() {
|
|
|
|
void CMD_SelectDownToEmptyLine() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_DOWN, CTRL_PRESSED, SHIFT_PRESS);
|
|
|
|
MoveCarets(active.view, DIR_DOWN, CTRL_PRESSED, SHIFT_PRESS);
|
|
|
|
} RegisterCommand(Command_SelectDownToEmptyLine, "ctrl-shift-down");
|
|
|
|
} RegisterCommand(CMD_SelectDownToEmptyLine, "ctrl-shift-down");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MoveLineDown() {
|
|
|
|
void CMD_MoveLineDown() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCaretsLine(active.view, DIR_DOWN);
|
|
|
|
MoveCaretsLine(active.view, DIR_DOWN);
|
|
|
|
} RegisterCommand(Command_MoveLineDown, "alt-down");
|
|
|
|
} RegisterCommand(CMD_MoveLineDown, "alt-down");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MoveDownToEmptyLine() {
|
|
|
|
void CMD_MoveDownToEmptyLine() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_DOWN, CTRL_PRESSED);
|
|
|
|
MoveCarets(active.view, DIR_DOWN, CTRL_PRESSED);
|
|
|
|
} RegisterCommand(Command_MoveDownToEmptyLine, "ctrl-down");
|
|
|
|
} RegisterCommand(CMD_MoveDownToEmptyLine, "ctrl-down");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_SelectDown() {
|
|
|
|
void CMD_SelectDown() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_DOWN, false, SHIFT_PRESS);
|
|
|
|
MoveCarets(active.view, DIR_DOWN, false, SHIFT_PRESS);
|
|
|
|
} RegisterCommand(Command_SelectDown, "shift-down");
|
|
|
|
} RegisterCommand(CMD_SelectDown, "shift-down");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MoveDown() {
|
|
|
|
void CMD_MoveDown() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_DOWN);
|
|
|
|
MoveCarets(active.view, DIR_DOWN);
|
|
|
|
} RegisterCommand(Command_MoveDown, "down");
|
|
|
|
} RegisterCommand(CMD_MoveDown, "down");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_DuplicateLineUp() {
|
|
|
|
void CMD_DuplicateLineUp() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
DuplicateLine(active.view, DIR_UP);
|
|
|
|
DuplicateLine(active.view, DIR_UP);
|
|
|
|
} RegisterCommand(Command_DuplicateLineUp, "ctrl-alt-up");
|
|
|
|
} RegisterCommand(CMD_DuplicateLineUp, "ctrl-alt-up");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_CreateCursorUp() {
|
|
|
|
void CMD_CreateCursorUp() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
CreateCursorVertical(active.view, DIR_UP);
|
|
|
|
CreateCursorVertical(active.view, DIR_UP);
|
|
|
|
} RegisterCommand(Command_CreateCursorUp, "alt-shift-up");
|
|
|
|
} RegisterCommand(CMD_CreateCursorUp, "alt-shift-up");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_SelectUpToEmptyLine() {
|
|
|
|
void CMD_SelectUpToEmptyLine() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_UP, CTRL_PRESSED, SHIFT_PRESS);
|
|
|
|
MoveCarets(active.view, DIR_UP, CTRL_PRESSED, SHIFT_PRESS);
|
|
|
|
} RegisterCommand(Command_SelectUpToEmptyLine, "ctrl-shift-up");
|
|
|
|
} RegisterCommand(CMD_SelectUpToEmptyLine, "ctrl-shift-up");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MoveLineUp() {
|
|
|
|
void CMD_MoveLineUp() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCaretsLine(active.view, DIR_UP);
|
|
|
|
MoveCaretsLine(active.view, DIR_UP);
|
|
|
|
} RegisterCommand(Command_MoveLineUp, "alt-up");
|
|
|
|
} RegisterCommand(CMD_MoveLineUp, "alt-up");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MoveUpToEmptyLine() {
|
|
|
|
void CMD_MoveUpToEmptyLine() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_UP, CTRL_PRESSED);
|
|
|
|
MoveCarets(active.view, DIR_UP, CTRL_PRESSED);
|
|
|
|
} RegisterCommand(Command_MoveUpToEmptyLine, "ctrl-up");
|
|
|
|
} RegisterCommand(CMD_MoveUpToEmptyLine, "ctrl-up");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_SelectUp() {
|
|
|
|
void CMD_SelectUp() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_UP, false, SHIFT_PRESS);
|
|
|
|
MoveCarets(active.view, DIR_UP, false, SHIFT_PRESS);
|
|
|
|
} RegisterCommand(Command_SelectUp, "shift-up");
|
|
|
|
} RegisterCommand(CMD_SelectUp, "shift-up");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MoveUp() {
|
|
|
|
void CMD_MoveUp() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_UP);
|
|
|
|
MoveCarets(active.view, DIR_UP);
|
|
|
|
} RegisterCommand(Command_MoveUp, "up");
|
|
|
|
} RegisterCommand(CMD_MoveUp, "up");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_BoundarySelectLeft() {
|
|
|
|
void CMD_BoundarySelectLeft() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_LEFT, CTRL_PRESSED, SHIFT_PRESS);
|
|
|
|
MoveCarets(active.view, DIR_LEFT, CTRL_PRESSED, SHIFT_PRESS);
|
|
|
|
} RegisterCommand(Command_BoundarySelectLeft, "ctrl-shift-left");
|
|
|
|
} RegisterCommand(CMD_BoundarySelectLeft, "ctrl-shift-left");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_BoundaryMoveLeft() {
|
|
|
|
void CMD_BoundaryMoveLeft() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_LEFT, CTRL_PRESSED);
|
|
|
|
MoveCarets(active.view, DIR_LEFT, CTRL_PRESSED);
|
|
|
|
} RegisterCommand(Command_BoundaryMoveLeft, "ctrl-left");
|
|
|
|
} RegisterCommand(CMD_BoundaryMoveLeft, "ctrl-left");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_SelectLeft() {
|
|
|
|
void CMD_SelectLeft() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_LEFT, false, SHIFT_PRESS);
|
|
|
|
MoveCarets(active.view, DIR_LEFT, false, SHIFT_PRESS);
|
|
|
|
} RegisterCommand(Command_SelectLeft, "shift-left");
|
|
|
|
} RegisterCommand(CMD_SelectLeft, "shift-left");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_FocusLeftWindow() {
|
|
|
|
void CMD_FocusLeftWindow() {
|
|
|
|
NextActiveWindowID = SwitchWindow(DIR_LEFT)->id;
|
|
|
|
NextActiveWindowID = SwitchWindow(DIR_LEFT)->id;
|
|
|
|
} RegisterCommand(Command_FocusLeftWindow, "alt-left");
|
|
|
|
} RegisterCommand(CMD_FocusLeftWindow, "alt-left");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MoveLeft() {
|
|
|
|
void CMD_MoveLeft() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_LEFT);
|
|
|
|
MoveCarets(active.view, DIR_LEFT);
|
|
|
|
} RegisterCommand(Command_MoveLeft, "left");
|
|
|
|
} RegisterCommand(CMD_MoveLeft, "left");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_BoundarySelectRight() {
|
|
|
|
void CMD_BoundarySelectRight() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_RIGHT, CTRL_PRESSED, SHIFT_PRESS);
|
|
|
|
MoveCarets(active.view, DIR_RIGHT, CTRL_PRESSED, SHIFT_PRESS);
|
|
|
|
} RegisterCommand(Command_BoundarySelectRight, "ctrl-shift-right");
|
|
|
|
} RegisterCommand(CMD_BoundarySelectRight, "ctrl-shift-right");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_BoundaryMoveRight() {
|
|
|
|
void CMD_BoundaryMoveRight() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_RIGHT, CTRL_PRESSED);
|
|
|
|
MoveCarets(active.view, DIR_RIGHT, CTRL_PRESSED);
|
|
|
|
} RegisterCommand(Command_BoundaryMoveRight, "ctrl-right");
|
|
|
|
} RegisterCommand(CMD_BoundaryMoveRight, "ctrl-right");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_SelectRight() {
|
|
|
|
void CMD_SelectRight() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_RIGHT, false, SHIFT_PRESS);
|
|
|
|
MoveCarets(active.view, DIR_RIGHT, false, SHIFT_PRESS);
|
|
|
|
} RegisterCommand(Command_SelectRight, "shift-right");
|
|
|
|
} RegisterCommand(CMD_SelectRight, "shift-right");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_FocusRightWindow() {
|
|
|
|
void CMD_FocusRightWindow() {
|
|
|
|
NextActiveWindowID = SwitchWindow(DIR_RIGHT)->id;
|
|
|
|
NextActiveWindowID = SwitchWindow(DIR_RIGHT)->id;
|
|
|
|
} RegisterCommand(Command_FocusRightWindow, "alt-right");
|
|
|
|
} RegisterCommand(CMD_FocusRightWindow, "alt-right");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MoveRight() {
|
|
|
|
void CMD_MoveRight() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCarets(active.view, DIR_RIGHT);
|
|
|
|
MoveCarets(active.view, DIR_RIGHT);
|
|
|
|
} RegisterCommand(Command_MoveRight, "right");
|
|
|
|
} RegisterCommand(CMD_MoveRight, "right");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MoveUpAPage() {
|
|
|
|
void CMD_MoveUpAPage() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCursorByPageSize(active.window, DIR_UP);
|
|
|
|
MoveCursorByPageSize(active.window, DIR_UP);
|
|
|
|
} RegisterCommand(Command_MoveUpAPage, "pageup");
|
|
|
|
} RegisterCommand(CMD_MoveUpAPage, "pageup");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_SelectUpPage() {
|
|
|
|
void CMD_SelectUpPage() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCursorByPageSize(active.window, DIR_UP, SHIFT_PRESS);
|
|
|
|
MoveCursorByPageSize(active.window, DIR_UP, SHIFT_PRESS);
|
|
|
|
} RegisterCommand(Command_SelectUpPage, "shift-pageup");
|
|
|
|
} RegisterCommand(CMD_SelectUpPage, "shift-pageup");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MoveToStart() {
|
|
|
|
void CMD_MoveToStart() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
SelectRange(active.view, MakeRange(0));
|
|
|
|
SelectRange(active.view, MakeRange(0));
|
|
|
|
} RegisterCommand(Command_MoveToStart, "ctrl-pageup");
|
|
|
|
} RegisterCommand(CMD_MoveToStart, "ctrl-pageup");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_SelectDownPage() {
|
|
|
|
void CMD_SelectDownPage() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCursorByPageSize(active.window, DIR_DOWN, SHIFT_PRESS);
|
|
|
|
MoveCursorByPageSize(active.window, DIR_DOWN, SHIFT_PRESS);
|
|
|
|
} RegisterCommand(Command_SelectDownPage, "shift-pagedown");
|
|
|
|
} RegisterCommand(CMD_SelectDownPage, "shift-pagedown");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MoveToEnd() {
|
|
|
|
void CMD_MoveToEnd() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
SelectRange(active.view, MakeRange(active.buffer->len));
|
|
|
|
SelectRange(active.view, MakeRange(active.buffer->len));
|
|
|
|
} RegisterCommand(Command_MoveToEnd, "ctrl-pagedown");
|
|
|
|
} RegisterCommand(CMD_MoveToEnd, "ctrl-pagedown");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MoveDownPage() {
|
|
|
|
void CMD_MoveDownPage() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCursorByPageSize(active.window, DIR_DOWN);
|
|
|
|
MoveCursorByPageSize(active.window, DIR_DOWN);
|
|
|
|
} RegisterCommand(Command_MoveDownPage, "pagedown");
|
|
|
|
} RegisterCommand(CMD_MoveDownPage, "pagedown");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_SelectToLineStart() {
|
|
|
|
void CMD_SelectToLineStart() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCursorToSide(active.view, DIR_LEFT, SHIFT_PRESS);
|
|
|
|
MoveCursorToSide(active.view, DIR_LEFT, SHIFT_PRESS);
|
|
|
|
} RegisterCommand(Command_SelectToLineStart, "shift-home");
|
|
|
|
} RegisterCommand(CMD_SelectToLineStart, "shift-home");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MoveToLineStart() {
|
|
|
|
void CMD_MoveToLineStart() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCursorToSide(active.view, DIR_LEFT);
|
|
|
|
MoveCursorToSide(active.view, DIR_LEFT);
|
|
|
|
} RegisterCommand(Command_MoveToLineStart, "home");
|
|
|
|
} RegisterCommand(CMD_MoveToLineStart, "home");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_MoveToLineEnd() {
|
|
|
|
void CMD_MoveToLineEnd() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCursorToSide(active.view, DIR_RIGHT);
|
|
|
|
MoveCursorToSide(active.view, DIR_RIGHT);
|
|
|
|
} RegisterCommand(Command_MoveToLineEnd, "end");
|
|
|
|
} RegisterCommand(CMD_MoveToLineEnd, "end");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_SelectToLineEnd() {
|
|
|
|
void CMD_SelectToLineEnd() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCursorToSide(active.view, DIR_RIGHT, SHIFT_PRESS);
|
|
|
|
MoveCursorToSide(active.view, DIR_RIGHT, SHIFT_PRESS);
|
|
|
|
} RegisterCommand(Command_SelectToLineEnd, "shift-end");
|
|
|
|
} RegisterCommand(CMD_SelectToLineEnd, "shift-end");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_Delete() {
|
|
|
|
void CMD_Delete() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
Delete(active.view, DIR_LEFT);
|
|
|
|
Delete(active.view, DIR_LEFT);
|
|
|
|
} RegisterCommand(Command_Delete, "shift-backspace | backspace");
|
|
|
|
} RegisterCommand(CMD_Delete, "shift-backspace | backspace");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_DeleteBoundary() {
|
|
|
|
void CMD_DeleteBoundary() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
Delete(active.view, DIR_LEFT, SHIFT_PRESS);
|
|
|
|
Delete(active.view, DIR_LEFT, SHIFT_PRESS);
|
|
|
|
} RegisterCommand(Command_DeleteBoundary, "ctrl-backspace");
|
|
|
|
} RegisterCommand(CMD_DeleteBoundary, "ctrl-backspace");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_DeleteForward() {
|
|
|
|
void CMD_DeleteForward() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
Delete(active.view, DIR_RIGHT);
|
|
|
|
Delete(active.view, DIR_RIGHT);
|
|
|
|
} RegisterCommand(Command_DeleteForward, "shift-delete | delete");
|
|
|
|
} RegisterCommand(CMD_DeleteForward, "shift-delete | delete");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_DeleteForwardBoundary() {
|
|
|
|
void CMD_DeleteForwardBoundary() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
Delete(active.view, DIR_RIGHT, SHIFT_PRESS);
|
|
|
|
Delete(active.view, DIR_RIGHT, SHIFT_PRESS);
|
|
|
|
} RegisterCommand(Command_DeleteForwardBoundary, "ctrl-delete");
|
|
|
|
} RegisterCommand(CMD_DeleteForwardBoundary, "ctrl-delete");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_InsertNewLineUp() {
|
|
|
|
void CMD_InsertNewLineUp() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCursorToSide(active.view, DIR_LEFT);
|
|
|
|
MoveCursorToSide(active.view, DIR_LEFT);
|
|
|
|
IdentedNewLine(active.view);
|
|
|
|
IdentedNewLine(active.view);
|
|
|
|
MoveCarets(active.view, DIR_UP);
|
|
|
|
MoveCarets(active.view, DIR_UP);
|
|
|
|
} RegisterCommand(Command_InsertNewLineUp, "ctrl-shift-enter");
|
|
|
|
} RegisterCommand(CMD_InsertNewLineUp, "ctrl-shift-enter");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_InsertNewLineDown() {
|
|
|
|
void CMD_InsertNewLineDown() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
MoveCursorToSide(active.view, DIR_RIGHT);
|
|
|
|
MoveCursorToSide(active.view, DIR_RIGHT);
|
|
|
|
IdentedNewLine(active.view);
|
|
|
|
IdentedNewLine(active.view);
|
|
|
|
} RegisterCommand(Command_InsertNewLineDown, "ctrl-enter");
|
|
|
|
} RegisterCommand(CMD_InsertNewLineDown, "ctrl-enter");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_NewLine() {
|
|
|
|
void CMD_NewLine() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
IdentedNewLine(active.view);
|
|
|
|
IdentedNewLine(active.view);
|
|
|
|
} RegisterCommand(Command_NewLine, "enter | shift-enter");
|
|
|
|
} RegisterCommand(CMD_NewLine, "enter | shift-enter");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_CreateCaretOnNextFind() {
|
|
|
|
void CMD_CreateCaretOnNextFind() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
String16 string = GetString(active.buffer, active.view->carets[0].range);
|
|
|
|
String16 string = GetString(active.buffer, active.view->carets[0].range);
|
|
|
|
Caret caret = FindNext(active.buffer, string, active.view->carets[0]);
|
|
|
|
Caret caret = FindNext(active.buffer, string, active.view->carets[0]);
|
|
|
|
Insert(&active.view->carets, caret, 0);
|
|
|
|
Insert(&active.view->carets, caret, 0);
|
|
|
|
MergeCarets(active.buffer, &active.view->carets);
|
|
|
|
MergeCarets(active.buffer, &active.view->carets);
|
|
|
|
} RegisterCommand(Command_CreateCaretOnNextFind, "ctrl-d");
|
|
|
|
} RegisterCommand(CMD_CreateCaretOnNextFind, "ctrl-d");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_FocusWindow1() {
|
|
|
|
void CMD_FocusWindow1() {
|
|
|
|
NextActiveWindowID = GetOverlappingWindow({0,0}, GetWindow(ActiveWindowID))->id;
|
|
|
|
NextActiveWindowID = GetOverlappingWindow({0,0}, GetWindow(ActiveWindowID))->id;
|
|
|
|
} RegisterCommand(Command_FocusWindow1, "ctrl-1");
|
|
|
|
} RegisterCommand(CMD_FocusWindow1, "ctrl-1");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_FocusWindow2() {
|
|
|
|
void CMD_FocusWindow2() {
|
|
|
|
Window *first = GetOverlappingWindow({0,0}, GetWindow(ActiveWindowID));
|
|
|
|
Window *first = GetOverlappingWindow({0,0}, GetWindow(ActiveWindowID));
|
|
|
|
Vec2I p = GetSideOfWindow(first, DIR_RIGHT);
|
|
|
|
Vec2I p = GetSideOfWindow(first, DIR_RIGHT);
|
|
|
|
NextActiveWindowID = GetOverlappingWindow(p, GetWindow(ActiveWindowID))->id;
|
|
|
|
NextActiveWindowID = GetOverlappingWindow(p, GetWindow(ActiveWindowID))->id;
|
|
|
|
} RegisterCommand(Command_FocusWindow2, "ctrl-2");
|
|
|
|
} RegisterCommand(CMD_FocusWindow2, "ctrl-2");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_FocusWindow3() {
|
|
|
|
void CMD_FocusWindow3() {
|
|
|
|
Window *first = GetOverlappingWindow({0,0});
|
|
|
|
Window *first = GetOverlappingWindow({0,0});
|
|
|
|
if (first) {
|
|
|
|
if (first) {
|
|
|
|
Window *second = GetOverlappingWindow(GetSideOfWindow(first, DIR_RIGHT));
|
|
|
|
Window *second = GetOverlappingWindow(GetSideOfWindow(first, DIR_RIGHT));
|
|
|
|
@@ -1219,13 +1219,13 @@ void Command_FocusWindow3() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} RegisterCommand(Command_FocusWindow3, "ctrl-3");
|
|
|
|
} RegisterCommand(CMD_FocusWindow3, "ctrl-3");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_NewWindow() {
|
|
|
|
void CMD_NewWindow() {
|
|
|
|
CreateWind();
|
|
|
|
CreateWind();
|
|
|
|
} RegisterCommand(Command_NewWindow, "ctrl-backslash");
|
|
|
|
} RegisterCommand(CMD_NewWindow, "ctrl-backslash");
|
|
|
|
|
|
|
|
|
|
|
|
void Command_ClearCarets() {
|
|
|
|
void CMD_ClearCarets() {
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
BSet active = GetBSet(ActiveWindowID);
|
|
|
|
active.view->carets.len = 1;
|
|
|
|
active.view->carets.len = 1;
|
|
|
|
active.view->carets[0] = MakeCaret(GetFront(active.view->carets[0]));
|
|
|
|
active.view->carets[0] = MakeCaret(GetFront(active.view->carets[0]));
|
|
|
|
@@ -1243,7 +1243,7 @@ void Command_ClearCarets() {
|
|
|
|
it->visible = false;
|
|
|
|
it->visible = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} RegisterCommand(Command_ClearCarets, "escape");
|
|
|
|
} RegisterCommand(CMD_ClearCarets, "escape");
|
|
|
|
|
|
|
|
|
|
|
|
void Set(String16 string) {
|
|
|
|
void Set(String16 string) {
|
|
|
|
Scratch scratch;
|
|
|
|
Scratch scratch;
|
|
|
|
@@ -1354,7 +1354,7 @@ void Set(String16 string) {
|
|
|
|
ReportErrorf("Failed to :Set, no such variable found: %S", name8);
|
|
|
|
ReportErrorf("Failed to :Set, no such variable found: %S", name8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Command_Set() {
|
|
|
|
void CMD_Set() {
|
|
|
|
BSet set = GetBSet(ActiveWindowID);
|
|
|
|
BSet set = GetBSet(ActiveWindowID);
|
|
|
|
Range range = set.view->carets[0].range;
|
|
|
|
Range range = set.view->carets[0].range;
|
|
|
|
if (GetSize(range) == 0) {
|
|
|
|
if (GetSize(range) == 0) {
|
|
|
|
@@ -1364,7 +1364,7 @@ void Command_Set() {
|
|
|
|
|
|
|
|
|
|
|
|
String16 string = GetString(set.buffer, {range.min, line_end});
|
|
|
|
String16 string = GetString(set.buffer, {range.min, line_end});
|
|
|
|
Set(string);
|
|
|
|
Set(string);
|
|
|
|
} RegisterCommand(Command_Set, "");
|
|
|
|
} RegisterCommand(CMD_Set, "");
|
|
|
|
|
|
|
|
|
|
|
|
void EvalCommandsLineByLine(Buffer *buffer) {
|
|
|
|
void EvalCommandsLineByLine(Buffer *buffer) {
|
|
|
|
for (Int i = 0; i < buffer->line_starts.len; i += 1) {
|
|
|
|
for (Int i = 0; i < buffer->line_starts.len; i += 1) {
|
|
|
|
@@ -1373,7 +1373,7 @@ void EvalCommandsLineByLine(Buffer *buffer) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Command_EvalCommandsLineByLine() {
|
|
|
|
void CMD_EvalCommandsLineByLine() {
|
|
|
|
BSet set = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
BSet set = GetBSet(LastActiveLayoutWindowID);
|
|
|
|
EvalCommandsLineByLine(set.buffer);
|
|
|
|
EvalCommandsLineByLine(set.buffer);
|
|
|
|
} RegisterCommand(Command_EvalCommandsLineByLine, "");
|
|
|
|
} RegisterCommand(CMD_EvalCommandsLineByLine, "");
|