Function is used to reserve space in linear text buffer
| 808 | |
| 809 | // Function is used to reserve space in linear text buffer |
| 810 | void TextareaData::ExtendLinearTextBuffer() |
| 811 | { |
| 812 | // Size that is needed is calculated by summing lengths of all lines |
| 813 | overallLength = 0; |
| 814 | AreaLine *curr = firstLine; |
| 815 | while(curr) |
| 816 | { |
| 817 | // AreaLine doesn't have the line endings (or any other special symbols) |
| 818 | // But GetAreaText() returns text with \r\n at the end, so we have to add |
| 819 | overallLength += curr->length + 2; // additional 2 bytes for \r\n |
| 820 | curr = curr->next; |
| 821 | } |
| 822 | if(overallLength >= areaTextSize) |
| 823 | { |
| 824 | // Reserve more than is needed |
| 825 | areaTextSize = overallLength + overallLength / 2; |
| 826 | delete[] areaText; |
| 827 | delete[] areaTextEx; |
| 828 | areaText = new char[areaTextSize]; |
| 829 | areaTextEx = new char[areaTextSize]; |
| 830 | memset(areaText, 0, areaTextSize); |
| 831 | memset(areaTextEx, 0, areaTextSize); |
| 832 | } |
| 833 | } |
| 834 | |
| 835 | // Last edited position |
| 836 | unsigned int maximumEnd; |
no outgoing calls
no test coverage detected