aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gtk/ScintillaGTK.cxx5
-rw-r--r--src/Editor.cxx16
-rw-r--r--src/Editor.h1
-rw-r--r--src/ViewStyle.cxx3
-rw-r--r--src/ViewStyle.h1
5 files changed, 22 insertions, 4 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index a0cafa93a..8fbc58a10 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -556,6 +556,7 @@ void ScintillaGTK::ClaimSelection() {
// X Windows has a 'primary selection' as well as the clipboard.
// Whenever the user selects some text, we become the primary selection
if (currentPos != anchor) {
+ primarySelection = true;
gtk_selection_owner_set(GTK_WIDGET(wDraw.GetID()),
GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME);
delete []primarySelectionCopy;
@@ -563,9 +564,11 @@ void ScintillaGTK::ClaimSelection() {
} else if (OwnPrimarySelection()) {
if (primarySelectionCopy == NULL)
gtk_selection_owner_set(NULL, GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME);
+ primarySelection = true;
} else {
delete []primarySelectionCopy;
primarySelectionCopy = NULL;
+ primarySelection = false;
}
}
@@ -659,6 +662,8 @@ void ScintillaGTK::UnclaimSelection(GdkEventSelection *selection_event) {
if (selection_event->selection == GDK_SELECTION_PRIMARY) {
delete [] primarySelectionCopy;
primarySelectionCopy = NULL;
+ primarySelection = false;
+ FullPaint();
}
}
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 487a4c4f7..3f721d57e 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -61,7 +61,8 @@ Editor::Editor() {
selType = selStream;
xStartSelect = 0;
xEndSelect = 0;
-
+ primarySelection = true;
+
caretPolicy = CARET_SLOP;
caretSlop = 0;
@@ -842,8 +843,12 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
Font &textFont = vsDraw.styles[styleMain].font;
bool inSelection = (iDoc >= ll.selStart) && (iDoc < ll.selEnd) && (ll.selStart != ll.selEnd);
if (inSelection) {
- if (vsDraw.selbackset)
- textBack = vsDraw.selbackground.allocated;
+ if (vsDraw.selbackset) {
+ if (primarySelection)
+ textBack = vsDraw.selbackground.allocated;
+ else
+ textBack = vsDraw.selbackground2.allocated;
+ }
if (vsDraw.selforeset)
textFore = vsDraw.selforeground.allocated;
} else {
@@ -981,7 +986,10 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
rcSegment.right = xEol + vsDraw.aveCharWidth + xStart;
bool eolInSelection = (posLineEnd > ll.selStart) && (posLineEnd <= ll.selEnd) && (ll.selStart != ll.selEnd);
if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal()-1)) {
- surface->FillRectangle(rcSegment, vsDraw.selbackground.allocated);
+ if (primarySelection)
+ surface->FillRectangle(rcSegment, vsDraw.selbackground.allocated);
+ else
+ surface->FillRectangle(rcSegment, vsDraw.selbackground2.allocated);
} else if (marks) {
surface->FillRectangle(rcSegment, markBack);
} else {
diff --git a/src/Editor.h b/src/Editor.h
index 4f42c80a0..fb5ac9d8b 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -123,6 +123,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
enum { selStream, selRectangle, selRectangleFixed } selType;
int xStartSelect;
int xEndSelect;
+ bool primarySelection;
int caretPolicy;
int caretSlop;
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index da35a23fc..fae8eb53b 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -69,6 +69,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
selforeground.desired = source.selforeground.desired;
selbackset = source.selbackset;
selbackground.desired = source.selbackground.desired;
+ selbackground2.desired = source.selbackground2.desired;
selbar.desired = source.selbar.desired;
selbarlight.desired = source.selbarlight.desired;
caretcolour.desired = source.caretcolour.desired;
@@ -113,6 +114,7 @@ void ViewStyle::Init() {
selforeground.desired = Colour(0xff, 0, 0);
selbackset = true;
selbackground.desired = Colour(0xc0, 0xc0, 0xc0);
+ selbackground2.desired = Colour(0xb0, 0xb0, 0xb0);
selbar.desired = Platform::Chrome();
selbarlight.desired = Platform::ChromeHighlight();
styles[STYLE_LINENUMBER].fore.desired = Colour(0, 0, 0);
@@ -166,6 +168,7 @@ void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
}
pal.WantFind(selforeground, want);
pal.WantFind(selbackground, want);
+ pal.WantFind(selbackground2, want);
pal.WantFind(selbar, want);
pal.WantFind(selbarlight, want);
pal.WantFind(caretcolour, want);
diff --git a/src/ViewStyle.h b/src/ViewStyle.h
index 68e59d29e..5b0ab1925 100644
--- a/src/ViewStyle.h
+++ b/src/ViewStyle.h
@@ -42,6 +42,7 @@ public:
ColourPair selforeground;
bool selbackset;
ColourPair selbackground;
+ ColourPair selbackground2;
ColourPair selbar;
ColourPair selbarlight;
// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin