Skip to content

treeland-debug top: 表头与数据行列未对齐 #1395

Description

@deepin-wm

问题

treeland-debug top 命令的表头与数据行没有对齐。

复现场景:

  ID              APP-ID                STATE       MIN  FRAMES  GEO          MARKER
  101040059279328                           Normal        no        0  0,0 1536x827  
  101040059018352                           Normal        no        0  0,0 1x1  
  101040059200576                           Normal        no        0  0,0 1x1  
  101040070208496   foot                    Normal        no        0  418,143 700x540  C
  101040044598336   foot                    Normal        yes       0  458,183 700x540  
  101040058825552                           Normal        no        0  0,827 1536x37     

原因

tools/treeland-debug/main.cpprunTop() 的表头是手写固定字符串,而数据行用 leftJustified() / .arg(n, 5) 按固定宽度拼接,两者列宽不一致:

  • 表头 STATE 位于 position 40-44,但数据行 stateName(r.state).leftJustified(12) 加上前导两个空格和两个分隔空格使 Normal 出现在 position 44。
  • 表头 MIN 位于 position 52-54,但数据行 minimizedleftJustified(4) 实际使 no/yes 出现在 position 58。
  • 表头 FRAMES 位于 position 57-62,但数据行 framesDelta.arg(r.framesDelta, 5) 右对齐 5 宽实际出现在 position 68。
  • GEOMARKER 同样错位。

期望

表头与每列数据对齐。可以将表头也用相同的 .leftJustified() / .arg(n, w) 格式拼接,或计算列宽后统一格式化。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions