Compare commits
4 Commits
7ae4e74f50
...
eec1e137b7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eec1e137b7 | ||
|
|
a9730924d7 | ||
|
|
88dbfb1a6c | ||
|
|
f3e709f07c |
@@ -1576,6 +1576,15 @@ void SaveBuffer(Buffer *buffer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SaveAll() {
|
||||||
|
For(Buffers) {
|
||||||
|
// 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 && it->dirty) {
|
||||||
|
SaveBuffer(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String GetDirectory(Buffer *buffer) {
|
String GetDirectory(Buffer *buffer) {
|
||||||
#if PLUGIN_DIRECTORY_NAVIGATION
|
#if PLUGIN_DIRECTORY_NAVIGATION
|
||||||
if (buffer->is_dir) {
|
if (buffer->is_dir) {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
View *GetViewForFixingWhenBufferCommand(Buffer *buffer, bool *is_active = NULL) {
|
View *GetViewForFixingWhenBufferCommand(Buffer *buffer, bool *is_active = NULL) {
|
||||||
View *view = NULL;
|
View *view = NULL;
|
||||||
if (is_active) {
|
if (is_active) {
|
||||||
@@ -176,15 +178,6 @@ void ApplyFormattingTool(Buffer *buffer, String tool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveAll() {
|
|
||||||
For(Buffers) {
|
|
||||||
// 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 && it->dirty) {
|
|
||||||
SaveBuffer(it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// @todo: plugin_languages ? and then branch out language_cpp ...
|
// @todo: plugin_languages ? and then branch out language_cpp ...
|
||||||
void CMD_FormatSelection() {
|
void CMD_FormatSelection() {
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
@@ -252,3 +245,16 @@ void CMD_OpenLogs() {
|
|||||||
void CMD_Errors() {
|
void CMD_Errors() {
|
||||||
CMD_OpenLogs();
|
CMD_OpenLogs();
|
||||||
} RegisterCommand(CMD_Errors, "", "Opens the text editor logs and clear error counter");
|
} RegisterCommand(CMD_Errors, "", "Opens the text editor logs and clear error counter");
|
||||||
|
|
||||||
|
void CheckKeybindingColission() {
|
||||||
|
ForItem (x, GlobalCommands) {
|
||||||
|
if (x.trigger == NULL) continue;
|
||||||
|
ForItem (y, GlobalCommands) {
|
||||||
|
if (y.trigger == NULL) continue;
|
||||||
|
if (&x == &y) continue;
|
||||||
|
if (x.trigger == y.trigger) {
|
||||||
|
ReportErrorf("Hotkey colission between: '%S' and '%S'", x.name, y.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,12 +27,12 @@ void CMD_KillSelectedLines() {
|
|||||||
void CMD_IndentSelectedLines() {
|
void CMD_IndentSelectedLines() {
|
||||||
BSet active = GetBSet(ActiveWindowID);
|
BSet active = GetBSet(ActiveWindowID);
|
||||||
IndentSelectedLines(active.view);
|
IndentSelectedLines(active.view);
|
||||||
} RegisterCommand(CMD_IndentSelectedLines, "ctrl-rightbracket", "");
|
} RegisterCommand(CMD_IndentSelectedLines, "ctrl-rightbracket | tab", "");
|
||||||
|
|
||||||
void CMD_DedentSelectedLines() {
|
void CMD_DedentSelectedLines() {
|
||||||
BSet active = GetBSet(ActiveWindowID);
|
BSet active = GetBSet(ActiveWindowID);
|
||||||
IndentSelectedLines(active.view, true);
|
IndentSelectedLines(active.view, true);
|
||||||
} RegisterCommand(CMD_DedentSelectedLines, "ctrl-leftbracket", "");
|
} RegisterCommand(CMD_DedentSelectedLines, "ctrl-leftbracket | shift-tab", "");
|
||||||
|
|
||||||
void CMD_DuplicateLineDown() {
|
void CMD_DuplicateLineDown() {
|
||||||
BSet active = GetBSet(ActiveWindowID);
|
BSet active = GetBSet(ActiveWindowID);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ void CMD_Build2() {
|
|||||||
|
|
||||||
void CMD_Build3() {
|
void CMD_Build3() {
|
||||||
ExecBuild(Build3OnWindows, Build3OnUnix);
|
ExecBuild(Build3OnWindows, Build3OnUnix);
|
||||||
} RegisterCommand(CMD_Build3, "f3", "Run Build3OnWindows or OnUnix in working directory, output is printed in a popup console and a special build buffer");
|
} RegisterCommand(CMD_Build3, "", "Run Build3OnWindows or OnUnix in working directory, output is printed in a popup console and a special build buffer");
|
||||||
|
|
||||||
void CMD_Build4() {
|
void CMD_Build4() {
|
||||||
ExecBuild(Build4OnWindows, Build4OnUnix);
|
ExecBuild(Build4OnWindows, Build4OnUnix);
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ void Set(String string) {
|
|||||||
if (trigger) {
|
if (trigger) {
|
||||||
cmd->binding = quote;
|
cmd->binding = quote;
|
||||||
cmd->trigger = trigger;
|
cmd->trigger = trigger;
|
||||||
|
CheckKeybindingColission();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
Int SearchBufferChangeID;
|
||||||
|
|
||||||
void CMD_Search() {
|
void CMD_Search() {
|
||||||
BSet main = GetBSet(ActiveWindowID);
|
BSet main = GetBSet(ActiveWindowID);
|
||||||
String16 string = {};
|
String16 string = {};
|
||||||
@@ -13,6 +15,7 @@ void CMD_Search() {
|
|||||||
Replace(set.view, string);
|
Replace(set.view, string);
|
||||||
SelectEntireBuffer(set.view);
|
SelectEntireBuffer(set.view);
|
||||||
}
|
}
|
||||||
|
SearchBufferChangeID = set.buffer->change_id;
|
||||||
} RegisterCommand(CMD_Search, "ctrl-f", "Open up a search window");
|
} RegisterCommand(CMD_Search, "ctrl-f", "Open up a search window");
|
||||||
|
|
||||||
void SearchWindowFindNext(bool forward = true) {
|
void SearchWindowFindNext(bool forward = true) {
|
||||||
@@ -89,7 +92,6 @@ void LayoutSearchWindow(Rect2I *rect, int16_t wx, int16_t wy) {
|
|||||||
window->line_numbers_rect = CutLeft(&window->document_rect, window->font->char_spacing * 6);
|
window->line_numbers_rect = CutLeft(&window->document_rect, window->font->char_spacing * 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
Int SearchBufferChangeID;
|
|
||||||
void UpdateSearchWindow() {
|
void UpdateSearchWindow() {
|
||||||
if (ActiveWindowID == SearchWindowID) {
|
if (ActiveWindowID == SearchWindowID) {
|
||||||
BSet active = GetBSet(ActiveWindowID);
|
BSet active = GetBSet(ActiveWindowID);
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ void CMD_WordComplete() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WordComplete(active.view, active.view->carets[0].range.min);
|
WordComplete(active.view, active.view->carets[0].range.min);
|
||||||
} RegisterCommand(CMD_WordComplete, "", "Completes the current word");
|
} RegisterCommand(CMD_WordComplete, "ctrl-space", "Completes the current word");
|
||||||
|
|
||||||
void CMD_CompletePrevWord() {
|
void CMD_CompletePrevWord() {
|
||||||
BSet active = GetBSet(ActiveWindowID);
|
BSet active = GetBSet(ActiveWindowID);
|
||||||
@@ -214,7 +214,7 @@ void CMD_CompletePrevWord() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CompletePrevWord(active.view, active.view->carets[0].range.min);
|
CompletePrevWord(active.view, active.view->carets[0].range.min);
|
||||||
} RegisterCommand(CMD_CompletePrevWord, "", "Completes the current word");
|
} RegisterCommand(CMD_CompletePrevWord, "ctrl-shift-space", "If already completing a word, iterate to previous word");
|
||||||
|
|
||||||
void CMD_CompletePrevWordOrDedent() {
|
void CMD_CompletePrevWordOrDedent() {
|
||||||
BSet active = GetBSet(ActiveWindowID);
|
BSet active = GetBSet(ActiveWindowID);
|
||||||
@@ -223,7 +223,7 @@ void CMD_CompletePrevWordOrDedent() {
|
|||||||
} else {
|
} else {
|
||||||
IndentSelectedLines(active.view, true);
|
IndentSelectedLines(active.view, true);
|
||||||
}
|
}
|
||||||
} RegisterCommand(CMD_CompletePrevWordOrDedent, "shift-tab", "Completes the current word or it indents it, when single caret with no selection it goes for word complete");
|
} RegisterCommand(CMD_CompletePrevWordOrDedent, "", "Completes the current word or it indents it, when single caret with no selection it goes for word complete");
|
||||||
|
|
||||||
void CMD_WordCompleteOrIndent() {
|
void CMD_WordCompleteOrIndent() {
|
||||||
BSet active = GetBSet(ActiveWindowID);
|
BSet active = GetBSet(ActiveWindowID);
|
||||||
@@ -232,4 +232,4 @@ void CMD_WordCompleteOrIndent() {
|
|||||||
} else {
|
} else {
|
||||||
IndentSelectedLines(active.view);
|
IndentSelectedLines(active.view);
|
||||||
}
|
}
|
||||||
} RegisterCommand(CMD_WordCompleteOrIndent, "tab", "Completes the current word or it indents it, when single caret with no selection it goes for word complete");
|
} RegisterCommand(CMD_WordCompleteOrIndent, "", "Completes the current word or it indents it, when single caret with no selection it goes for word complete");
|
||||||
@@ -1005,6 +1005,7 @@ int main(int argc, char **argv)
|
|||||||
EnterOrEscapeKeySet = ParseKeyCached("escape | enter");
|
EnterOrEscapeKeySet = ParseKeyCached("escape | enter");
|
||||||
AltEnterKeySet = ParseKeyCached("alt-enter");
|
AltEnterKeySet = ParseKeyCached("alt-enter");
|
||||||
ShiftEnterKeySet = ParseKeyCached("shift-enter");
|
ShiftEnterKeySet = ParseKeyCached("shift-enter");
|
||||||
|
CheckKeybindingColission();
|
||||||
|
|
||||||
|
|
||||||
#if PLUGIN_CONFIG
|
#if PLUGIN_CONFIG
|
||||||
|
|||||||
Reference in New Issue
Block a user