@@ -425,9 +425,12 @@ char EditBuffer::getChar(int pos) const {
425425}
426426
427427int EditBuffer::insertChars (int pos, const char *text, int num) {
428+ #if defined(_SDL)
428429 if (num == 1 && *text < 0 ) {
430+ // avoid spurious keyboard characters
429431 return 0 ;
430432 }
433+ #endif
431434 int required = _len + num + 1 ;
432435 if (required >= _size) {
433436 _size += (required + GROW_SIZE);
@@ -542,7 +545,7 @@ void TextEditInput::completeWord(const char *word) {
542545 int start = wordStart ();
543546 int end = _state.cursor ;
544547 int len = end - start;
545- int insertLen = strlen (word) - len;
548+ size_t insertLen = strlen (word) - len;
546549 int index = end == 0 ? 0 : end - 1 ;
547550 bool lastUpper = isupper (_buf._buffer [index]);
548551
@@ -558,7 +561,7 @@ const char *TextEditInput::completeKeyword(int index) {
558561 const char *help = nullptr ;
559562 char *selection = getWordBeforeCursor ();
560563 if (selection != nullptr ) {
561- int len = strlen (selection);
564+ size_t len = strlen (selection);
562565 int count = 0 ;
563566 for (auto & i : keyword_help) {
564567 if (strncasecmp (selection, i.keyword , len) == 0 &&
@@ -1240,7 +1243,7 @@ void TextEditInput::calcMargin() {
12401243void TextEditInput::changeCase () {
12411244 int start, end;
12421245 char *selection = getSelection (&start, &end);
1243- int len = strlen (selection);
1246+ size_t len = strlen (selection);
12441247 enum { up, down, mixed } curcase = isupper (selection[0 ]) ? up : down;
12451248
12461249 for (int i = 1 ; i < len; i++) {
@@ -1330,7 +1333,7 @@ void TextEditInput::editEnter() {
13301333
13311334 // check whether the previous line was a comment
13321335 char *buf = lineText (prevLineStart);
1333- int length = strlen (buf);
1336+ size_t length = strlen (buf);
13341337 int pos = 0 ;
13351338 while (buf && (buf[pos] == ' ' || buf[pos] == ' \t ' )) {
13361339 pos++;
@@ -1498,7 +1501,7 @@ void TextEditInput::findMatchingBrace() {
14981501int TextEditInput::getCompletions (StringList *list, int max) {
14991502 int count = 0 ;
15001503 char *selection = getWordBeforeCursor ();
1501- unsigned len = selection != nullptr ? strlen (selection) : 0 ;
1504+ size_t len = selection != nullptr ? strlen (selection) : 0 ;
15021505 if (len > 0 ) {
15031506 for (int i = 0 ; i < keyword_help_len && count < max; i++) {
15041507 if (strncasecmp (selection, keyword_help[i].keyword , len) == 0 ) {
@@ -2128,7 +2131,7 @@ void TextEditHelpWidget::createCompletionHelp() {
21282131 reset (kCompletion );
21292132
21302133 char *selection = _editor->getWordBeforeCursor ();
2131- int len = selection != nullptr ? strlen (selection) : 0 ;
2134+ size_t len = selection != nullptr ? strlen (selection) : 0 ;
21322135 if (len > 0 ) {
21332136 StringList words;
21342137 for (auto & i : keyword_help) {
@@ -2353,7 +2356,7 @@ void TextEditHelpWidget::reset(HelpMode mode) {
23532356}
23542357
23552358bool TextEditHelpWidget::selected (MAPoint2d pt, int scrollX, int scrollY, bool &redraw) {
2356- bool result = hasFocus ();
2359+ bool result = hasFocus () && FormEditInput::overlaps (pt, scrollX, scrollY) ;
23572360 if (result) {
23582361 dragPage (pt.y , redraw);
23592362 }
0 commit comments