Most efficient line:col indiator

8 views
Skip to first unread message

seasoned_geek

unread,
Sep 1, 2021, 2:53:03 PM9/1/21
to scintilla-interest
All,

If one wants to put a Line:Column display in the status bar, what is considered the "most efficient" way of obtaining that information?

Is it catching the notifyParent() signal in a slot then checking the Position line; value to see if it is different from the last then calling lineFromPosition( line) and column(line) if line has changed?

Seems like there ought to be some kind of signal/message just for that I'm missing. Thought I would ask here just to be sure.

Thanks,
Roland

Mitchell

unread,
Sep 1, 2021, 3:35:21 PM9/1/21
to scintilla...@googlegroups.com
Hi,
Listen for SCN_UPDATEUI and check for SC_UPDATE_SELECTION. If that bit flag is set, you can query for the current line and column for display.

Cheers,
Mitchell
Cheers,
Mitchell

seasoned_geek

unread,
Sep 2, 2021, 12:52:32 PM9/2/21
to scintilla-interest
Thanks!

I ended up connecting to the updateUI signal this slot.

void EdtBaseWidget::handleUpdateUI(Scintilla::Update updated) {
    if (Scintilla::Update::None != updated) {
        sptr_t pos = currentPos();
        // position values are zero based but
        // line number display will start at 1
        //
        updateLineCol(lineFromPosition(pos)+1, column(pos)+1);
    }
}

Then the higher level class already had what it really needed once it caught that signal.
Reply all
Reply to author
Forward
0 new messages