xavierog / moulti

Moulti is a CLI-driven Terminal User Interface (TUI) displaying arbitrary outputs inside visual, collapsible blocks called steps.
MIT License
119 stars 5 forks source link

[FR] indicator when scroll is locked #10

Closed huyz closed 2 months ago

huyz commented 3 months ago

Right now, I can't tell if the scroll is locked or not. Also, when scroll is locked, the bottom menu still stays l Lock scroll for some time. I guess it would be better if it said l Unlock scroll

xavierog commented 3 months ago

Right now, I can't tell if the scroll is locked or not.

This is briefly documented:

The main scrollbar handle turns green to indicate that the lock is enabled and automatic scrolling is disengaged.

Also, when scroll is locked, the bottom menu still stays l Lock scroll for some time. I guess it would be better if it said l Unlock scroll

Yes, that makes sense. I think the Textual framework recently introduced a way to implement that. I will have a look at it.

huyz commented 3 months ago

This is briefly documented:

Oops, yeah it might be time for me to read your entire docs now that I'm using moulti regularly.

huyz commented 3 months ago

The main scrollbar handle turns green to indicate that the lock is enabled and automatic scrolling is disengaged.

I think I would have noticed the color changing if it weren't green. Orange or Red or Yellow would jump out more since in my Ansible output, almost everything looks green

xavierog commented 3 months ago

I think I would have noticed the color changing if it weren't green. Orange or Red or Yellow would jump out more since in my Ansible output, almost everything looks green

I am notoriously bad at picking suitable colors, so I am willing to change it if you can suggest a better alternative.

In the meantime, you can customise this color through Textual CSS:

  1. Store this snippet in a text file wherever you want:
    $scrollbar_custom_color: #ff0000;
    StepContainer.prevent_programmatic_scrolling {
       scrollbar-color: $scrollbar_custom_color;
       scrollbar-color-active: $scrollbar_custom_color;
       scrollbar-color-hover: $scrollbar_custom_color;
    }
  2. set the environment variable MOULTI_CUSTOM_CSS:
    export MOULTI_CUSTOM_CSS=/absolute/path/to/that/file.css
  3. Run moulti as usual:
    moulti run ansible-playbook your-playbook.yaml
xavierog commented 3 months ago

I think the Textual framework recently introduced a way to implement that. I will have a look at it.

Actually, there is a technical limitation -- I am confident it will be solved at some point in the future but in the meantime, Lock scroll will remain Lock scroll.

@huyz: did my previous comment help re: the scrollbar color?

huyz commented 3 months ago

@xavierog Yes, colors help.

I'm still testing but here's what I'm playing with:

$step_default: #64B5F6;
$step_success: #C5E1A5;
$step_warning: #FFD54F;
$step_error: #E57373;

AbstractStep {
  background: $step_default;
  &.success { background: $step_success; }
  &.warning { background: $step_warning; }
  &.error { background: $step_error; }
}

$scrollbar_custom_color: #AB47BC;

StepContainer.prevent_programmatic_scrolling {
    scrollbar-color: $scrollbar_custom_color;
    scrollbar-color-active: $scrollbar_custom_color;
    scrollbar-color-hover: $scrollbar_custom_color;
}

screenshot 2024-07-20T061935Z@2x

xavierog commented 2 months ago

I think the Textual framework recently introduced a way to implement that. I will have a look at it.

Actually, there is a technical limitation -- I am confident it will be solved at some point in the future but in the meantime, Lock scroll will remain Lock scroll.

Textual 0.76 removed that limitation, so this issue can be reopened.

xavierog commented 2 months ago

Also, when scroll is locked, the bottom menu still stays l Lock scroll for some time. I guess it would be better if it said l Unlock scroll

@huyz: this has been fixed in the devel branch.

huyz commented 2 months ago

Strange, it doesn't seem to work for me. It stays at l Lock scroll

xavierog commented 2 months ago

Strange, it doesn't seem to work for me. It stays at l Lock scroll

Can you ensure you run Moulti along with Textual 0.76.0? I have bumped the requirements from 0.53.0 to 0.76.0.

huyz commented 2 months ago

Ah yes, my bad. It works!

xavierog commented 2 months ago

Fixed in 1.15.0.