1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
# HG changeset patch
# User Neil <nyamatongwe@gmail.com>
# Date 1516925530 -39600
# Node ID 92c8f0f1b3e64900cbb868a56936898693b9cfcc
# Parent a1731ae83d2ac87c29f6b502efc5c4a747e0b704
Add documentOption argument to SCI_CREATELOADER.
diff -r a1731ae83d2a -r 92c8f0f1b3e6 doc/ScintillaDoc.html
--- a/doc/ScintillaDoc.html Tue Jan 30 12:40:53 2018 +1100
+++ b/doc/ScintillaDoc.html Fri Jan 26 11:12:10 2018 +1100
@@ -119,7 +119,7 @@
<h1>Scintilla Documentation</h1>
- <p>Last edited 10 January 2018 NH</p>
+ <p>Last edited 31 January 2018 NH</p>
<p>There is <a class="jump" href="Design.html">an overview of the internal design of
Scintilla</a>.<br />
@@ -5711,7 +5711,7 @@
<code><a class="message" href="#SCI_GETDOCPOINTER">SCI_GETDOCPOINTER → document *</a><br />
<a class="message" href="#SCI_SETDOCPOINTER">SCI_SETDOCPOINTER(<unused>, document
*doc)</a><br />
- <a class="message" href="#SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT → document *</a><br />
+ <a class="message" href="#SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT(int bytes, int documentOption) → document *</a><br />
<a class="message" href="#SCI_ADDREFDOCUMENT">SCI_ADDREFDOCUMENT(<unused>, document
*doc)</a><br />
<a class="message" href="#SCI_RELEASEDOCUMENT">SCI_RELEASEDOCUMENT(<unused>, document
@@ -5732,13 +5732,20 @@
window.<br />
6. If <code class="parameter">doc</code> was not 0, its reference count is increased by 1.</p>
- <p><b id="SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT → document *</b><br />
+ <p><b id="SCI_CREATEDOCUMENT">SCI_CREATEDOCUMENT(int bytes, int documentOption) → document *</b><br />
This message creates a new, empty document and returns a pointer to it. This document is not
- selected into the editor and starts with a reference count of 1. This means that you have
- ownership of it and must either reduce its reference count by 1 after using
+ selected into the editor and starts with a reference count of 1. This means that you have
+ ownership of it and must either reduce its reference count by 1 after using
<code>SCI_SETDOCPOINTER</code> so that the Scintilla window owns it or you must make sure that
- you reduce the reference count by 1 with <code>SCI_RELEASEDOCUMENT</code> before you close the
- application to avoid memory leaks.</p>
+ you reduce the reference count by 1 with <code>SCI_RELEASEDOCUMENT</code> before you close the
+ application to avoid memory leaks. The <code class="parameter">bytes</code> argument determines
+ the initial memory allocation for the document as it is more efficient
+ to allocate once rather than rely on the buffer growing as data is added.
+ If <code>SCI_CREATEDOCUMENT</code> fails then 0 is returned.</p>
+
+ <p>The <code class="parameter">documentOption</code> argument may be used in future versions
+ to choose between different document capabilities which affect memory allocation and performance.
+ The only valid value for now is <code>SC_DOCUMENTOPTION_DEFAULT</code> (0).</p>
<p><b id="SCI_ADDREFDOCUMENT">SCI_ADDREFDOCUMENT(<unused>, document *doc)</b><br />
This increases the reference count of a document by 1. If you want to replace the current
@@ -5765,7 +5772,7 @@
<h3 id="BackgroundLoad">Loading in the background</h3>
- <code><a class="message" href="#SCI_CREATELOADER">SCI_CREATELOADER(int bytes) → int</a><br />
+ <code><a class="message" href="#SCI_CREATELOADER">SCI_CREATELOADER(int bytes, int documentOption) → int</a><br />
</code>
<p>An application can load all of a file into a buffer it allocates on a background thread and then add the data in that buffer
@@ -5774,13 +5781,17 @@
<p>To avoid these issues, a loader object may be created and used to load the file. The loader object supports the ILoader interface.</p>
- <p><b id="SCI_CREATELOADER">SCI_CREATELOADER(int bytes) → int</b><br />
+ <p><b id="SCI_CREATELOADER">SCI_CREATELOADER(int bytes, int documentOption) → int</b><br />
Create an object that supports the <code>ILoader</code> interface which can be used to load data and then
be turned into a Scintilla document object for attachment to a view object.
The <code class="parameter">bytes</code> argument determines the initial memory allocation for the document as it is more efficient
to allocate once rather than rely on the buffer growing as data is added.
If <code>SCI_CREATELOADER</code> fails then 0 is returned.</p>
+ <p>The <code class="parameter">documentOption</code> argument may be used in future versions
+ to choose between different document capabilities which affect memory allocation and performance.
+ The only valid value for now is <code>SC_DOCUMENTOPTION_DEFAULT</code> (0).</p>
+
<h4>ILoader</h4>
<div class="highlighted">
@@ -6573,7 +6584,7 @@
On GTK+, there are storage and performance costs to accessibility, so it can be disabled
by calling <code>SCI_SETACCESSIBILITY</code>.
</p>
-
+
<table class="standard" summary="Accessibility status">
<tbody>
<tr>
@@ -6603,7 +6614,7 @@
</tr>
</tbody>
</table>
-
+
<h2 id="Lexer">Lexer</h2>
<p>If you define the symbol <code>SCI_LEXER</code> when building Scintilla, (this is sometimes
@@ -6894,7 +6905,7 @@
<p>
Methods that return strings as <code>const char *</code> are not required to maintain separate allocations indefinitely:
lexer implementations may own a single buffer that is reused for each call.
-Callers should make an immediate copy of returned strings.
+Callers should make an immediate copy of returned strings.
</p>
<p>
diff -r a1731ae83d2a -r 92c8f0f1b3e6 include/Scintilla.h
--- a/include/Scintilla.h Tue Jan 30 12:40:53 2018 +1100
+++ b/include/Scintilla.h Fri Jan 26 11:12:10 2018 +1100
@@ -689,6 +689,7 @@
#define SCI_SELECTIONISRECTANGLE 2372
#define SCI_SETZOOM 2373
#define SCI_GETZOOM 2374
+#define SC_DOCUMENTOPTION_DEFAULT 0
#define SCI_CREATEDOCUMENT 2375
#define SCI_ADDREFDOCUMENT 2376
#define SCI_RELEASEDOCUMENT 2377
diff -r a1731ae83d2a -r 92c8f0f1b3e6 include/Scintilla.iface
--- a/include/Scintilla.iface Tue Jan 30 12:40:53 2018 +1100
+++ b/include/Scintilla.iface Fri Jan 26 11:12:10 2018 +1100
@@ -1771,9 +1771,12 @@
# Retrieve the zoom level.
get int GetZoom=2374(,)
+enu DocumentOption=SC_DOCUMENTOPTION_
+val SC_DOCUMENTOPTION_DEFAULT=0
+
# Create a new document object.
# Starts with reference count of 1 and not selected into editor.
-fun int CreateDocument=2375(,)
+fun int CreateDocument=2375(int bytes, int documentOption)
# Extend life of document.
fun void AddRefDocument=2376(, int doc)
# Release a reference to the document, deleting document if it fades to black.
@@ -2540,7 +2543,7 @@
get int GetTechnology=2631(,)
# Create an ILoader*.
-fun int CreateLoader=2632(int bytes,)
+fun int CreateLoader=2632(int bytes, int documentOption)
# On OS X, show a find indicator.
fun void FindIndicatorShow=2640(position start, position end)
diff -r a1731ae83d2a -r 92c8f0f1b3e6 src/Editor.cxx
--- a/src/Editor.cxx Tue Jan 30 12:40:53 2018 +1100
+++ b/src/Editor.cxx Fri Jan 26 11:12:10 2018 +1100
@@ -7556,6 +7556,7 @@
case SCI_CREATEDOCUMENT: {
Document *doc = new Document();
doc->AddRef();
+ doc->Allocate(static_cast<int>(wParam));
return reinterpret_cast<sptr_t>(doc);
}
|