Menu

#838 Statusbar : add position of the caret

closed
SciTE (288)
5
2011-11-02
2011-08-03
No

Hi Neil,
IMHO, it looks useful to add the position of the caret into the statusbar.
Please find patch in attachment.
Jérôme

Discussion

  • Jérôme LAFORGE

     
  • Jérôme LAFORGE

    I propose this another patch that also adds LineLength.
    If that worth, then you can change the default statusbar.text.1
    statusbar.text.1=\
    li=$(LineNumber)/$(NbOfLines) co=$(ColumnNumber)/$(LineLength) curPos=$(CaretPosition)/$(BufferLength) $(OverType) ($(EOLMode)) $(FileAttr)

    w/ or w/o : curPos=$(CaretPosition)/$(BufferLength)

     
  • Jérôme LAFORGE

     
  • Neil Hodgson

    Neil Hodgson - 2011-08-03

    Users can display anything they want in the status bar by defining properties and using them in statusbar.text.<n> The properties can be set in an OnUpdateUI script like

    local xxx = 999
    function OnUpdateUI()
    xxx = xxx +3
    props['xxx'] = xxx
    end

    Then add $(xxx) into the status bar:

    statusbar.text.1=\
    $(xxx) li=$(LineNumber) co=$(ColumnNumber) $(OverType) ($(EOLMode)) $(FileAttr) code.page=$(code.page)

    While the examples here are of some use, there are a very large number of potentially useful values that can be extracted from the document and displayed in the status bar. It is better for users to understand the mechanism so that they can produce something useful to them rather than to have a long list of canned variables.

     
  • Neil Hodgson

    Neil Hodgson - 2011-08-03
    • assigned_to: nobody --> nyamatongwe
     
  • Jérôme LAFORGE

    Thx for the explanation.
    I will try to do this script to add this value into statusbar.

     
  • Jérôme LAFORGE

    I don't know if that worths to include this script into the repository of SciTE. In this case, I don't know how to include it into scite source code. Anyway, I post it into this issue.

    function OnUpdateUI()
    local caretPos = scite.SendEditor(SCI_GETCURRENTPOS);
    props['CaretPosition'] = caretPos;
    local lineLength = scite.SendEditor(SCI_GETCOLUMN,
    scite.SendEditor(SCI_GETLINEENDPOSITION,
    scite.SendEditor(SCI_LINEFROMPOSITION, caretPos))) + 1;
    props['LineLength'] = lineLength;
    end

    Jérôme

     
  • Neil Hodgson

    Neil Hodgson - 2011-11-02
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB