Function is called after setting style to text parts. It copies style information from linear buffer to AreaLine list
| 857 | |
| 858 | // Function is called after setting style to text parts. It copies style information from linear buffer to AreaLine list |
| 859 | void RichTextarea::EndStyleUpdate(HWND wnd) |
| 860 | { |
| 861 | TextareaData *data = GetData(wnd); |
| 862 | |
| 863 | AreaLine *curr = data->firstLine; |
| 864 | // i has the position inside linear buffer |
| 865 | // n has the position inside a line |
| 866 | // Update only to the last edited position |
| 867 | for(unsigned int i = 0, n = 0; i < maximumEnd && curr;) |
| 868 | { |
| 869 | if(n < curr->length) // Until n reaches line size, add style information to it |
| 870 | { |
| 871 | curr->data[n].style = data->areaTextEx[i]; |
| 872 | i++; |
| 873 | n++; |
| 874 | }else{ // After that, |
| 875 | i += 2; // skip the \r\n symbols, present after each line in linear buffer |
| 876 | n = 0; // Returning to the first symbol |
| 877 | curr = curr->next; // At the next line. |
| 878 | } |
| 879 | } |
| 880 | } |
| 881 | |
| 882 | void RichTextarea::SetStyleToLine(HWND wnd, unsigned int line, unsigned int style) |
| 883 | { |