Menu

#2 Add relative line numbers

1.0
closed
Feature (2)
2024-04-28
2023-03-31
dtyl
No

Hi,
As the name of your plugin does not suggest a restriction to hexadecimal line numbers, could you extend your plugin to allow relative line numbers? I almost never developed in Pascal (and I don't have any dev environment for that) but here joined is a draft small and obviously incomplete suggestion patch of the modifications to bring (I don't know how you can retrieve the current line number?).
Thanks.

1 Attachments

Discussion

  • Andreas Heim

    Andreas Heim - 2023-03-31

    At first I want to ensure that I understood your feature request in the right way.

    You want line numbers that are relative to the caret's current line and you want them to be prefixed by a sign:

    • a minus sign for line numbers before the caret's current line
    • a plus sign for line numbers after the caret's current line
    • no sign for the caret's current line because its line number should be zero

    Is this correct?

     
  • dtyl

    dtyl - 2023-03-31

    Note that sign may be omitted if difference between the current line and other lines is obvious (ex. current line number left-aligned, offsets right-aligned and always starting from 1).

     

    Last edit: dtyl 2023-03-31
  • Andreas Heim

    Andreas Heim - 2023-03-31

    Thank you for your feedback.

    I think I prefer the kind of implementation like in VS Code, i.e. current line number left aligned, relative line numbers right aligned without a sign.

    If this is not possible (how to adjust the width of line numbers margin to be able to right/left align numbers? how to right/left align at all?) I will implement it like in your posting above: current line number (0- or 1-based, according to user's setting) and relative line numbers with a sign.

    IMO relative line numbers in hex make no sense, these are different use cases, so I will make these features exclusive.

    Nevertheless, it can take some time until I'm able to successfully implement this feature, so please be patient.

     
    • dtyl

      dtyl - 2023-03-31

      Thank you for your consideration Andreas :) There is no hurry.

       
  • Andreas Heim

    Andreas Heim - 2024-03-22

    It took almost one year but now it's done. I integrated the relative line numbers feature that you requested. I hope I didn't strain your patience too much.

    However, I was not able to implement the feature as I wanted one year ago. It is not possible to left align the current line number when in relative-line-numbers mode since Scintilla, the underlying edit component used by Notepad++, allows only to set the character alignment for the whole line numbers margin, not for a certain line only. So I decided to include configuration options to customize the font of the current line number (when in relative-line-numbers mode). It is possible to change the fonts size, color and style (bold, italic and bold-italic).

    Please test the new version v1.1.9 of the plugin and give some feedback, especially if you find bugs. You can download it from the "Files" section of this repository.

     

    Last edit: Andreas Heim 2024-03-23
  • Andreas Heim

    Andreas Heim - 2024-04-28
    • status: pending --> closed
     
  • Andreas Heim

    Andreas Heim - 2024-04-28

    Solved in v1.1.9. Ticket closed.

     

Log in to post a comment.