RSyntaxTextArea icon indicating copy to clipboard operation
RSyntaxTextArea copied to clipboard

Add ability to skip line numbers in LineNumberList, or make Gutter.lineNumberList mutable

Open paul-griffith opened this issue 5 years ago • 0 comments

Feature request is extremely niche, but required for an application I develop. Users are presented with a code editor that acts like a function - there's a fixed function definition and documentation comment, then the user's content. I don't use the documentation comment when actually saving or compiling their script - both for optimization, and so that I can freely change the documentation as needed. I would like to be able to customize the rendering in LineNumberList so that I can 'skip' the visible line numbers by a certain amount.

I can't really imagine what other circumstances someone else might need this functionality, so before I file a PR I wanted to ask:

  1. Would you be interested in adding this feature? What I'm currently working with would add two fields to LineNumberList - omittedLineNumbers, which would just a Set<Integer> or int[] that specifies which line indexes to skip, and countOmittedLines - whether the line index should increment for these skipped lines or not. My application only actually needs omittedLineNumbers and countOmittedLines = false, but I figure I'd make the API more flexible - if you want to add this.
  2. If you (totally justifiably) don't want to add this first party, can I file a PR to add a getter/setter to Gutter.lineNumberList. It looks like if I had that, I could handle the line numbering myself with a subclass of LineNumberList; you don't have to worry about maintaining this, and I don't have to worry about implementing my own gutter.

Figure for reference - if there's an error in the user's first line of scripting, it's reported as line 2, but line 10 by the UI, which leads to confusion: image

paul-griffith avatar May 13 '20 01:05 paul-griffith