Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Line Numbers to show Assmble Address #48

Open
svr2kos2 opened this issue Oct 30, 2024 · 1 comment
Open

Custom Line Numbers to show Assmble Address #48

svr2kos2 opened this issue Oct 30, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@svr2kos2
Copy link
Contributor

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
I want to use line numbers to show assmble address witch it's not simply 1,2,3,4,5......

Describe alternatives you've considered
I'm currently inheriting CodeLineNumberRenderObject and override paint method to do this.

class AsmCodeLineNumberRenderObject extends CodeLineNumberRenderObject {
//.....
@override
  void paint(PaintingContext context, Offset offset) {
//....
    for (final CodeLineRenderParagraph paragraph in value.paragraphs) {
      //convert line number to address
      final addr =  _lineIndex2AsmAddr[firstLineIndex] ?? -1;
      _textPainter.text = TextSpan(
        text: '0x${addr.toRadixString(16).toUpperCase().padLeft(4, '0')}',
        style: paragraph.index == value.focusedIndex ? _focusedTextStyle : _textStyle
      );
      _textPainter.layout();
      _textPainter.paint(canvas, Offset(offset.dx + size.width - _textPainter.width, offset.dy + paragraph.offset.dy));
      firstLineIndex += _controller.codeLines[paragraph.index].lineCount;
    }
//....
  }
}

If we can add a callback as a parameter to CodeLineNumberRenderObject, this feature can be easily achieved. I can create a PR if you accept this idea.

Additional context
image

@svr2kos2 svr2kos2 added the enhancement New feature or request label Oct 30, 2024
@MegatronKing
Copy link
Member

Welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants