Function for single char insertion at the cursor position
| 1338 | |
| 1339 | // Function for single char insertion at the cursor position |
| 1340 | void TextareaData::InputChar(char ch) |
| 1341 | { |
| 1342 | // We need to reallocate line buffer if it is full |
| 1343 | ExtendLine(currLine, currLine->length + 1); |
| 1344 | // If cursor is in the middle of the line, we need to move characters after it to the right |
| 1345 | if(cursorCharX != currLine->length) |
| 1346 | memmove(&currLine->data[cursorCharX+1], &currLine->data[cursorCharX], (currLine->length - cursorCharX) * sizeof(AreaChar)); |
| 1347 | currLine->data[cursorCharX].ch = ch; |
| 1348 | if(cursorCharX != 0) |
| 1349 | currLine->data[cursorCharX].style = currLine->data[cursorCharX-1].style; |
| 1350 | currLine->length++; |
| 1351 | // Move cursor forward |
| 1352 | cursorCharX++; |
| 1353 | ScrollToCursor(); |
| 1354 | // Force redraw on the modified line |
| 1355 | RECT invalid = { 0, (cursorCharY - shiftCharY) * RichTextarea::charHeight, areaWidth, (cursorCharY - shiftCharY + 1) * RichTextarea::charHeight }; |
| 1356 | InvalidateRect(areaWnd, &invalid, false); |
| 1357 | } |
| 1358 | |
| 1359 | // Function that adds line break at the cursor position |
| 1360 | void TextareaData::InputEnter() |
no test coverage detected