aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-03-30 19:34:53 +1100
committerNeil <nyamatongwe@gmail.com>2021-03-30 19:34:53 +1100
commitb5ba1cee2188ab879573126c62d6291b346e089c (patch)
treeaf65145d10a0b8a348a448a7bb4ded03f75a029a
parent3ca96902ea5d6d8a6b62d4abd6669d36b81377d1 (diff)
downloadscintilla-mirror-b5ba1cee2188ab879573126c62d6291b346e089c.tar.gz
Treat SC_MARK_CHARACTER as Unicode for a wider variety of symbols.
-rw-r--r--doc/ScintillaDoc.html8
-rw-r--r--doc/ScintillaHistory.html3
-rw-r--r--gtk/deps.mak3
-rw-r--r--src/LineMarker.cxx10
-rw-r--r--win32/deps.mak3
-rw-r--r--win32/nmdeps.mak3
6 files changed, 19 insertions, 11 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index 8971f4d93..db04e66c5 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -4477,10 +4477,10 @@ struct Sci_TextToFind {
<code>SC_MARK_TCORNER</code>,
<code>SC_MARK_TCORNERCURVE</code>, and
<code>SC_MARK_VLINE</code>.</p>
- Characters can be used as markers by adding the ASCII value of the character to
- <code>SC_MARK_CHARACTER</code> (10000). For example, to use 'A' (ASCII code 65) as marker
- number 1 use:<br />
- <code>SCI_MARKERDEFINE(1, SC_MARK_CHARACTER+65)</code>. <br />
+ Characters can be used as markers by adding the Unicode code point of the character to
+ <code>SC_MARK_CHARACTER</code> (10000). For example, to use '&#9637;' SQUARE WITH VERTICAL FILL
+ (Unicode code point 9637) as marker number 1 use:<br />
+ <code>SCI_MARKERDEFINE(1, SC_MARK_CHARACTER+9637)</code>. <br />
<p>The marker numbers <code>SC_MARKNUM_FOLDER</code> and <code>SC_MARKNUM_FOLDEROPEN</code> are
used for showing that a fold is present and open or closed. Any symbols may be assigned for
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index d8aea7a2a..2a9a2d498 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -612,6 +612,9 @@
Implement SC_ELEMENT_LIST* to change colours of autocompletion lists.
</li>
<li>
+ Support Unicode characters as margin markers with SC_MARK_CHARACTER.
+ </li>
+ <li>
Change graphics coordinates from float (32-bit) to double (64-bit).
Fixes uneven line heights in large documents on Cocoa.
Increases memory use.
diff --git a/gtk/deps.mak b/gtk/deps.mak
index 0ae4b48e5..3bd9b98b1 100644
--- a/gtk/deps.mak
+++ b/gtk/deps.mak
@@ -311,7 +311,8 @@ LineMarker.o: \
../include/Scintilla.h \
../include/Sci_Position.h \
../src/XPM.h \
- ../src/LineMarker.h
+ ../src/LineMarker.h \
+ ../src/UniConversion.h
MarginView.o: \
../src/MarginView.cxx \
../src/Debugging.h \
diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx
index 02228b6f5..ed9c1ce7a 100644
--- a/src/LineMarker.cxx
+++ b/src/LineMarker.cxx
@@ -26,6 +26,7 @@
#include "XPM.h"
#include "LineMarker.h"
+#include "UniConversion.h"
using namespace Scintilla;
@@ -530,12 +531,13 @@ void LineMarker::Draw(Surface *surface, const PRectangle &rcWhole, const Font *f
default:
if (markType >= SC_MARK_CHARACTER) {
- std::string character(1, static_cast<char>(markType - SC_MARK_CHARACTER));
- const XYPOSITION width = surface->WidthText(fontForCharacter, character);
+ char character[UTF8MaxBytes + 1];
+ UTF8FromUTF32Character(markType - SC_MARK_CHARACTER, character);
+ const XYPOSITION width = surface->WidthTextUTF8(fontForCharacter, character);
PRectangle rcText = rc;
rcText.left += (rc.Width() - width) / 2;
- rcText.right = rc.left + width;
- surface->DrawTextClipped(rcText, fontForCharacter, rcText.bottom - 2,
+ rcText.right = rcText.left + width;
+ surface->DrawTextNoClipUTF8(rcText, fontForCharacter, rcText.bottom - 2,
character, fore, back);
} else {
// treat as SC_MARK_FULLRECT
diff --git a/win32/deps.mak b/win32/deps.mak
index ed31cc100..3fd1b4765 100644
--- a/win32/deps.mak
+++ b/win32/deps.mak
@@ -280,7 +280,8 @@ LineMarker.o: \
../include/Scintilla.h \
../include/Sci_Position.h \
../src/XPM.h \
- ../src/LineMarker.h
+ ../src/LineMarker.h \
+ ../src/UniConversion.h
MarginView.o: \
../src/MarginView.cxx \
../src/Debugging.h \
diff --git a/win32/nmdeps.mak b/win32/nmdeps.mak
index f3824b54a..b831d6add 100644
--- a/win32/nmdeps.mak
+++ b/win32/nmdeps.mak
@@ -280,7 +280,8 @@ $(DIR_O)/LineMarker.obj: \
../include/Scintilla.h \
../include/Sci_Position.h \
../src/XPM.h \
- ../src/LineMarker.h
+ ../src/LineMarker.h \
+ ../src/UniConversion.h
$(DIR_O)/MarginView.obj: \
../src/MarginView.cxx \
../src/Debugging.h \