Hi John, > This is how I do it in stedit.cpp in the modules/wxstedit/src dir.
Should have checked there; I came up with very similar code, but also included DocLineFromVisible: function isLineVisible(line) local firstline = editor:DocLineFromVisible(editor:GetFirstVisibleLine()) local lastline = math.min(editor:GetLineCount(), editor:DocLineFromVisible(editor:GetFirstVisibleLine() + editor:LinesOnScreen())) return line >= firstline and line <= lastline end This is needed because lines can be wrapped (as they are in my case), but LinesOnScreen counts those as well (so the number on the screen will be larger than the number in the document). Paul. On Mon, Feb 25, 2013 at 9:28 PM, John Labenski <jlaben...@gmail.com> wrote: > On Mon, Feb 25, 2013 at 1:30 PM, Paul K <paulclin...@yahoo.com> wrote: >> In the best tradition of self-answering, it turned out that >> GetLineVisible doesn't do what I need: it only checks against whether >> the line is hidden because of folding (not if it's outside of the >> visible area, which is what I'm looking for). I don't see any other >> API method that does this, so I calculate it myself using >> GetFirstVisibleLine, LinesOnScreen, and DocLineFromVisible. > > Yes. It doesn't have the clearest name. I think you know this, but the > wxStyledTextCtrl function names map pretty closely to Scintilla's > message names. > > http://www.scintilla.org/ScintillaDoc.html#SCI_GETLINEVISIBLE > > > This is how I do it in stedit.cpp in the modules/wxstedit/src dir. > > int first_line = top_line < 0 ? GetFirstVisibleLine() : top_line; > int line_count = GetLineCount(); > int lines_visible = LinesOnScreen(); > int last_line = bottom_line < 0 ? wxMin(line_count, first_line > + lines_visible) : bottom_line; > > > Regards, > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb > _______________________________________________ > wxlua-users mailing list > wxlua-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wxlua-users ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users