ArthurSonzogni / json-tui

A JSON terminal UI made in C++
MIT License
334 stars 14 forks source link

Keybindings #23

Closed andys8 closed 8 months ago

andys8 commented 1 year 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 1 year 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 1 year ago

I started working on:

andys8 commented 1 year 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 1 year 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 1 year 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 12 months ago

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

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

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

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

ArthurSonzogni commented 12 months 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               │
└───────────┴────────────────┘