Fancy way to display errors from a user menu?

JD john1doe at ya.ru
Mon Oct 4 07:51:38 UTC 2021


Hi!

When running commands from a user menu, we just print errors to stdout, right? This makes the screen flicker, and also in order to look at those errors, you have to hide panels with C-o.

Can we somehow call the error dialog may be? Or is there any other way or a hint/workaround?

I even tried to call `%view` like this:

    = t r
    + ! t t
    d       Diff against same named files
            if [ "%d" = "%D" ]; then
                %view MSG="The two directores must be different"; printf "\n%$((($(tput cols)-${#MSG})/2))s%%s\n" " " "$MSG"
                exit 1
            fi
            if [ -f %D/%f ]; then
                mcdiff %d/%f %D/%f
            fi

...but as soon as `%view` is declared in a menu item construct, it seems to affect literally everything, including `mcdiff` command in this example (we can't somehow "close" `%view`?), which results in "Cannot get terminal settings: Inappropriate ioctl for device (25)" error. 

So, using `%view` is probably not the best possible solution after all :)

But may be there are some other ways? Printing to stdout from a menu doesn't seem like the most user-friendly solution :)


-- 
JD



More information about the mc mailing list