gansm / finalcut

A text-based widget toolkit
https://github.com/gansm/finalcut/wiki/First-steps#first-steps-with-the-final-cut-widget-toolkit
GNU Lesser General Public License v3.0
993 stars 52 forks source link

an exception is displayed when the string starts with more than six consecutive zeros #103

Closed kmnot closed 2 years ago

kmnot commented 2 years ago
#include <final/final.h>

using namespace finalcut;

int main(int argc, char *argv[])
{
    FApplication app{argc, argv};
    FDialog dig{&app};
    FLineEdit lineedit{&dig}, lineedit2{&dig}, lineedit3{&dig};

    app.setMainWidget(&dig);

    dig.setSize(FSize{36, 12});

    lineedit.setGeometry(FPoint{3, 1}, FSize{dig.getDesktopWidth(), 1});
    lineedit2.setGeometry(FPoint{3, 3}, FSize{dig.getDesktopWidth(), 1});
    lineedit3.setGeometry(FPoint{3, 5}, FSize{dig.getDesktopWidth(), 1});

    lineedit.setText ("0000001");
    lineedit2.setText("00000001");
    lineedit3.setText("000000001");

    dig.show();

    return app.exec();
}

Hello, This is my code, and when I compile and execute it, it looks like this QQ截图20220513151106

lineedit2 and linedit3 are displayed abnormally

gansm commented 2 years ago

Hi kmnot, thanks for sharing your user experience. I have compiled and run your example. Everything looks as expected for me:

image

Now we need to find out why you have these display glitches. These glitches can be caused by the terminal font, for example, when a character is narrower than a terminal cell.

For better research, I need some information from your system environment:

By the way, you should use relative positioning in your code and use getClientWidth() instead of getDesktopWith().

See widget layout

Minor code improvement

  auto rsw = std::size_t(1);  // Right shadow width
  lineedit.setGeometry(FPoint{1, 1}, FSize{dig.getClientWidth() - rsw, 1});
  lineedit2.setGeometry(FPoint{1, 3}, FSize{dig.getClientWidth() - rsw, 1});
  lineedit3.setGeometry(FPoint{1, 5}, FSize{dig.getClientWidth() - rsw, 1});

image

kmnot commented 2 years ago

Hi kmnot, thanks for sharing your user experience. I have compiled and run your example. Everything looks as expected for me:

image

Now we need to find out why you have these display glitches. These glitches can be caused by the terminal font, for example, when a character is narrower than a terminal cell.

For better research, I need some information from your system environment:

  • Which operating system do you use?
  • Which distribution do you use?
  • Which terminal do you use?
  • Which font do you use and in which font size?
  • What is the output of echo $TERM and locale?

By the way, you should use relative positioning in your code and use getClientWidth() instead of getDesktopWith().

See widget layout

Minor code improvement

  auto rsw = std::size_t(1);  // Right shadow width
  lineedit.setGeometry(FPoint{1, 1}, FSize{dig.getClientWidth() - rsw, 1});
  lineedit2.setGeometry(FPoint{1, 3}, FSize{dig.getClientWidth() - rsw, 1});
  lineedit3.setGeometry(FPoint{1, 5}, FSize{dig.getClientWidth() - rsw, 1});

image

Thank you for your reply. At present, it can be determined that it is the problem of the analog terminal used by SecureCRT software. The xterm used by it will display exceptions (not sure which configuration is the problem), but the terminal used by vscode displays very normally

gansm commented 2 years ago

Now I'm curious about what's going on, and I also installed SecureCRT. But I did not have the display problems of your screenshot.

image

My terminal setting

image image

I have tested with RHEL7 and the SecureCRT version 9.2.1 (build 2768)

image

kmnot commented 2 years ago

Yes, when I upgrade to the latest version of SecureCRT, it displays normally now

从 Windows 版邮件https://go.microsoft.com/fwlink/?LinkId=550986发送


发件人: Markus Gans @.> 发送时间: Sunday, May 15, 2022 2:21:36 AM 收件人: gansm/finalcut @.> 抄送: kmnot @.>; Author @.> 主题: Re: [gansm/finalcut] an exception is displayed when the string starts with more than six consecutive zeros (Issue #103)

Now I'm curious about what's going on, and I also installed SecureCRT. But I did not have the display problems of your screenshot.

[image]https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F12223838%2F168443808-d3e84ad9-1ef3-4363-b894-cc20eaf750b6.png&data=05%7C01%7C%7C5ac793fedfdb48213c5a08da35d69548%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637881493012773115%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=eKMIeYGkkaULtGVPI8rjGhksBkd9mKQcQJeeGp%2FcyvE%3D&reserved=0

My terminal setting

[image]https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F12223838%2F168443820-784d6bce-901b-40ab-a9e4-1a40d764cd1c.png&data=05%7C01%7C%7C5ac793fedfdb48213c5a08da35d69548%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637881493012773115%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=7p71RdfDbI3mD4ucjUE2R59fX%2BIQuxSZdq8bXxWmRSo%3D&reserved=0 [image]https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F12223838%2F168443825-3b9829b3-a40b-4119-b700-2a74bc9053c8.png&data=05%7C01%7C%7C5ac793fedfdb48213c5a08da35d69548%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637881493012773115%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=kNcG%2B5kjL348t0iHsUQPh2spAb90gdgHD2vhyof9IY4%3D&reserved=0

I have tested with RHEL7 and the SecureCRT version 9.2.1 (build 2768)

[image]https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F12223838%2F168443833-e216a856-fe68-42a4-b348-79972dd1f3ff.png&data=05%7C01%7C%7C5ac793fedfdb48213c5a08da35d69548%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637881493012773115%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=pntUrcLO61EN5Uzn9BWBtYbC3VeJqomaon9O%2BsiUxRQ%3D&reserved=0

― Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgansm%2Ffinalcut%2Fissues%2F103%23issuecomment-1126789086&data=05%7C01%7C%7C5ac793fedfdb48213c5a08da35d69548%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637881493012773115%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=w4yA8YEbEv%2FyStEJir%2BvbcfUEK6sxLqe%2F4BV0CrEueI%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAPP2GVYZXJTNLJEIUI6XSLTVJ7VLBANCNFSM5V2PEMTQ&data=05%7C01%7C%7C5ac793fedfdb48213c5a08da35d69548%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637881493012773115%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=F4X1T17fYycfpE93HiFUAdnIoslEx%2BUJf%2BETRs8j9K4%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

gansm commented 2 years ago

It's great that you were able to solve your problem!