Skip to content

The class, method or heading you're inside stays pinned at the top of the editor as you scroll #474

Description

@a-team-app

Context

Once a method's signature scrolls off the top, nothing on screen says which method or class you're reading. This task pins the opening lines of the class, method or Markdown heading you're inside at the top of the editor as you scroll, the way VS Code's Sticky Scroll and JetBrains' sticky lines do. Pitch: #349.

Depends on #442 (Terminal.Gui 2.5), which changes the editor's draw loop that this task draws into.

Acceptance criteria

  • Scroll into the middle of a long method in a C# file: the line that opens its class and the line that opens the method stay pinned at the top of the editor, above the text.
  • Each pinned line is drawn as it is in the file, with its syntax colours and its own line number in the gutter, on the theme's current-line background.
  • Scrolling past the method's closing line drops it from the pinned lines, and the next method's line takes its place when you scroll into it.
  • Classes, interfaces, structs, enums, methods, properties with a body and Markdown headings stick. Fields, enum members and one-line properties never do.
  • In a Markdown file, the heading you're under (and the headings above it) stays pinned until the next heading of the same or a higher level.
  • Nesting deeper than three keeps the innermost three. An editor fewer than 12 rows tall shows none.
  • Moving the cursor up into the pinned lines scrolls the text instead; the cursor is never hidden under one.
  • Go to line, Go to symbol, a Find result and Back land their line below the pinned lines, not behind them.
  • Clicking a pinned line goes to that line, and Back returns you.
  • After an edit, the pinned lines catch up once the file has been rescanned, without flickering or vanishing meanwhile.
  • With word wrap on, a long pinned line shows only its first row, cut with ….
  • A plain-text file, or any file with no grammar, shows no pinned lines.
  • Settings › Editor has a CheckBox, [x] Show sticky lines, below Wrap long lines, on by default. Unticking it removes the pinned lines at once, and the choice is remembered.
  • Diff tabs and document tabs (the PR overview) show no pinned lines.

Tests

  • Enclosure: for a given top line, which definitions enclose it, by indentation for code (up to and including the closing line) and by heading level for Markdown; non-enclosing kinds (fields, enum members, one-line properties) excluded.
  • The cap of three, innermost kept, and none below 12 rows.
  • Cursor movement and every jump keep the target line clear of the pinned rows.
  • Clicking a pinned row navigates and records a Back entry.
  • Pinned lines stay stable across an edit until the rescan completes.
  • The setting: default on, persisted, and applied live.
  • Draw tests for the pinned rows' colours, gutter numbers and … under wrap.

Out of scope

  • Diff and document tabs.
  • A breadcrumb bar, a status-bar readout, or Go to symbol opening on the current symbol.
  • Syntax-tree or language-server accuracy; enclosure is by indentation.
  • Pinning non-definition blocks (if, for, using).
  • A toggle command or a configurable line count.

Activity

  1. a-team-app commented on Oct 8, 2026

    @a-team-app
    ContributorAuthor

    Blocked by #442: Terminal.Gui 2.5 changes the editor's draw loop, which the pinned lines draw into

  2. a-team-app commented on Oct 10, 2026

    @a-team-app
    ContributorAuthor

    Draft PR #503 is up.

  3. added a commit that references this issue on Oct 11, 2026
    6e1525c
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

    a-team:devClaimed by the a-team Dev

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions