File tree Expand file tree Collapse file tree 3 files changed +33
-11
lines changed Expand file tree Collapse file tree 3 files changed +33
-11
lines changed Original file line number Diff line number Diff line change 77 Fix keyboard handling for non-us keymaps
88 Fix Ctrl+Home editor keystroke handler
99 Fix crash with online command if site is down
10+ Fix over scroll issue with line number widget
1011 Implemented editor F2 command to display online help
1112
12132015-10-20
Original file line number Diff line number Diff line change 1313#include " ui/textedit.h"
1414#include " platform/sdl/syswm.h"
1515
16- void onlineHelp (const char *nodeId) {
17- if (nodeId != NULL ) {
18- char path[100 ];
16+ void onlineHelp (TextEditInput *widget) {
17+ char path[100 ];
18+ const char *nodeId = widget->getNodeId ();
19+ if (nodeId != NULL && nodeId[0 ] != ' 0' ) {
1920 sprintf (path, " http://smallbasic.sf.net/?q=node/%s" , nodeId);
20- browseFile (path);
21+ } else {
22+ char *selection = widget->getWordBeforeCursor ();
23+ if (selection != NULL ) {
24+ sprintf (path, " http://smallbasic.sf.net/?q=search/node/%s" , selection);
25+ free (selection);
26+ } else {
27+ sprintf (path, " http://smallbasic.sf.net" );
28+ }
2129 }
30+ browseFile (path);
2231}
2332
2433void System::editSource (strlib::String &loadPath) {
@@ -141,7 +150,7 @@ void System::editSource(strlib::String &loadPath) {
141150 break ;
142151 case SB_KEY_F (2 ):
143152 redraw = false ;
144- onlineHelp (widget-> getNodeId () );
153+ onlineHelp (editWidget );
145154 break ;
146155 case SB_KEY_F (5 ):
147156 saveFile (editWidget, loadPath);
Original file line number Diff line number Diff line change @@ -1285,13 +1285,25 @@ void TextEditInput::gotoNextMarker() {
12851285 }
12861286}
12871287
1288- void TextEditInput::lineNavigate (bool lineDown) {
1289- if (lineDown) {
1288+ void TextEditInput::lineNavigate (bool arrowDown) {
1289+ if (arrowDown) {
1290+ // starting from the cursor position (relative to the screen),
1291+ // count the number of rows to the bottom of the document.
1292+ int rowCount = _cursorLine - _scroll;
12901293 for (int i = _state.cursor ; i < _buf._len ; i++) {
1291- if (_buf._buffer [i] == ' \n ' && i + 1 < _buf._len ) {
1292- _state.cursor = i + 1 ;
1293- _scroll += 1 ;
1294- break ;
1294+ if (_buf._buffer [i] == ' \n ' ) {
1295+ rowCount++;
1296+ }
1297+ }
1298+ int pageRows = (_height / _charHeight) - 1 ;
1299+ if (rowCount >= pageRows) {
1300+ // rows exist below end of page to pull up
1301+ for (int i = _state.cursor ; i < _buf._len ; i++) {
1302+ if (_buf._buffer [i] == ' \n ' && i + 1 < _buf._len ) {
1303+ _state.cursor = i + 1 ;
1304+ _scroll += 1 ;
1305+ break ;
1306+ }
12951307 }
12961308 }
12971309 } else if (_scroll > 0 ) {
You can’t perform that action at this time.
0 commit comments