Fix Command_Open jumping to beginning every time

This commit is contained in:
Krzosa Karol
2025-05-13 09:11:42 +02:00
parent f7f2aafc56
commit 2e9147c47d
3 changed files with 11 additions and 4 deletions

View File

@@ -67,7 +67,7 @@ function IsAlpha(a)
end end
function SkipLineAndColumn(s) function SkipLineAndColumn(s)
local line, col = "1", "1" local line, col = "-1", "-1"
function parse_line_and_column(line_and_col, delimiter) function parse_line_and_column(line_and_col, delimiter)
ic, jc = line_and_col:find(delimiter) ic, jc = line_and_col:find(delimiter)

View File

@@ -381,7 +381,6 @@ function KeybindsFKeys(e)
if e.key == FKeySDLK[i] then if e.key == FKeySDLK[i] then
local cmdline = FKey[i] local cmdline = FKey[i]
if type(cmdline) == "function" then cmdline = FKey[i]() end if type(cmdline) == "function" then cmdline = FKey[i]() end
Print(cmdline)
Cmd { working_dir = GetWorkDir(), kind = "console", cmd = cmdline } Cmd { working_dir = GetWorkDir(), kind = "console", cmd = cmdline }
return true return true
end end

View File

@@ -320,8 +320,16 @@ OnOpenResult CallOnOpen(String path, String meta) {
result.cmd = cmd; result.cmd = cmd;
result.working_dir = working_dir; result.working_dir = working_dir;
result.file_path = file_path; result.file_path = file_path;
if (col_string.len) result.col = strtoll(col_string.data, NULL, 10); if (col_string.len) {
if (line_string.len) result.line = strtoll(line_string.data, NULL, 10); result.col = strtoll(col_string.data, NULL, 10);
} else {
result.col = -1;
}
if (line_string.len) {
result.line = strtoll(line_string.data, NULL, 10);
} else {
result.line = -1;
}
result.kind = kind; result.kind = kind;
return result; return result;