diff options
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/ScintillaGTK.cxx | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index f0fc63310..7b039dc3c 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -14,6 +14,7 @@ #include <string> #include <vector> #include <map> +#include <algorithm> #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> @@ -1449,14 +1450,14 @@ void ScintillaGTK::ClaimSelection() { primarySelection = true; gtk_selection_owner_set(GTK_WIDGET(PWidget(wMain)), GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME); - primary.Free(); + primary.Clear(); } else if (OwnPrimarySelection()) { primarySelection = true; - if (primary.s == NULL) + if (primary.Empty()) gtk_selection_owner_set(NULL, GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME); } else { primarySelection = false; - primary.Free(); + primary.Clear(); } } @@ -1480,7 +1481,7 @@ void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, Selectio // Return empty string if selection is not a string if ((selectionTypeData != GDK_TARGET_STRING) && (selectionTypeData != atomUTF8)) { - selText.Copy("", 1, SC_CP_UTF8, 0, false, false); + selText.Clear(); return; } @@ -1540,9 +1541,9 @@ void ScintillaGTK::ReceivedSelection(GtkSelectionData *selection_data) { sel.Range(sel.Main()).Start(); if (selText.rectangular) { - PasteRectangular(selStart, selText.s, selText.len-1); + PasteRectangular(selStart, selText.Data(), selText.Length()); } else { - InsertPaste(selStart, selText.s, selText.len-1); + InsertPaste(selStart, selText.Data(), selText.Length()); } EnsureCaretVisible(); } @@ -1566,7 +1567,7 @@ void ScintillaGTK::ReceivedDrop(GtkSelectionData *selection_data) { if (TypeOfGSD(selection_data) > 0) { SelectionText selText; GetGtkSelectionText(selection_data, selText); - DropAt(posDrop, selText.s, false, selText.rectangular); + DropAt(posDrop, selText.Data(), selText.Length(), false, selText.rectangular); } } else if (LengthOfGSD(selection_data) > 0) { //~ fprintf(stderr, "ReceivedDrop other %p\n", static_cast<void *>(selection_data->type)); @@ -1583,7 +1584,7 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se // from code below SelectionText *newline_normalized = NULL; { - std::string tmpstr = Document::TransformLineEnds(text->s, text->len, SC_EOL_LF); + std::string tmpstr = Document::TransformLineEnds(text->Data(), text->Length(), SC_EOL_LF); newline_normalized = new SelectionText(); newline_normalized->Copy(tmpstr, SC_CP_UTF8, 0, text->rectangular, false); text = newline_normalized; @@ -1595,7 +1596,7 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se if ((text->codePage != SC_CP_UTF8) && (info == TARGET_UTF8_STRING)) { const char *charSet = ::CharacterSetID(text->characterSet); if (*charSet) { - std::string tmputf = ConvertText(text->s, text->len-1, "UTF-8", charSet, false); + std::string tmputf = ConvertText(text->Data(), text->Length(), "UTF-8", charSet, false); converted = new SelectionText(); converted->Copy(tmputf, SC_CP_UTF8, 0, text->rectangular, false); text = converted; @@ -1609,8 +1610,8 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se // All other tested aplications behave benignly by ignoring the \0. // The #if is here because on Windows cfColumnSelect clip entry is used // instead as standard indicator of rectangularness (so no need to kludge) - const char *textData = text->s ? text->s : ""; - int len = strlen(textData); + const char *textData = text->Data(); + int len = text->Length(); #if PLAT_GTK_WIN32 == 0 if (text->rectangular) len++; @@ -1657,7 +1658,7 @@ void ScintillaGTK::UnclaimSelection(GdkEventSelection *selection_event) { if (selection_event->selection == GDK_SELECTION_PRIMARY) { //Platform::DebugPrintf("UnclaimPrimarySelection\n"); if (!OwnPrimarySelection()) { - primary.Free(); + primary.Clear(); primarySelection = false; FullPaint(); } @@ -1798,7 +1799,7 @@ gint ScintillaGTK::PressThis(GdkEventButton *event) { } else if (event->button == 2) { // Grab the primary selection if it exists SelectionPosition pos = SPositionFromLocation(pt, false, false, UserVirtualSpace()); - if (OwnPrimarySelection() && primary.s == NULL) + if (OwnPrimarySelection() && primary.Empty()) CopySelectionRange(&primary); sel.Clear(); @@ -2544,7 +2545,7 @@ void ScintillaGTK::SelectionGet(GtkWidget *widget, try { //Platform::DebugPrintf("Selection get\n"); if (SelectionOfGSD(selection_data) == GDK_SELECTION_PRIMARY) { - if (sciThis->primary.s == NULL) { + if (sciThis->primary.Empty()) { sciThis->CopySelectionRange(&sciThis->primary); } sciThis->GetSelection(selection_data, info, &sciThis->primary); |