extrawurst / gitui

Blazing 💥 fast terminal-ui for git written in rust 🦀
MIT License
18.62k stars 573 forks source link

Remotes popup #2350

Closed robin-thoene closed 2 months ago

robin-thoene commented 2 months ago

This Pull Request fixes/closes #2172 .

It changes the following:

I followed the checklist:

extrawurst commented 2 months ago

any idea why the background color of selection does not span the whole width?

Screenshot 2024-09-17 at 11 18 14

also i would like us to use as little space as possible for the details, that way we can have more space for the remotes list area

extrawurst commented 2 months ago

a command to fetch only the selected remote would be great (followup, but can reuse fetch popup)

extrawurst commented 2 months ago

not sure why but when the layout only has room for the name in details it still wont show it:

Screenshot 2024-09-17 at 11 23 38
extrawurst commented 2 months ago

there are potential panics if you resize your terminal to zero, that we should cover before merge, please test this in all new popups:

PanicHookInfo { payload: Any { .. }, location: Location { file: "/Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.27.0/src/widgets/clear.rs", line: 37, col: 21 }, can_unwind: true, force_no_backtrace: false }
trace:
   0: backtrace::backtrace::libunwind::trace
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.73/src/backtrace/libunwind.rs:116:5
      backtrace::backtrace::trace_unsynchronized
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.73/src/backtrace/mod.rs:66:5
   1: backtrace::backtrace::trace
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.73/src/backtrace/mod.rs:53:14
   2: backtrace::capture::Backtrace::create
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.73/src/capture.rs:197:9
   3: backtrace::capture::Backtrace::new
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.73/src/capture.rs:162:22
   4: gitui::set_panic_handlers::{{closure}}
             at /Users/stephan/code/gitui/src/main.rs:382:19
   5: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:2084:9
      std::panicking::rust_panic_with_hook
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:808:13
   6: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:674:13
   7: std::sys::backtrace::__rust_end_short_backtrace
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:168:18
   8: rust_begin_unwind
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
   9: core::panicking::panic_fmt
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
  10: ratatui::buffer::buffer::Buffer::index_of
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.27.0/src/buffer/buffer.rs:137:9
      ratatui::buffer::buffer::Buffer::get_mut
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.27.0/src/buffer/buffer.rs:105:17
      <ratatui::widgets::clear::Clear as ratatui::widgets::WidgetRef>::render_ref
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.27.0/src/widgets/clear.rs:37:17
      <ratatui::widgets::clear::Clear as ratatui::widgets::Widget>::render
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.27.0/src/widgets/clear.rs:29:9
  11: ratatui::terminal::frame::Frame::render_widget
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.27.0/src/terminal/frame.rs:75:9
  12: <gitui::components::textinput::TextInputComponent as gitui::components::DrawableComponent>::draw
             at /Users/stephan/code/gitui/src/components/textinput.rs:642:4
  13: <gitui::popups::create_remote::CreateRemotePopup as gitui::components::DrawableComponent>::draw
             at /Users/stephan/code/gitui/src/popups/create_remote.rs:37:4
robin-thoene commented 2 months ago

any idea why the background color of selection does not span the whole width?

Screenshot 2024-09-17 at 11 18 14

also i would like us to use as little space as possible for the details, that way we can have more space for the remotes list area

I am not 100% sure why this is the case. In the following screenshot I opened the branch popup (prod gitui on my system, not my branch version!) and it has the same issue:

image

robin-thoene commented 2 months ago

not sure why but when the layout only has room for the name in details it still wont show it:

Screenshot 2024-09-17 at 11 23 38

I think I solved this now

extrawurst commented 2 months ago

something is still odd rescaling around here:

https://github.com/user-attachments/assets/f5586dde-afd5-40c6-95ad-6ac074cb7401

extrawurst commented 2 months ago

here seems another issue:

Screenshot 2024-09-17 at 20 23 02
extrawurst commented 2 months ago

Can you please retry the scaling to 0 with all new popups. i just tried the rename one:

PanicHookInfo { payload: Any { .. }, location: Location { file: "/Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.28.1/src/buffer/buffer.rs", line: 238, col: 13 }, can_unwind: true, force_no_backtrace: false }
trace:
   0: backtrace::backtrace::libunwind::trace
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.73/src/backtrace/libunwind.rs:116:5
      backtrace::backtrace::trace_unsynchronized
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.73/src/backtrace/mod.rs:66:5
   1: backtrace::backtrace::trace
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.73/src/backtrace/mod.rs:53:14
   2: backtrace::capture::Backtrace::create
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.73/src/capture.rs:197:9
   3: backtrace::capture::Backtrace::new
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.73/src/capture.rs:162:22
   4: gitui::set_panic_handlers::{{closure}}
             at /Users/stephan/code/gitui/src/main.rs:382:19
   5: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:2084:9
      std::panicking::rust_panic_with_hook
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:808:13
   6: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:674:13
   7: std::sys::backtrace::__rust_end_short_backtrace
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:168:18
   8: rust_begin_unwind
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
   9: core::panicking::panic_fmt
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
  10: ratatui::buffer::buffer::Buffer::index_of::{{closure}}
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.28.1/src/buffer/buffer.rs:238:13
      core::option::Option<T>::unwrap_or_else
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/option.rs:1015:21
      ratatui::buffer::buffer::Buffer::index_of
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.28.1/src/buffer/buffer.rs:237:46
      <ratatui::buffer::buffer::Buffer as core::ops::index::IndexMut<P>>::index_mut
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.28.1/src/buffer/buffer.rs:540:21
  11: ratatui::widgets::paragraph::Paragraph::render_text
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.28.1/src/widgets/paragraph.rs:445:24
      ratatui::widgets::paragraph::Paragraph::render_paragraph
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.28.1/src/widgets/paragraph.rs:421:13
      <ratatui::widgets::paragraph::Paragraph as ratatui::widgets::WidgetRef>::render_ref
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.28.1/src/widgets/paragraph.rs:398:9
  12: <ratatui::widgets::paragraph::Paragraph as ratatui::widgets::Widget>::render
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.28.1/src/widgets/paragraph.rs:389:9
  13: tui_textarea::widget::<impl ratatui::widgets::Widget for &tui_textarea::textarea::TextArea>::render
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-textarea-0.6.1/src/widget.rs:170:9
  14: ratatui::terminal::frame::Frame::render_widget
             at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.28.1/src/terminal/frame.rs:87:9
  15: <gitui::components::textinput::TextInputComponent as gitui::components::DrawableComponent>::draw
             at /Users/stephan/code/gitui/src/components/textinput.rs:646:4
  16: <gitui::popups::rename_remote::RenameRemotePopup as gitui::components::DrawableComponent>::draw
             at /Users/stephan/code/gitui/src/popups/rename_remote.rs:31:4
extrawurst commented 2 months ago

when I "rename" but then leave the name as is: would be better to just dont error :)

Screenshot 2024-09-17 at 20 57 49
extrawurst commented 2 months ago

hm this should be addressed:

https://github.com/user-attachments/assets/13bfc2a7-fe63-4da0-be7e-62235f67f733

extrawurst commented 2 months ago

ok two last things:

https://github.com/user-attachments/assets/e258342a-780b-4e23-81a7-a509e7590d4d

extrawurst commented 2 months ago

Thank you so much 🎉

robin-thoene commented 2 months ago

Thank you so much for the review, guidance and help!