Menu

#841 highlight current line, i.e. screen line

Committed
closed
3
2021-09-22
2011-08-07
notjohn
No

Highlighting the current line on long wrapped text is a pain. It does not help, it hinders.

Please only highlight the physical cursor line edge to edge.

Discussion

  • Neil Hodgson

    Neil Hodgson - 2011-08-08

    If this is implemented, it should be an option.

    Since I do not use line highlighting, I will not work on this feature myself.

     
  • Neil Hodgson

    Neil Hodgson - 2011-08-08
    • assigned_to: nobody --> nyamatongwe
    • priority: 5 --> 3
    • milestone: --> Won't_Implement
     
  • Zufu Liu

    Zufu Liu - 2021-08-22

    Attachment contains an implementation that works for Notepad2 (can be toggled from menu View -> Highlight Current LIne -> Highlight Subline), https://github.com/zufuliu/notepad2/commit/405b8218cbc820e455618484edad40303ddc0edd

    I don't figured out why the same changes not works for SciTE (by hardcoded caretLine.subLine = true; in ViewStyle::Init()).

     
    • Neil Hodgson

      Neil Hodgson - 2021-08-22

      I don't figured out why the same changes not works for SciTE (by hardcoded caretLine.subLine = true; in ViewStyle::Init()).

      The default (on layer 0) is to change the background colour of the line in ViewStyle::Background when its the caret line. This uses LineLayout::containsCaret which is set in EditView::PaintText without checking whether its in the subline.

       
      • Neil Hodgson

        Neil Hodgson - 2021-08-22

        Logically, LineLayout should be const for drawing and changing it to reflect local context is a kludge. Perhaps its time to move containsCaret, hotspot, xHighlightGuide and potentially others into a new argument to drawing. The difficult case is brace highlighting as that patches styles which can then be treated uniformly.

         
        • Zufu Liu

          Zufu Liu - 2021-08-26

          Patch to remove the hotspot field, as it only used inside DrawBackground() and DrawForeground(), it can be removed completely.

           
          • Neil Hodgson

            Neil Hodgson - 2021-08-26

            Committed with minor edits as [46ec6c].

             

            Related

            Commit: [46ec6c]

  • Zufu Liu

    Zufu Liu - 2021-08-23

    Move subline checking into EditView::PaintText() indeed fixed highlighting bug for base layer + background color.

    const int caretOffset = static_cast<int>(posCaret.Position() - model.pdoc->LineStart(lineCaret));
    // ...
    ll->containsCaret = !hideSelection && (lineDoc == lineCaret)
        && (ll->lines == 1 || !vsDraw.caretLine.subLine || ll->InLine(caretOffset, subLine));
    

    The change seems will not affects other usages of containsCaret.

     
  • Neil Hodgson

    Neil Hodgson - 2021-08-24
    • labels: Scintilla --> Scintilla, wrap, caret line highlight
    • Group: Won't_Implement --> Committed
     
  • Neil Hodgson

    Neil Hodgson - 2021-08-24

    Committed with minor edits as [d72368].

     

    Related

    Commit: [d72368]

  • Neil Hodgson

    Neil Hodgson - 2021-09-22
    • status: open --> closed
     

Log in to post a comment.