IndentKind, config is not automatically visible on start, fix automatic ReopenBuffer
This commit is contained in:
@@ -21,6 +21,7 @@ pushd build
|
|||||||
set flags=/EHsc- /MD /Zi /FC /nologo /WX /W3 /wd4200 /wd4334 /diagnostics:column -DDEBUG_BUILD=1
|
set flags=/EHsc- /MD /Zi /FC /nologo /WX /W3 /wd4200 /wd4334 /diagnostics:column -DDEBUG_BUILD=1
|
||||||
set libs=%sdllib%/SDL3-static.lib %sdllib%/SDL_uclibc.lib kernel32.lib gdi32.lib user32.lib Imm32.lib ole32.lib Shell32.lib OleAut32.lib Cfgmgr32.lib Setupapi.lib Advapi32.lib version.lib winmm.lib
|
set libs=%sdllib%/SDL3-static.lib %sdllib%/SDL_uclibc.lib kernel32.lib gdi32.lib user32.lib Imm32.lib ole32.lib Shell32.lib OleAut32.lib Cfgmgr32.lib Setupapi.lib Advapi32.lib version.lib winmm.lib
|
||||||
cl %flags% ../src/text_editor/text_editor.cpp -Fe:te.exe -I%sdl%/include -I../src/external/glad -I../src/ %libs% -link /SUBSYSTEM:WINDOWS /NODEFAULTLIB:LIBCMT /NODEFAULTLIB:MSVCRTD
|
cl %flags% ../src/text_editor/text_editor.cpp -Fe:te.exe -I%sdl%/include -I../src/external/glad -I../src/ %libs% -link /SUBSYSTEM:WINDOWS /NODEFAULTLIB:LIBCMT /NODEFAULTLIB:MSVCRTD
|
||||||
|
copy te.exe te2.exe
|
||||||
|
|
||||||
popd
|
popd
|
||||||
rem /fsanitize=address
|
rem /fsanitize=address
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
! What precise workflow do I need for me to be viable to use this?
|
! 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?
|
! From a user (novice) point of view, how does it look like?
|
||||||
|
|
||||||
Other:
|
- We need regex for: [FormatCode matching, IsCode matching,
|
||||||
- Try out syncthing and setup the synchronized notes, maybe other things
|
- Variable documentation
|
||||||
- Write some gmail rules to forward emails from there to my proton account
|
- Project configuration (the semantics: pass through command line (don't like simply open in dir) or use command to open?)
|
||||||
- Maybe I should try out an email aggregator thing like Mozzila thunderbolt, then I will have all the data and stuff locally
|
- String16 string <<<@= GetString(buffer, pos_range_of_line); - here deleted space + 'string', seems like same behavior as lite but different from Sublie/VSCode
|
||||||
- Backup all the messages on phone using a tool
|
- IndentKind has issues with stuff still like cleaning whitespace etc.
|
||||||
- Move music and other things from phone to proton and categorize
|
|
||||||
|
|
||||||
Use session 4
|
Use session 4
|
||||||
|
- ListVariables instead of GenerateConfig, auto saving of variables
|
||||||
- Option for inserting tab instead of space
|
- Option for inserting tab instead of space
|
||||||
- Add <<File>> <<WorkDir>> template strings to Open (Then remove SEtWorkdirhere)
|
- Add <<File>> <<WorkDir>> template strings to Open (Then remove SEtWorkdirhere)
|
||||||
- :Set Filename to name current buffer ??? :O and others like that!!
|
- :Set Filename to name current buffer ??? :O and others like that!!
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ 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(Int, FontSize, 15);
|
RegisterVariable(Int, FontSize, 15);
|
||||||
RegisterVariable(String, WorkDir, "");
|
RegisterVariable(String, WorkDir, "");
|
||||||
RegisterVariable(String, Font, "");
|
RegisterVariable(String, Font, "");
|
||||||
|
|||||||
@@ -477,16 +477,6 @@ void GarbageCollect() {
|
|||||||
ProfileFunction();
|
ProfileFunction();
|
||||||
Allocator sys_allocator = GetSystemAllocator();
|
Allocator sys_allocator = GetSystemAllocator();
|
||||||
|
|
||||||
For(Buffers) {
|
|
||||||
if (it->file_mod_time) {
|
|
||||||
int64_t new_file_mod_time = GetFileModTime(it->name);
|
|
||||||
if (it->file_mod_time != new_file_mod_time) {
|
|
||||||
it->changed_on_disk = true;
|
|
||||||
if (it->dirty == false) ReopenBuffer(it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IterRemove(Views) {
|
IterRemove(Views) {
|
||||||
IterRemovePrepare(Views);
|
IterRemovePrepare(Views);
|
||||||
|
|
||||||
@@ -665,6 +655,19 @@ void Update(Event event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
For(Buffers) {
|
||||||
|
if (it->file_mod_time) {
|
||||||
|
int64_t new_file_mod_time = GetFileModTime(it->name);
|
||||||
|
if (it->file_mod_time != new_file_mod_time) {
|
||||||
|
it->changed_on_disk = true;
|
||||||
|
if (it->dirty == false) {
|
||||||
|
ReopenBuffer(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
GarbageCollect();
|
GarbageCollect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -913,10 +916,13 @@ int main(int argc, char **argv)
|
|||||||
EvalCommandsLineByLine({window, view, buffer});
|
EvalCommandsLineByLine({window, view, buffer});
|
||||||
}
|
}
|
||||||
buffer->dirty = false;
|
buffer->dirty = false;
|
||||||
|
if (window->active_view == view->id) {
|
||||||
|
window->active_view = NullViewID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ReportConsolef("WorkDir = %S", WorkDir);
|
ReportConsolef(":Set WorkDir '%S'", WorkDir);
|
||||||
if (Testing) InitTests();
|
if (Testing) InitTests();
|
||||||
#if OS_WINDOWS
|
#if OS_WINDOWS
|
||||||
CoRemove("Windows_SetupVCVarsall");
|
CoRemove("Windows_SetupVCVarsall");
|
||||||
|
|||||||
@@ -506,6 +506,30 @@ Array<Range> GetSelectedLinesSorted(Allocator allocator, View *view) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char16_t GetIndentChar() {
|
||||||
|
char16_t c = u' ';
|
||||||
|
if (IndentKind == "spaces") {
|
||||||
|
c = u' ';
|
||||||
|
} else if (IndentKind == "tabs") {
|
||||||
|
c = u'\t';
|
||||||
|
} else {
|
||||||
|
ReportErrorf("Invalid IndentKind value: %S", IndentKind);
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
String16 GetIndentString(Allocator allocator) {
|
||||||
|
char16_t *result = AllocArray(allocator, char16_t, IndentSize + 1);
|
||||||
|
char16_t c = GetIndentChar();
|
||||||
|
|
||||||
|
for (int i = 0; i < IndentSize; i += 1) {
|
||||||
|
result[i] = c;
|
||||||
|
}
|
||||||
|
result[IndentSize] = 0;
|
||||||
|
String16 res = {result, IndentSize};
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
void IndentSelectedLines(View *view, bool shift = false) {
|
void IndentSelectedLines(View *view, bool shift = false) {
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
Buffer *buffer = GetBuffer(view->active_buffer);
|
Buffer *buffer = GetBuffer(view->active_buffer);
|
||||||
@@ -513,18 +537,19 @@ void IndentSelectedLines(View *view, bool shift = false) {
|
|||||||
Array<Edit> edits = BeginEdit(scratch, buffer, view->carets);
|
Array<Edit> edits = BeginEdit(scratch, buffer, view->carets);
|
||||||
MergeCarets(buffer, &view->carets);
|
MergeCarets(buffer, &view->carets);
|
||||||
|
|
||||||
|
char16_t indent_char = GetIndentChar();
|
||||||
|
String16 indent_string = GetIndentString(scratch);
|
||||||
Array<Range> line_ranges_to_indent = GetSelectedLinesSorted(scratch, view);
|
Array<Range> line_ranges_to_indent = GetSelectedLinesSorted(scratch, view);
|
||||||
For(line_ranges_to_indent) {
|
For(line_ranges_to_indent) {
|
||||||
for (Int i = it.min; i < it.max; i += 1) {
|
for (Int i = it.min; i < it.max; i += 1) {
|
||||||
Range pos_range_of_line = GetLineRange(buffer, i);
|
Range pos_range_of_line = GetLineRange(buffer, i);
|
||||||
|
|
||||||
if (!shift) {
|
if (!shift) {
|
||||||
String16 whitespace_string = {u" ", IndentSize};
|
AddEdit(&edits, {pos_range_of_line.min, pos_range_of_line.min}, indent_string);
|
||||||
AddEdit(&edits, {pos_range_of_line.min, pos_range_of_line.min}, whitespace_string);
|
|
||||||
} else {
|
} else {
|
||||||
String16 string = GetString(buffer, pos_range_of_line);
|
String16 string = GetString(buffer, pos_range_of_line);
|
||||||
Int whitespace_len = 0;
|
Int whitespace_len = 0;
|
||||||
for (Int i = 0; i < IndentSize && i < string.len && string.data[i] == ' '; i += 1) {
|
for (Int i = 0; i < IndentSize && i < string.len && string.data[i] == indent_char; i += 1) {
|
||||||
whitespace_len += 1;
|
whitespace_len += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user