Fix outside of buffer access and add docs

This commit is contained in:
Krzosa Karol
2026-02-01 12:28:34 +01:00
parent 5198c11fc6
commit 33d623268a
2 changed files with 36 additions and 2 deletions

View File

@@ -415,8 +415,7 @@ API Int OnCharClassBoundary_GetNextWordEnd(Buffer *buffer, Int pos) {
}
API Int OnCharClassBoundary_GetPrevWordStart(Buffer *buffer, Int pos) {
pos = Clamp(pos, (Int)0, buffer->len);
Int i = pos - 1;
Int i = Clamp(pos - 1, (Int)0, buffer->len);
if (i >= 0 && GetCharClass(buffer->str[i]) == CharClass_Whitespace) {
i -= 1;

View File

@@ -217,6 +217,41 @@ bool IsOpenBoundary(char c) {
return result;
}
/*
Variables that control the default shell for '!' commands
DefaultShellWindows - "cmd"
DefaultShellUnix - "bash | sh"
Variables:
@ProjectDirectory/build/te
@(ProjectDirectory)/build/te
Start of string matchers:
! Execute with default shell
!! Execute hidden with default shell
:Command Execute editor command
:Set Special case for config stuff
http://
https://
commit
py: @todo, execute in python shell, this will use the python3 shell and pass the rest to it's stdin or maybe as a file
More comprehensive syntax for commands:
!{/usr/bin/python,Hidden,Input:Clipboard,Output:Clipboard,WorkingDirectory:@ProjectDirectory,Env:{Thing:asd}}
Otherwise it does filepath parsing:
C:/windows/path
/unix/path
./it/also/does/linenums:32:3
/as/well/as/this/format(111,1)
./thing(10)
TODO: need to add '~', but where?
TODO: on linux find shell on first command and set as default
*/
ResolvedOpen ResolveOpen(Allocator alo, Window *window, String path, ResolveOpenMeta meta) {
ResolvedOpen result = {};
path = Trim(path);