Skip to content

Commit

Permalink
fix Yuescript traceback rewrite issue, fix character '\t' display.
Browse files Browse the repository at this point in the history
  • Loading branch information
pigpigyyy committed Apr 25, 2024
1 parent 9418fc3 commit 104b7e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Source/3rdParty/yuescript/stacktraceplus.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
R"lua_codes(
--[[
Copyright (c) 2010 Ignacio Burgueño, modified by Li Jin
Copyright (c) 2010 Ignacio Burgueño, modified by Li Jin, 2024

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -335,7 +335,7 @@ local function getYueLineNumber(fname, line)
end
if file_exist then
local codes = yue.read_file(file_path)
local yueFile = codes:match("^%s*--%s*%[.*%]:%s*([^\n]*)")
local yueFile = codes:match("^%s*%-%-%s*%[[^%]]*%]:%s*([^\n]*)")
if yueFile then
fname = yueFile:gsub("^%s*(.-)%s*$", "%1")
source = codes
Expand All @@ -346,7 +346,7 @@ local function getYueLineNumber(fname, line)
local current, target = 1, tonumber(line)
local findLine = line
for lineCode in source:gmatch("([^\r\n]*)\r?\n?") do
local num = lineCode:match("--%s*(%d+)%s*$")
local num = lineCode:match("%-%-%s*(%d+)%s*$")
if num then
findLine = num
end
Expand Down
11 changes: 10 additions & 1 deletion Source/Node/Label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,16 @@ void Label::updateCharacters(const std::vector<uint32_t>& chars) {
}

void Label::updateLabel() {
_text = utf8_get_characters(_textUTF8.c_str());
auto text = utf8_get_characters(_textUTF8.c_str());
_text.clear();
for (auto elem : text) {
if (elem == '\t') {
_text.push_back(' ');
_text.push_back(' ');
} else {
_text.push_back(elem);
}
}
_text.push_back('\0');

if (_flags.isOn(Label::TextBatched)) {
Expand Down

0 comments on commit 104b7e7

Please sign in to comment.