ArthurSonzogni / json-tui

A JSON terminal UI made in C++
MIT License
353 stars 16 forks source link

Keybindings #23

Closed andys8 closed 11 months ago

andys8 commented 2 years ago

Hey there, found the tool just yet and it looks pretty nice. Would like to use it :)

I've some questions regarding keybindings?

I know this ticket is too broad. Depending on the answer it could either be refined or split up into several issues.

ArthurSonzogni commented 2 years ago

Thanks for opening this issue!

The keys are currently the ones inherited from the FTXUI library default components. We use the arrow keys, tab, reverse-tab, pagedown and pageup. The vim keys are supported: h,j,k,l. We also support the mouse, including the mouse's wheel.

I believe I like all your ideas without exceptions. It just require someone to do the work.

If you wish to implement some of it, please met me know. Otherwise, I will do it at some point in time.

ArthurSonzogni commented 2 years ago

I started working on:

andys8 commented 2 years ago

That's cool. I'm wondering about h and l and left / right arrows. They don't seem to close and open nested structures, but are supposed to work/exist. Do they have different functionality or are they currently missing?

https://github.com/ArthurSonzogni/json-tui/pull/24/files#diff-34d21af3c614ea3cee120df276c9c4ae95053830d7f1d3deaf009a4625409ad2R61-R62

ArthurSonzogni commented 2 years ago

The arrow key left/right and the vim h/k keys are used to navigate left and right. This is useful when you have both the "button" to expand JSON and the button to display the array view. See:

https://user-images.githubusercontent.com/4759106/192635060-5611fa58-0a83-4ee8-b01e-82dbdf87c28d.mp4

ArthurSonzogni commented 2 years ago

I added '+' and '-' to expand/collapse all elements.

I think this issue has been fixed, outside of the copy/paste feature, which is tracked elsewhere.

SaadAlahmad053843 commented 1 year ago

مرحبًا، لقد وجدت الأداة حتى الآن وهي تبدو جميلة جدًا. أرغب في استخدامه :)

لدي بعض الأسئلة بخصوص روابط المفاتيح؟

  • هل تم توثيقهم في مكان ما؟ إذا لم يكن الأمر كذلك، فسيكون من الرائع عرضها في عرض جدول كامل في ملف README وإما أن تظهر مع --helpالأداة أو داخلها ( ?أو h). مجرد أفكار.
  • الوظيفة: يمكنني سرد ​​ما جربته (وفي نفس الوقت سيكون رائعًا إذا تمت إضافة بعض هذه الأشياء)

أعلم أن هذه التذكرة واسعة جدًا. اعتمادًا على الإجابة، يمكن تنقيحها أو تقسيمها إلى عدة مشكلات.

ArthurSonzogni commented 1 year ago

Hi @SaadAlahmad053843

The json-tui help says you can use -k, --key, or --keybinding to get the information:

json-tui -h
  json-tui [file] {OPTIONS}

    A JSON terminal UI

  OPTIONS:

      file                              A JSON file. Omit to read from stdin.
      -h, --help                        Display this help menu.
      -v, --version                     Print version.
      -k, --key, --keybinding           Display key binding.
      -f, --fullscreen                  Display the JSON in fullscreen, in an
                                        alternate buffer
      "--" can be used to terminate flag options and force all following
      arguments to be treated as positional options

    If no file is given, json-tui reads JSON from the standard input
    Please report bugs to:https://github.com/ArthurSonzogni/json-tui/issues

The keybinding are described by:

json-tui --keybinding
┌───────────┬────────────────┐
│keys       │action          │
├───────────┼────────────────┤
│Navigate   │← ↑ ↓ →         │
│           │h j k l         │
│           │Mouse::WheelUp  │
│           │Mouse::WheelDown│
├───────────┼────────────────┤
│Toggle     │enter           │
│           │Mouse::Left     │
├───────────┼────────────────┤
│Deep       │                │
│ - Expand  │+               │
│ - Collapse│-               │
├───────────┼────────────────┤
│Exit       │Escape          │
│           │q               │
├───────────┼────────────────┤
│Navigate   │                │
│ - first   │page-up         │
│ - last    │page-down       │
│ - top     │gg              │
│ - bottom  │G               │
└───────────┴────────────────┘