sabotage-linux / netbsd-curses

libcurses and dependencies taken from netbsd and brought into a portable shape (at least to musl or glibc)
Other
147 stars 14 forks source link

midnight commander output in `linux` terminal is garbage #22

Closed rofl0r closed 7 years ago

rofl0r commented 7 years ago

instead of drawing the line characters, some 'Ä'-like umlauts are displayed. also when moving the cursor down, the line drawing is shifted one character to the side, i.e. to another column. trying around with different other terminfo entries, i found that the bterm terminfo descriptions work almost 100% (apart from some black bricks painted in random locations when refreshing), so i diffed the output of infocmp for linux and bterm. i then added the things linux had but bterm not, and the result is an almost perfect terminfo description:

footerm|foo console,
    acsc=aajjkkllmmqqttuuxx,
    am,
    bce,
    bel=^G,
    blink=\E[5m,
    bold=\E[1m,
    ccc,
    civis=\E[?25l,
    clear=\E[H\E[2J,
    cnorm=\E[?25h,
    colors#8,
    cols#80,
    cr=^M,
    csr=\E[%i%p1%d;%p2%dr,
    cub1=^H,
    cub=\E[%p1%dD,
    cud1=^J,
    cud=\E[%p1%dB,
    cuf1=\E[C,
    cuf=\E[%p1%dC,
    cup=\E[%i%p1%d;%p2%dH,
    cuu1=\E[A,
    cuu=\E[%p1%dA,
    cvvis=\E[?25h\E[?8c,
    dch1=\E[P,
    dch=\E[%p1%dP,
    dim=\E[2m,
    dl1=\E[M,
    dl=\E[%p1%dM,
    ech=\E[%p1%dX,
    ed=\E[J,
    el1=\E[1K,
    el=\E[K,
    eo,
    flash=\E[?5h\E[?5l$<200/>,
    home=\E[H,
    hpa=\E[%i%p1%dG,
    ht=^I,
    hts=\EH,
    ich1=\E[@,
    ich=\E[%p1%d@,
    il1=\E[L,
    il=\E[%p1%dL,
    ind=^J,
    initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/%02x%p4%{255}%*%{1000}%/%02x,
    it#8,
    kb2=\E[G,
    kbs=^?,
    kcbt=\E[Z,
    kcub1=\E[D,
    kcud1=\E[B,
    kcuf1=\E[C,
    kcuu1=\E[A,
    kdch1=\E[3~,
    kend=\E[4~,
    kf10=\E[21~,
    kf11=\E[23~,
    kf12=\E[24~,
    kf13=\E[25~,
    kf14=\E[26~,
    kf15=\E[28~,
    kf16=\E[29~,
    kf17=\E[31~,
    kf18=\E[32~,
    kf19=\E[33~,
    kf1=\E[[A,
    kf20=\E[34~,
    kf2=\E[[B,
    kf3=\E[[C,
    kf4=\E[[D,
    kf5=\E[[E,
    kf6=\E[17~,
    kf7=\E[18~,
    kf8=\E[19~,
    kf9=\E[20~,
    khome=\E[1~,
    kich1=\E[2~,
    kmous=\E[M,
    knp=\E[6~,
    kpp=\E[5~,
    kspd=^Z,
    lines#24,
    mir,
    msgr,
    ncv#18,
    nel=^M^J,
    oc=\E]R,
    op=\E[49m\E[39m,
    pairs#64,
    rc=\E8,
    rev=\E[7m,
    ri=\EM,
    rmacs=^O,
    rmam=\E[?7l,
    rmir=\E[4l,
    rmpch=\E[10m,
    rmso=\E[27m,
    rmul=\E[24m,
    rs1=\Ec\E]R,
    sc=\E7,
    setab=\E[4%p1%dm,
    setaf=\E[3%p1%dm,
    sgr0=\E[0m,
    sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p9%t;11%;m,
    smacs=^N,
    smam=\E[?7h,
    smir=\E[4h,
    smpch=\E[11m,
    smso=\E[7m,
    smul=\E[4m,
    tbc=\E[3g,
    u6=\E[%i%d;%dR,
    u7=\E[6n,
    u8=\E[?6c,
    u9=\E[c,
    vpa=\E[%i%p1%dd,
    xenl,
    xon,

then i diffed that against the linux output and added the changed lines as comments:

linux99|linux99 console,
    acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376,
#   acsc=aajjkkllmmqqttuuxx,
    am,
    bce,
    bel=^G,
    blink=\E[5m,
    bold=\E[1m,
    ccc,
    civis=\E[?25l\E[?1c,
    clear=\E[H\E[J,
    cnorm=\E[?25h\E[?0c,
#   civis=\E[?25l,
#   clear=\E[H\E[2J,
#   cnorm=\E[?25h,
    colors#8,
#   cols#80,
    cr=^M,
    csr=\E[%i%p1%d;%p2%dr,
    cub1=^H,
    cub=\E[%p1%dD,
    cud1=^J,
    cud=\E[%p1%dB,
    cuf1=\E[C,
    cuf=\E[%p1%dC,
    cup=\E[%i%p1%d;%p2%dH,
    cuu1=\E[A,
    cuu=\E[%p1%dA,
    cvvis=\E[?25h\E[?8c,
    dch1=\E[P,
    dch=\E[%p1%dP,
    dim=\E[2m,
    dl1=\E[M,
    dl=\E[%p1%dM,
    ech=\E[%p1%dX,
    ed=\E[J,
    el1=\E[1K,
    el=\E[K,
    eo,
    flash=\E[?5h\E[?5l$<200/>,
    home=\E[H,
    hpa=\E[%i%p1%dG,
    ht=^I,
    hts=\EH,
    ich1=\E[@,
    ich=\E[%p1%d@,
    il1=\E[L,
    il=\E[%p1%dL,
    ind=^J,
    initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/%02x%p4%{255}%*%{1000}%/%02x,
    it#8,
    kb2=\E[G,
    kbs=^?,
    kcbt=\E[Z,
    kcub1=\E[D,
    kcud1=\E[B,
    kcuf1=\E[C,
    kcuu1=\E[A,
    kdch1=\E[3~,
    kend=\E[4~,
    kf10=\E[21~,
    kf11=\E[23~,
    kf12=\E[24~,
    kf13=\E[25~,
    kf14=\E[26~,
    kf15=\E[28~,
    kf16=\E[29~,
    kf17=\E[31~,
    kf18=\E[32~,
    kf19=\E[33~,
    kf1=\E[[A,
    kf20=\E[34~,
    kf2=\E[[B,
    kf3=\E[[C,
    kf4=\E[[D,
    kf5=\E[[E,
    kf6=\E[17~,
    kf7=\E[18~,
    kf8=\E[19~,
    kf9=\E[20~,
    khome=\E[1~,
    kich1=\E[2~,
    kmous=\E[M,
    knp=\E[6~,
    kpp=\E[5~,
    kspd=^Z,
#   lines#24,
    mir,
    msgr,
    ncv#18,
    nel=^M^J,
    oc=\E]R,
    op=\E[39;49m,
#   op=\E[49m\E[39m,
    pairs#64,
    rc=\E8,
    rev=\E[7m,
    ri=\EM,
    rmacs=\E[10m,
#   rmacs=^O,
    rmam=\E[?7l,
    rmir=\E[4l,
    rmpch=\E[10m,
    rmso=\E[27m,
    rmul=\E[24m,
    rs1=\Ec\E]R,
    sc=\E7,
    setab=\E[4%p1%dm,
    setaf=\E[3%p1%dm,
    sgr0=\E[0;10m,
#   sgr0=\E[0m,
    sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p9%t;11%;m,
    smacs=\E[11m,
#   smacs=^N,
    smam=\E[?7h,
    smir=\E[4h,
    smpch=\E[11m,
    smso=\E[7m,
    smul=\E[4m,
    tbc=\E[3g,
    u6=\E[%i%d;%dR,
    u7=\E[6n,
    u8=\E[?6c,
    u9=\E[c,
    vpa=\E[%i%p1%dd,
    xenl,
    xon,

by turning on and off the differing items i finally found that switching smacs and acsc, the problem appears to be fixed. googling for smacs and rmacs found this debian bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=515609 so this bug report basically says that the smacs and rmacs used by the ncurses terminfo db are buggy (correct would be what bterm uses), so that was fixed but later *reverted* because it broke midnight commander(linked with slang) for ppl using non-utf8 locales (interestingly in about the same way linux is currently broken for us *without* the fix). there are some follow-ups to that bug that may be of interest as well: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=665959 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823658