improve System/Logger to be able to focus on the target file
This commit is contained in:
parent
c5d46f37d6
commit
69cd19ebb4
@ -273,6 +273,9 @@ void Logger::UpdateMenu() noexcept {
|
||||
win_.MenuItem();
|
||||
}
|
||||
void Logger::UpdateRowMenu(const Row& row) noexcept {
|
||||
if (row.file && ImGui::MenuItem("request focus")) {
|
||||
env().Handle({.id = row.file, .type = nf7::File::Event::kReqFocus,});
|
||||
}
|
||||
if (ImGui::MenuItem("copy as text")) {
|
||||
ImGui::SetClipboardText(row.Stringify().c_str());
|
||||
}
|
||||
@ -316,7 +319,11 @@ void Logger::LogView() noexcept {
|
||||
constexpr auto kFlags =
|
||||
ImGuiSelectableFlags_SpanAllColumns |
|
||||
ImGuiSelectableFlags_AllowItemOverlap;
|
||||
ImGui::Selectable(row.level, false, kFlags);
|
||||
if (ImGui::Selectable(row.level, false, kFlags)) {
|
||||
if (row.file) {
|
||||
env().Handle({.id = row.file, .type = nf7::File::Event::kReqFocus,});
|
||||
}
|
||||
}
|
||||
if (ImGui::BeginPopupContextItem()) {
|
||||
UpdateRowMenu(row);
|
||||
ImGui::EndPopup();
|
||||
|
Loading…
x
Reference in New Issue
Block a user