| 1726 | } |
| 1727 | |
| 1728 | void TextareaData::OnPaste() |
| 1729 | { |
| 1730 | // Remove selection |
| 1731 | if(selectionOn) |
| 1732 | DeleteSelection(); |
| 1733 | |
| 1734 | // Get pasted text |
| 1735 | OpenClipboard(areaWnd); |
| 1736 | HANDLE clipData = GetClipboardData(CF_TEXT); |
| 1737 | if(clipData) |
| 1738 | { |
| 1739 | // Find line count |
| 1740 | unsigned char *str = (unsigned char*)clipData; |
| 1741 | unsigned int linesAdded = 0; |
| 1742 | do |
| 1743 | { |
| 1744 | if(*str == '\r') |
| 1745 | linesAdded++; |
| 1746 | }while(*str++); |
| 1747 | history->TakeSnapshot(currLine, HistoryManager::LINES_ADDED, linesAdded); |
| 1748 | |
| 1749 | str = (unsigned char*)clipData; |
| 1750 | // Simulate as if the text was written |
| 1751 | while(*str) |
| 1752 | { |
| 1753 | if(*str >= 0x20 || *str == '\t') |
| 1754 | InputChar(*str); |
| 1755 | else if(*str == '\r') |
| 1756 | InputEnter(); |
| 1757 | str++; |
| 1758 | } |
| 1759 | } |
| 1760 | CloseClipboard(); |
| 1761 | // Force update on whole window |
| 1762 | InvalidateRect(areaWnd, NULL, false); |
| 1763 | } |
| 1764 | |
| 1765 | void TextareaData::OnCharacter(unsigned char ch) |
| 1766 | { |
no test coverage detected