some hover fixes
This commit is contained in:
parent
a0aa6a8d36
commit
c83d457738
2 changed files with 33 additions and 17 deletions
|
@ -152,7 +152,7 @@ struct Sec_Hover_Fn {
|
||||||
ended = !display_grouped;
|
ended = !display_grouped;
|
||||||
}
|
}
|
||||||
cur_field_off += field_len;
|
cur_field_off += field_len;
|
||||||
return false;
|
return hovered;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TStrSize>
|
template <typename TStrSize>
|
||||||
|
@ -171,14 +171,14 @@ struct Sec_Hover_Fn {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
u64 field_len = sizeof(TStrSize) + (u64)str_size;
|
u64 field_len = sizeof(TStrSize) + (u64)str_size;
|
||||||
hovered = roff < cur_field_off + field_len;
|
if (display_grouped || roff < cur_field_off + field_len) {
|
||||||
if (display_grouped || hovered) {
|
|
||||||
info.rng = { start + cur_field_off, field_len };
|
info.rng = { start + cur_field_off, field_len };
|
||||||
u8 *buf = arena_push_array_nozero<u8>(arena, str_size + 1);
|
u8 *buf = arena_push_array_nozero<u8>(arena, str_size + 1);
|
||||||
memcpy(buf, data + start + cur_field_off + sizeof(TStrSize), str_size);
|
memcpy(buf, data + start + cur_field_off + sizeof(TStrSize), str_size);
|
||||||
buf[str_size] = 0;
|
buf[str_size] = 0;
|
||||||
String8 s = { buf, str_size };
|
String8 s = { buf, str_size };
|
||||||
display_val(arena, info.desc, desc_fmt, s);
|
display_val(arena, info.desc, desc_fmt, s);
|
||||||
|
hovered = true;
|
||||||
ended = !display_grouped;
|
ended = !display_grouped;
|
||||||
}
|
}
|
||||||
cur_field_off += field_len;
|
cur_field_off += field_len;
|
||||||
|
@ -294,6 +294,7 @@ struct Sec_Hover_Fn {
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Frame_Type {
|
enum Frame_Type {
|
||||||
|
Frame_INVALID,
|
||||||
Frame_Record,
|
Frame_Record,
|
||||||
Frame_List
|
Frame_List
|
||||||
};
|
};
|
||||||
|
@ -301,10 +302,11 @@ struct Sec_Hover_Fn {
|
||||||
Frame_Type frame_header(u64 &size, u32 *n_items = nullptr, const char *title = nullptr)
|
Frame_Type frame_header(u64 &size, u32 *n_items = nullptr, const char *title = nullptr)
|
||||||
{
|
{
|
||||||
String8 titlestr = title ? push_str8f(arena, "Frame Header: %s", title) : str8("Frame Header");
|
String8 titlestr = title ? push_str8f(arena, "Frame Header: %s", title) : str8("Frame Header");
|
||||||
Frame_Type frame_type = Frame_Record;
|
Frame_Type frame_type = Frame_INVALID;
|
||||||
titled_section(titlestr.c(), [this, &frame_type, &frame_size = size, n_items] {
|
titled_section(titlestr.c(), [this, &frame_type, &frame_size = size, n_items, titlestr] {
|
||||||
i64 size;
|
i64 size;
|
||||||
memcpy(&size, data + start + cur_field_off, sizeof(size));
|
memcpy(&size, data + start + cur_field_off, sizeof(size));
|
||||||
|
printf("frame header %s read size %ld at 0x%lX\n", titlestr.c(), size, start + cur_field_off);
|
||||||
if (size >= 0) {
|
if (size >= 0) {
|
||||||
frame_type = Frame_Record;
|
frame_type = Frame_Record;
|
||||||
field<i64>("Record frame size: %" PRIi64 " B", hover_display_val_le_abs<i64>);
|
field<i64>("Record frame size: %" PRIi64 " B", hover_display_val_le_abs<i64>);
|
||||||
|
@ -320,6 +322,7 @@ struct Sec_Hover_Fn {
|
||||||
|
|
||||||
frame_size = std::abs(size);
|
frame_size = std::abs(size);
|
||||||
});
|
});
|
||||||
|
assert(frame_type == Frame_Record || frame_type == Frame_List);
|
||||||
return frame_type;
|
return frame_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +336,9 @@ struct Sec_Hover_Fn {
|
||||||
u64 start_off = cur_field_off;
|
u64 start_off = cur_field_off;
|
||||||
u64 size;
|
u64 size;
|
||||||
Frame_Type ftype = frame_header(size);
|
Frame_Type ftype = frame_header(size);
|
||||||
assert(ftype == Frame_Record);
|
if (ftype != Frame_Record)
|
||||||
|
return;
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
if (size > 100000) {
|
if (size > 100000) {
|
||||||
printf("read field_frame_size = %lu at offset 0x%lX!\n", size, start + cur_field_off);
|
printf("read field_frame_size = %lu at offset 0x%lX!\n", size, start + cur_field_off);
|
||||||
|
@ -372,17 +377,20 @@ struct Sec_Hover_Fn {
|
||||||
|
|
||||||
void column_desc(const char *title)
|
void column_desc(const char *title)
|
||||||
{
|
{
|
||||||
titled_section(title, [this] {
|
titled_section(title, [this, title] {
|
||||||
u64 start_off = cur_field_off;
|
u64 start_off = cur_field_off;
|
||||||
u64 size;
|
u64 size;
|
||||||
Frame_Type ftype = frame_header(size);
|
Frame_Type ftype = frame_header(size);
|
||||||
assert(ftype == Frame_Record);
|
if (ftype != Frame_Record)
|
||||||
|
return;
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
if (size > 100000) {
|
if (size > 100000) {
|
||||||
printf("read column_desc_size = %lu at offset 0x%lX!\n", size, start + cur_field_off);
|
printf("read column_desc_size = %lu at offset 0x%lX!\n", size, start + cur_field_off);
|
||||||
ended = true;
|
ended = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
field_le<i64>("Size: %" PRIi64 " B");
|
field_le<i64>("Size: %" PRIi64 " B");
|
||||||
field<u16>("Column type: %s", [](Arena *arena, String8_Node *prev, const char *fmt, u16 val) {
|
field<u16>("Column type: %s", [](Arena *arena, String8_Node *prev, const char *fmt, u16 val) {
|
||||||
const char *readable_col_type = get_column_type_name(val);
|
const char *readable_col_type = get_column_type_name(val);
|
||||||
|
@ -403,21 +411,29 @@ struct Sec_Hover_Fn {
|
||||||
field_le<double>("Value Min: %f");
|
field_le<double>("Value Min: %f");
|
||||||
field_le<double>("Value Max: %f");
|
field_le<double>("Value Max: %f");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(cur_field_off >= start_off);
|
||||||
|
if (size < cur_field_off - start_off) {
|
||||||
|
printf("column_desc(%s) should be of size %lu but we allocated %lu bytes for it?\n", title, size, cur_field_off - start_off);
|
||||||
|
return;
|
||||||
|
}
|
||||||
u64 extra_size = size - (cur_field_off - start_off);
|
u64 extra_size = size - (cur_field_off - start_off);
|
||||||
|
printf("extra size: %lu - %lu = %lu\n", size, cur_field_off - start_off, extra_size);
|
||||||
if (extra_size > 0)
|
if (extra_size > 0)
|
||||||
range("Unknown", extra_size);
|
range("Unknown", extra_size);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename F>
|
template <typename F>
|
||||||
void list_frame(const char *title, F &&fn)
|
void list_frame(const char *title, F &&per_elem_fn)
|
||||||
{
|
{
|
||||||
|
if (ended)
|
||||||
|
return;
|
||||||
|
|
||||||
u64 size;
|
u64 size;
|
||||||
u32 n_elems;
|
u32 n_elems;
|
||||||
Frame_Type ftype = frame_header(size, &n_elems, title);
|
Frame_Type ftype = frame_header(size, &n_elems, title);
|
||||||
// assert(ftype == Frame_List);
|
if (ftype != Frame_List)
|
||||||
|
|
||||||
if (ended)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
|
@ -427,7 +443,7 @@ struct Sec_Hover_Fn {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (u32 i = 0; i < n_elems; ++i) {
|
for (u32 i = 0; i < n_elems; ++i) {
|
||||||
fn();
|
per_elem_fn();
|
||||||
if (ended)
|
if (ended)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -437,9 +453,9 @@ struct Sec_Hover_Fn {
|
||||||
{
|
{
|
||||||
titled_section(title, [this] {
|
titled_section(title, [this] {
|
||||||
// TODO: Columns and alias columns are not the same
|
// TODO: Columns and alias columns are not the same
|
||||||
list_frame("Fields", [this] { return field_desc(); });
|
list_frame("Fields", [this] { field_desc(); });
|
||||||
list_frame("Columns", [this] { return column_desc("Column"); });
|
list_frame("Columns", [this] { column_desc("Column"); });
|
||||||
list_frame("Alias Columns", [this] { return column_desc("Alias Column"); });
|
list_frame("Alias Columns", [this] { column_desc("Alias Column"); });
|
||||||
list_frame("Extra Type Infos", [this] {
|
list_frame("Extra Type Infos", [this] {
|
||||||
field_le<u32>("Content identifier: %lu");
|
field_le<u32>("Content identifier: %lu");
|
||||||
field_le<u32>("Type version from: %lu");
|
field_le<u32>("Type version from: %lu");
|
||||||
|
|
|
@ -1224,7 +1224,7 @@ RMicroFileReader::GetNTupleProper(const char *ntupleName)
|
||||||
RTFString blobName { kBlobClassName };
|
RTFString blobName { kBlobClassName };
|
||||||
RTFKey dummy;
|
RTFKey dummy;
|
||||||
// FIXME: it seems that sometimes even if IsBigFile() == false we get a big header size!
|
// FIXME: it seems that sometimes even if IsBigFile() == false we get a big header size!
|
||||||
if (fileHeader.IsBigFile())
|
// if (fileHeader.IsBigFile())
|
||||||
dummy.MakeBigKey();
|
dummy.MakeBigKey();
|
||||||
fileInfo.rblob_key_header_nbytes = dummy.GetHeaderSize() + blobName.GetSize() + 2 * RTFString{}.GetSize();
|
fileInfo.rblob_key_header_nbytes = dummy.GetHeaderSize() + blobName.GetSize() + 2 * RTFString{}.GetSize();
|
||||||
printf("nbytes: %lu\n", fileInfo.rblob_key_header_nbytes);
|
printf("nbytes: %lu\n", fileInfo.rblob_key_header_nbytes);
|
||||||
|
|
Loading…
Reference in a new issue