Skip to content

Fix gutter line-number alignment with editor text#320

Open
FeodorFitsner wants to merge 1 commit intoakvelon:mainfrom
flet-dev:gutter-fix
Open

Fix gutter line-number alignment with editor text#320
FeodorFitsner wants to merge 1 commit intoakvelon:mainfrom
flet-dev:gutter-fix

Conversation

@FeodorFitsner
Copy link

Fixes vertical misalignment between gutter line numbers and code text in CodeField.

Fixes: #215, #312

Gutter and editor were using different/duplicated vertical spacing paths, which caused numbers to drift from code lines.

Changes

  • Unified padding so gutter and editor share the same vertical origin.
  • Removed duplicated vertical padding paths.
  • Kept line-height behavior consistent between code and line numbers.
  • Adjusted popup offset calculations to match the new padding model.

Files changed

  • lib/src/code_field/code_field.dart
  • lib/src/gutter/gutter.dart

Validation

  • Checked visually in example app (03.change_language_theme).
  • Ran:
    • dart analyze lib/src/code_field/code_field.dart lib/src/gutter/gutter.dart
    • flutter test test/src/code_field/code_controller_shortcut_test.dart

- normalize shared content padding via CodeField.padding

- remove duplicated vertical paddings between gutter and TextField

- use strut-based line height for code and gutter numbers

- keep popup offsets consistent with new padding model
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.

Gutter and text is not vertically aligned

1 participant