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;
|
||||
}
|
||||
cur_field_off += field_len;
|
||||
return false;
|
||||
return hovered;
|
||||
}
|
||||
|
||||
template <typename TStrSize>
|
||||
|
@ -171,14 +171,14 @@ struct Sec_Hover_Fn {
|
|||
return;
|
||||
}
|
||||
u64 field_len = sizeof(TStrSize) + (u64)str_size;
|
||||
hovered = roff < cur_field_off + field_len;
|
||||
if (display_grouped || hovered) {
|
||||
if (display_grouped || roff < cur_field_off + field_len) {
|
||||
info.rng = { start + cur_field_off, field_len };
|
||||
u8 *buf = arena_push_array_nozero<u8>(arena, str_size + 1);
|
||||
memcpy(buf, data + start + cur_field_off + sizeof(TStrSize), str_size);
|
||||
buf[str_size] = 0;
|
||||
String8 s = { buf, str_size };
|
||||
display_val(arena, info.desc, desc_fmt, s);
|
||||
hovered = true;
|
||||
ended = !display_grouped;
|
||||
}
|
||||
cur_field_off += field_len;
|
||||
|
@ -294,6 +294,7 @@ struct Sec_Hover_Fn {
|
|||
}
|
||||
|
||||
enum Frame_Type {
|
||||
Frame_INVALID,
|
||||
Frame_Record,
|
||||
Frame_List
|
||||
};
|
||||
|
@ -301,10 +302,11 @@ struct Sec_Hover_Fn {
|
|||
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");
|
||||
Frame_Type frame_type = Frame_Record;
|
||||
titled_section(titlestr.c(), [this, &frame_type, &frame_size = size, n_items] {
|
||||
Frame_Type frame_type = Frame_INVALID;
|
||||
titled_section(titlestr.c(), [this, &frame_type, &frame_size = size, n_items, titlestr] {
|
||||
i64 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) {
|
||||
frame_type = Frame_Record;
|
||||
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);
|
||||
});
|
||||
assert(frame_type == Frame_Record || frame_type == Frame_List);
|
||||
return frame_type;
|
||||
}
|
||||
|
||||
|
@ -333,7 +336,9 @@ struct Sec_Hover_Fn {
|
|||
u64 start_off = cur_field_off;
|
||||
u64 size;
|
||||
Frame_Type ftype = frame_header(size);
|
||||
assert(ftype == Frame_Record);
|
||||
if (ftype != Frame_Record)
|
||||
return;
|
||||
|
||||
// DEBUG
|
||||
if (size > 100000) {
|
||||
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)
|
||||
{
|
||||
titled_section(title, [this] {
|
||||
titled_section(title, [this, title] {
|
||||
u64 start_off = cur_field_off;
|
||||
u64 size;
|
||||
Frame_Type ftype = frame_header(size);
|
||||
assert(ftype == Frame_Record);
|
||||
if (ftype != Frame_Record)
|
||||
return;
|
||||
|
||||
// DEBUG
|
||||
if (size > 100000) {
|
||||
printf("read column_desc_size = %lu at offset 0x%lX!\n", size, start + cur_field_off);
|
||||
ended = true;
|
||||
return;
|
||||
}
|
||||
|
||||
field_le<i64>("Size: %" PRIi64 " B");
|
||||
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);
|
||||
|
@ -403,21 +411,29 @@ struct Sec_Hover_Fn {
|
|||
field_le<double>("Value Min: %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);
|
||||
printf("extra size: %lu - %lu = %lu\n", size, cur_field_off - start_off, extra_size);
|
||||
if (extra_size > 0)
|
||||
range("Unknown", extra_size);
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
u32 n_elems;
|
||||
Frame_Type ftype = frame_header(size, &n_elems, title);
|
||||
// assert(ftype == Frame_List);
|
||||
|
||||
if (ended)
|
||||
if (ftype != Frame_List)
|
||||
return;
|
||||
|
||||
// DEBUG
|
||||
|
@ -427,7 +443,7 @@ struct Sec_Hover_Fn {
|
|||
return;
|
||||
}
|
||||
for (u32 i = 0; i < n_elems; ++i) {
|
||||
fn();
|
||||
per_elem_fn();
|
||||
if (ended)
|
||||
break;
|
||||
}
|
||||
|
@ -437,9 +453,9 @@ struct Sec_Hover_Fn {
|
|||
{
|
||||
titled_section(title, [this] {
|
||||
// TODO: Columns and alias columns are not the same
|
||||
list_frame("Fields", [this] { return field_desc(); });
|
||||
list_frame("Columns", [this] { return column_desc("Column"); });
|
||||
list_frame("Alias Columns", [this] { return column_desc("Alias Column"); });
|
||||
list_frame("Fields", [this] { field_desc(); });
|
||||
list_frame("Columns", [this] { column_desc("Column"); });
|
||||
list_frame("Alias Columns", [this] { column_desc("Alias Column"); });
|
||||
list_frame("Extra Type Infos", [this] {
|
||||
field_le<u32>("Content identifier: %lu");
|
||||
field_le<u32>("Type version from: %lu");
|
||||
|
|
|
@ -1224,7 +1224,7 @@ RMicroFileReader::GetNTupleProper(const char *ntupleName)
|
|||
RTFString blobName { kBlobClassName };
|
||||
RTFKey dummy;
|
||||
// FIXME: it seems that sometimes even if IsBigFile() == false we get a big header size!
|
||||
if (fileHeader.IsBigFile())
|
||||
// if (fileHeader.IsBigFile())
|
||||
dummy.MakeBigKey();
|
||||
fileInfo.rblob_key_header_nbytes = dummy.GetHeaderSize() + blobName.GetSize() + 2 * RTFString{}.GetSize();
|
||||
printf("nbytes: %lu\n", fileInfo.rblob_key_header_nbytes);
|
||||
|
|
Loading…
Reference in a new issue