X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e600c175c01c12dafdabbe9c758ea5559e1556d1..be604faa7b2134e60a1e12d74c9c62b946a259ac:/src/mac/carbon/textctrl.cpp diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index 141042b1ae..4f8d67ae6d 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -889,6 +889,7 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style) { OSStatus status = TXNSetTypeAttributes ((TXNObject)m_macTXN, attrCounter , typeAttr, start,end); + wxASSERT_MSG( status == noErr , "Couldn't set text attributes" ) ; } SetEditable(formerEditable) ; } @@ -995,7 +996,6 @@ bool wxTextCtrl::CanPaste() const if (!IsEditable()) return FALSE; - long offset ; #if TARGET_CARBON OSStatus err = noErr; ScrapRef scrapRef; @@ -1017,6 +1017,7 @@ bool wxTextCtrl::CanPaste() const return FALSE; #else + long offset ; if ( GetScrap( NULL , 'TEXT' , &offset ) > 0 ) { return TRUE ; @@ -1040,7 +1041,7 @@ void wxTextCtrl::SetEditable(bool editable) else { TXNControlTag tag[] = { kTXNIOPrivilegesTag } ; - TXNControlData data[] = { editable ? kTXNReadWrite : kTXNReadOnly } ; + TXNControlData data[] = { { editable ? kTXNReadWrite : kTXNReadOnly } } ; TXNSetTXNObjectControls( (TXNObject) m_macTXN , false , sizeof(tag) / sizeof (TXNControlTag) , tag , data ) ; } } @@ -1217,8 +1218,8 @@ void wxTextCtrl::Clear() } else { - ClearCurrentScrap(); - TXNClear((TXNObject)m_macTXN); + TXNSetSelection( (TXNObject)m_macTXN , kTXNStartOffset , kTXNEndOffset ) ; + TXNClear((TXNObject)m_macTXN); } Refresh() ; } @@ -1312,7 +1313,7 @@ int wxTextCtrl::GetNumberOfLines() const wxString content = GetValue() ; int count = 1; - for (int i = 0; i < content.Length() ; i++) + for (size_t i = 0; i < content.Length() ; i++) { if (content[i] == '\r') count++; } @@ -1343,13 +1344,13 @@ int wxTextCtrl::GetLineLength(long lineNo) const // Find line first int count = 0; - for (int i = 0; i < content.Length() ; i++) + for (size_t i = 0; i < content.Length() ; i++) { if (count == lineNo) { // Count chars in line then count = 0; - for (int j = i; j < content.Length(); j++) + for (size_t j = i; j < content.Length(); j++) { count++; if (content[j] == '\r') return count; @@ -1369,14 +1370,14 @@ wxString wxTextCtrl::GetLineText(long lineNo) const // Find line first int count = 0; - for (int i = 0; i < content.Length() ; i++) + for (size_t i = 0; i < content.Length() ; i++) { if (count == lineNo) { // Add chars in line then wxString tmp(""); - for (int j = i; j < content.Length(); j++) + for (size_t j = i; j < content.Length(); j++) { if (content[j] == '\r') return tmp;