Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement attribute expansion #3

Merged
merged 8 commits into from
Feb 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Detailed operations on each view can be displayed by pressing `?` key.
<img src="./img/table-list-detail-kv.png" width=500>
<img src="./img/table-list-detail-json.png" width=500>
<img src="./img/table.png" width=500>
<img src="./img/table-expand-attr.png" width=500>
<img src="./img/item-kv.png" width=500>
<img src="./img/item-plain-json.png" width=500>
<img src="./img/item-raw-json.png" width=500>
Expand Down
Binary file modified img/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions img/demo.tape
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,17 @@ Sleep 1s
Type@200ms "lllllllllll"
Sleep 1s
Type@500ms "fff"
Sleep 500ms
Type@200ms "hhh"
Type "e"
Sleep 1s
Type "n"
Sleep 500ms
Screenshot "./img/table-expand-attr.png"
Type@200ms "jjjjj"
Sleep 500ms
Type "e"
Sleep 500ms
Type "^"
Sleep 500ms
Type@500ms "jjj"
Expand Down
Binary file added img/table-expand-attr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,13 @@ impl Serialize for Attribute {
}
}

struct RawAttributeJsonWrapper<'a>(&'a Attribute);
pub struct RawAttributeJsonWrapper<'a>(&'a Attribute);

impl RawAttributeJsonWrapper<'_> {
pub fn new(attr: &Attribute) -> RawAttributeJsonWrapper {
RawAttributeJsonWrapper(attr)
}
}

impl Serialize for RawAttributeJsonWrapper<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
Expand Down
2 changes: 2 additions & 0 deletions src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ pub enum UserEvent {
NextPreview,
PrevPreview,
Insight,
Expand,
ToggleWrap,
ToggleNumber,
CopyToClipboard,
Expand Down Expand Up @@ -129,6 +130,7 @@ impl UserEventMapper {
(KeyEvent::new(KeyCode::Char('v'), KeyModifiers::NONE), UserEvent::NextPreview),
(KeyEvent::new(KeyCode::Char('V'), KeyModifiers::SHIFT), UserEvent::PrevPreview),
(KeyEvent::new(KeyCode::Char('i'), KeyModifiers::NONE), UserEvent::Insight),
(KeyEvent::new(KeyCode::Char('e'), KeyModifiers::NONE), UserEvent::Expand),
(KeyEvent::new(KeyCode::Char('w'), KeyModifiers::NONE), UserEvent::ToggleWrap),
(KeyEvent::new(KeyCode::Char('n'), KeyModifiers::NONE), UserEvent::ToggleNumber),
(KeyEvent::new(KeyCode::Char('c'), KeyModifiers::NONE), UserEvent::CopyToClipboard),
Expand Down
Loading
Loading