Skip to content

fix: unify lineNumberAreaWidth to resolve wide left panel - #703

Draft
pppanghu77 wants to merge 1 commit into
linuxdeepin:masterfrom
pppanghu77:agent/agent/0165f59dbda9
Draft

pppanghu77 wants to merge 1 commit into
linuxdeepin:masterfrom
pppanghu77:agent/agent/0165f59dbda9

Conversation

@pppanghu77

@pppanghu77 pppanghu77 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

fix: unify lineNumberAreaWidth to resolve wide left panel

  1. Root cause: LeftAreaTextEdit::lineNumberAreaWidth() returned an
    inflated width (13 + advdigits + 40) while TextEdit's version
    returned max(15, adv
    digits), causing LineNumberArea::sizeHint()
    to use the inflated value for initial layout
  2. Fix: delegate to m_pTextEdit->lineNumberAreaWidth() so sizeHint()
    and setFixedWidth() use the same width, eliminating the conflict
  3. Impact: blank tab left panel no longer starts oversized; no change
    to normal width after updateLeftWidgetWidth() correction

Log: fix blank tab left panel width inconsistency on startup

Influence:

  1. Verify blank tab left panel width is correct on startup
  2. Verify left panel width after closing and reopening tabs
  3. Test line number area width with large files

fix: 统一行号区宽度计算消除左侧栏偏宽

  1. 根因:LeftAreaTextEdit::lineNumberAreaWidth() 返回膨胀宽度
    (13 + advdigits + 40),而 TextEdit 版本返回 max(15, advdigits),
    导致 LineNumberArea::sizeHint() 用膨胀值做初始布局
  2. 方案:委托调用 m_pTextEdit->lineNumberAreaWidth(),使 sizeHint()
    与 setFixedWidth() 使用同一宽度值,消除双实现冲突
  3. 影响:空白标签页左侧栏不再初始偏宽;updateLeftWidgetWidth()
    纠正后的宽度无变化

Log: 修复空白标签页左侧栏宽度偏大的问题

Influence:

  1. 验证打开空白标签页时左侧栏宽度正常
  2. 验证关闭后重新打开标签页的左侧栏宽度
  3. 测试大文件场景下行号区宽度

PMS: BUG-174621

Summary by Sourcery

Bug Fixes:

  • Fix the oversized left panel shown when opening blank tabs by unifying line-number area width calculation.

1. Root cause: LeftAreaTextEdit::lineNumberAreaWidth() returned an
   inflated width (13 + adv*digits + 40) while TextEdit's version
   returned max(15, adv*digits), causing LineNumberArea::sizeHint()
   to use the inflated value for initial layout
2. Fix: delegate to m_pTextEdit->lineNumberAreaWidth() so sizeHint()
   and setFixedWidth() use the same width, eliminating the conflict
3. Impact: blank tab left panel no longer starts oversized; no change
   to normal width after updateLeftWidgetWidth() correction

Log: fix blank tab left panel width inconsistency on startup

Influence:
1. Verify blank tab left panel width is correct on startup
2. Verify left panel width after closing and reopening tabs
3. Test line number area width with large files

fix: 统一行号区宽度计算消除左侧栏偏宽

1. 根因:LeftAreaTextEdit::lineNumberAreaWidth() 返回膨胀宽度
   (13 + adv*digits + 40),而 TextEdit 版本返回 max(15, adv*digits),
   导致 LineNumberArea::sizeHint() 用膨胀值做初始布局
2. 方案:委托调用 m_pTextEdit->lineNumberAreaWidth(),使 sizeHint()
   与 setFixedWidth() 使用同一宽度值,消除双实现冲突
3. 影响:空白标签页左侧栏不再初始偏宽;updateLeftWidgetWidth()
   纠正后的宽度无变化

Log: 修复空白标签页左侧栏宽度偏大的问题

Influence:
1. 验证打开空白标签页时左侧栏宽度正常
2. 验证关闭后重新打开标签页的左侧栏宽度
3. 测试大文件场景下行号区宽度

PMS: BUG-174621
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: pppanghu77

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pppanghu77
pppanghu77 marked this pull request as draft October 29, 2026 19:14
@sourcery-ai

sourcery-ai Bot commented Oct 29, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR removes the duplicate, inflated line-number width calculation from LeftAreaTextEdit and delegates to TextEdit's shared calculation, keeping initial sizing consistent while preserving corrected widths after updates.

File-Level Changes

Change Details Files
Unify line-number area width calculation by delegating to the primary text editor implementation.
  • Replace the inflated local width formula with a call to m_pTextEdit->lineNumberAreaWidth().
  • Ensure sizeHint() and setFixedWidth() consume the same width value, preventing oversized initial left-panel layout.
src/editor/leftareaoftextedit.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants