mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
+ pre: experimental - Scintilla's Pre-Release 4.0.3
This commit is contained in:
parent
3f7cf30297
commit
ec00eb7aa1
@ -129,6 +129,7 @@
|
||||
<StringPooling>true</StringPooling>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
@ -151,6 +152,7 @@
|
||||
<SmallerTypeCheck>false</SmallerTypeCheck>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
@ -175,6 +177,7 @@
|
||||
<OmitFramePointers />
|
||||
<StringPooling>true</StringPooling>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
@ -193,6 +196,7 @@
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
|
||||
@ -119,7 +119,7 @@
|
||||
|
||||
<h1>Scintilla Documentation</h1>
|
||||
|
||||
<p>Last edited 11 August 2017 NH</p>
|
||||
<p>Last edited 1 February 2018 NH</p>
|
||||
|
||||
<p>There is <a class="jump" href="Design.html">an overview of the internal design of
|
||||
Scintilla</a>.<br />
|
||||
@ -3595,6 +3595,10 @@ struct Sci_TextToFind {
|
||||
<a class="message" href="#SCI_GETCODEPAGE">SCI_GETCODEPAGE → int</a><br />
|
||||
<a class="message" href="#SCI_SETIMEINTERACTION">SCI_SETIMEINTERACTION(int imeInteraction)</a><br />
|
||||
<a class="message" href="#SCI_GETIMEINTERACTION">SCI_GETIMEINTERACTION → int</a><br />
|
||||
<div class="provisional">
|
||||
<a class="message" href="#SCI_SETBIDIRECTIONAL"><span class="provisional">SCI_SETBIDIRECTIONAL(int bidirectional)</span></a><br />
|
||||
<a class="message" href="#SCI_GETBIDIRECTIONAL">SCI_GETBIDIRECTIONAL → int</a><br />
|
||||
</div>
|
||||
<a class="message" href="#SCI_GRABFOCUS">SCI_GRABFOCUS</a><br />
|
||||
<a class="message" href="#SCI_SETFOCUS">SCI_SETFOCUS(bool focus)</a><br />
|
||||
<a class="message" href="#SCI_GETFOCUS">SCI_GETFOCUS → bool</a><br />
|
||||
@ -3719,6 +3723,27 @@ struct Sci_TextToFind {
|
||||
and the inline behaviour with <code>SCI_SETIMEINTERACTION(SC_IME_INLINE)</code>.
|
||||
Scintilla may ignore this call in some cases. For example, the inline behaviour might only be supported for some languages.</p>
|
||||
|
||||
<div class="provisional">
|
||||
<a href="#ProvisionalMessages">These bidirectional features are not yet implemented and the API is provisional</a><br />
|
||||
<p><b id="SCI_SETBIDIRECTIONAL">SCI_SETBIDIRECTIONAL(int bidirectional)</b><br />
|
||||
<b id="SCI_GETBIDIRECTIONAL">SCI_GETBIDIRECTIONAL → int</b><br />
|
||||
Some languages, like Arabic and Hebrew, are written from right to left instead of from left to right as English is.
|
||||
Documents that use multiple languages may contain both directions and this is termed "bidirectional".
|
||||
The default text direction may be right to left or left to right.
|
||||
Scintilla only correctly displays bidirectional text on some platforms and there can be additional processing and storage
|
||||
costs to this.
|
||||
Currently, bidirectional text only works on Win32 using DirectWrite.
|
||||
As some applications may not want to pay the costs, bidirectional support must be explicitly enabled by calling
|
||||
<code>SCI_SETBIDIRECTIONAL(SC_BIDIRECTIONAL_L2R)</code> (1) which chooses left to right as the default direction or
|
||||
<code>SCI_SETBIDIRECTIONAL(SC_BIDIRECTIONAL_R2L)</code> (2) for default right to left.
|
||||
This should be done after setting the technology to <code>SC_TECHNOLOGY_DIRECTWRITE</code>,
|
||||
<code>SC_TECHNOLOGY_DIRECTWRITERETAIN</code>, or
|
||||
<code>SC_TECHNOLOGY_DIRECTWRITEDC</code>.</p>
|
||||
<p>If the call succeeded <code>SCI_GETBIDIRECTIONAL</code> will return the same value otherwise
|
||||
<code>SC_BIDIRECTIONAL_DISABLED</code> (0) is returned.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p><b id="SCI_GRABFOCUS">SCI_GRABFOCUS</b><br />
|
||||
<b id="SCI_SETFOCUS">SCI_SETFOCUS(bool focus)</b><br />
|
||||
<b id="SCI_GETFOCUS">SCI_GETFOCUS → bool</b><br />
|
||||
@ -5687,7 +5712,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
||||
<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
|
||||
@ -5708,13 +5733,49 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
||||
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 id="documentOption">The <code class="parameter">documentOption</code> argument
|
||||
chooses between different document capabilities which affect memory allocation and performance with
|
||||
<code>SC_DOCUMENTOPTION_DEFAULT</code> (0) choosing standard options.
|
||||
<code>SC_DOCUMENTOPTION_STYLES_NONE</code> (1) stops allocation of memory to style characters
|
||||
which saves significant memory, often 40% with the whole document treated as being style 0.
|
||||
Lexers may still produce visual styling by using indicators.</p>
|
||||
|
||||
<table class="standard" summary="Document options">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th align="left">Symbol</th>
|
||||
<th align="left">Value</th>
|
||||
<th align="left">Effect</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<tbody valign="top">
|
||||
|
||||
<tr>
|
||||
<td align="left">SC_DOCUMENTOPTION_DEFAULT</td>
|
||||
<td align="left">0</td>
|
||||
<td align="left">Standard behaviour</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="left">SC_DOCUMENTOPTION_STYLES_NONE</td>
|
||||
<td align="left">1</td>
|
||||
<td align="left">Stop allocation of memory for styles and treat all text as style 0.</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<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
|
||||
@ -5741,7 +5802,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
||||
|
||||
<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
|
||||
@ -5750,13 +5811,16 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
||||
|
||||
<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
|
||||
is described in the <a class="seealso" href="#documentOption"><code>SCI_CREATEDOCUMENT</code></a> section.</p>
|
||||
|
||||
<h4>ILoader</h4>
|
||||
|
||||
<div class="highlighted">
|
||||
@ -6549,7 +6613,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
||||
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>
|
||||
@ -6579,7 +6643,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<h2 id="Lexer">Lexer</h2>
|
||||
|
||||
<p>If you define the symbol <code>SCI_LEXER</code> when building Scintilla, (this is sometimes
|
||||
@ -6870,7 +6934,7 @@ With Scintilla 4, 64-bit builds define these as 64-bit types to allow future imp
|
||||
<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>
|
||||
@ -8074,8 +8138,6 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
|
||||
|
||||
<p>Provisional features are displayed in this document with <span class="provisional">a distinctive background colour</span>.</p>
|
||||
|
||||
<p>There are currently no provisional messages or values.</p>
|
||||
|
||||
<p>Some developers may want to only use features that are stable and have graduated from
|
||||
provisional status. To avoid using provisional messages compile with the symbol
|
||||
<code>SCI_DISABLE_PROVISIONAL</code> defined.</p>
|
||||
|
||||
@ -516,6 +516,10 @@
|
||||
<td>Jannick</td>
|
||||
<td>Zufu Liu</td>
|
||||
<td>Simon Sobisch</td>
|
||||
</tr><tr>
|
||||
<td>Georger Araújo</td>
|
||||
<td>Tobias Kühne</td>
|
||||
<td>Dimitar Radev</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
@ -535,17 +539,52 @@
|
||||
Released 26 October 2017.
|
||||
</li>
|
||||
<li>
|
||||
SCI_CREATEDOCUMENT adds a bytes argument to allocate memory for an initial size.
|
||||
SCI_CREATELOADER and SCI_CREATEDOCUMENT add a documentOption argument to
|
||||
allow choosing different document capabilities.
|
||||
</li>
|
||||
<li>
|
||||
Add SC_DOCUMENTOPTION_STYLES_NONE option to stop allocating memory for styles.
|
||||
</li>
|
||||
<li>
|
||||
Add SCI_GETMOVEEXTENDSSELECTION to allow applications to add more
|
||||
complex selection commands.
|
||||
</li>
|
||||
<li>
|
||||
SciTE property bookmark.symbol allows choosing symbol used for bookmarks.
|
||||
<a href="http://sourceforge.net/p/scintilla/feature-requests/1208/">Feature #1208.</a>
|
||||
</li>
|
||||
<li>
|
||||
Improve VHDL lexer's handling of character literals and escape characters in strings.
|
||||
</li>
|
||||
<li>
|
||||
Fix double tap word selection on Windows 10 1709 Fall Creators Update.
|
||||
<a href="http://sourceforge.net/p/scintilla/bugs/1983/">Bug #1983</a>.
|
||||
</li>
|
||||
<li>
|
||||
Fix closing autocompletion lists on Cocoa for macOS 10.13 where the window
|
||||
was emptying but staying visible.
|
||||
<a href="http://sourceforge.net/p/scintilla/bugs/1981/">Bug #1981</a>.
|
||||
</li>
|
||||
<li>
|
||||
Fix drawing failure on Cocoa with animated find indicator in large files with macOS 10.12
|
||||
by disabling animation.
|
||||
</li>
|
||||
<li>
|
||||
SciTE on GTK+ installs its desktop file as non-executable and supports the common
|
||||
LDLIBS make variable.
|
||||
<a href="http://sourceforge.net/p/scintilla/bugs/1989/">Bug #1989</a>,
|
||||
<a href="http://sourceforge.net/p/scintilla/bugs/1990/">Bug #1990</a>.
|
||||
</li>
|
||||
<li>
|
||||
SciTE shows correct column number when caret in virtual space.
|
||||
<a href="http://sourceforge.net/p/scintilla/bugs/1991/">Bug #1991</a>.
|
||||
</li>
|
||||
<li>
|
||||
SciTE preserves selection positions when saving with strip.trailing.spaces
|
||||
and virtual space turned on.
|
||||
<a href="http://sourceforge.net/p/scintilla/bugs/1992/">Bug #1992</a>.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>
|
||||
<a href="http://www.scintilla.org/scite402.zip">Release 4.0.2</a>
|
||||
|
||||
@ -690,6 +690,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_SELECTIONISRECTANGLE 2372
|
||||
#define SCI_SETZOOM 2373
|
||||
#define SCI_GETZOOM 2374
|
||||
#define SC_DOCUMENTOPTION_DEFAULT 0
|
||||
#define SC_DOCUMENTOPTION_STYLES_NONE 1
|
||||
#define SCI_CREATEDOCUMENT 2375
|
||||
#define SCI_ADDREFDOCUMENT 2376
|
||||
#define SCI_RELEASEDOCUMENT 2377
|
||||
@ -1104,6 +1106,13 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCN_AUTOCCOMPLETED 2030
|
||||
#define SCN_MARGINRIGHTCLICK 2031
|
||||
#define SCN_AUTOCSELECTIONCHANGE 2032
|
||||
#ifndef SCI_DISABLE_PROVISIONAL
|
||||
#define SC_BIDIRECTIONAL_DISABLED 0
|
||||
#define SC_BIDIRECTIONAL_L2R 1
|
||||
#define SC_BIDIRECTIONAL_R2L 2
|
||||
#define SCI_GETBIDIRECTIONAL 2708
|
||||
#define SCI_SETBIDIRECTIONAL 2709
|
||||
#endif
|
||||
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
|
||||
|
||||
/* These structures are defined to be exactly the same shape as the Win32
|
||||
|
||||
@ -1771,9 +1771,13 @@ set void SetZoom=2373(int zoomInPoints,)
|
||||
# Retrieve the zoom level.
|
||||
get int GetZoom=2374(,)
|
||||
|
||||
enu DocumentOption=SC_DOCUMENTOPTION_
|
||||
val SC_DOCUMENTOPTION_DEFAULT=0
|
||||
val SC_DOCUMENTOPTION_STYLES_NONE=1
|
||||
|
||||
# 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 +2544,7 @@ set void SetTechnology=2630(int technology,)
|
||||
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)
|
||||
@ -2918,7 +2922,6 @@ val SCLEX_JSON=120
|
||||
val SCLEX_EDIFACT=121
|
||||
val SCLEX_INDENT=122
|
||||
val SCLEX_AHK=200
|
||||
val SCLEX_NIM=201
|
||||
|
||||
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||
# value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||
@ -4863,10 +4866,19 @@ evt void AutoCCompleted=2030(string text, int position, int ch, CompletionMethod
|
||||
evt void MarginRightClick=2031(int modifiers, int position, int margin)
|
||||
evt void AutoCSelectionChange=2032(int listType, string text, int position)
|
||||
|
||||
# There are no provisional APIs currently.
|
||||
|
||||
cat Provisional
|
||||
|
||||
enu Bidirectional=SC_BIDIRECTIONAL_
|
||||
val SC_BIDIRECTIONAL_DISABLED=0
|
||||
val SC_BIDIRECTIONAL_L2R=1
|
||||
val SC_BIDIRECTIONAL_R2L=2
|
||||
|
||||
# Retrieve bidirectional text display state.
|
||||
get int GetBidirectional=2708(,)
|
||||
|
||||
# Set bidirectional text display state.
|
||||
set void SetBidirectional=2709(int bidirectional,)
|
||||
|
||||
cat Deprecated
|
||||
|
||||
# Divide each styling byte into lexical class bits (default: 5) and indicator
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#include <cstring>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include "StringCopy.h"
|
||||
#include "WordList.h"
|
||||
@ -128,7 +129,7 @@ void WordList::Set(const char *s) {
|
||||
#else
|
||||
SortWordList(words, len);
|
||||
#endif
|
||||
std::fill(starts, starts + ELEMENTS(starts), -1);
|
||||
std::fill(starts, std::end(starts), -1);
|
||||
for (int l = len - 1; l >= 0; l--) {
|
||||
unsigned char indexChar = words[l][0];
|
||||
starts[indexChar] = l;
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
#include <set>
|
||||
#include <forward_list>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <regex>
|
||||
|
||||
@ -342,7 +342,8 @@ void UndoHistory::CompletedRedoStep() {
|
||||
currentAction++;
|
||||
}
|
||||
|
||||
CellBuffer::CellBuffer() {
|
||||
CellBuffer::CellBuffer(bool hasStyles_) :
|
||||
hasStyles(hasStyles_) {
|
||||
readOnly = false;
|
||||
utf8LineEnds = 0;
|
||||
collectingUndo = true;
|
||||
@ -369,7 +370,7 @@ void CellBuffer::GetCharRange(char *buffer, Sci::Position position, Sci::Positio
|
||||
}
|
||||
|
||||
char CellBuffer::StyleAt(Sci::Position position) const {
|
||||
return style.ValueAt(position);
|
||||
return hasStyles ? style.ValueAt(position) : 0;
|
||||
}
|
||||
|
||||
void CellBuffer::GetStyleRange(unsigned char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const {
|
||||
@ -377,6 +378,10 @@ void CellBuffer::GetStyleRange(unsigned char *buffer, Sci::Position position, Sc
|
||||
return;
|
||||
if (position < 0)
|
||||
return;
|
||||
if (!hasStyles) {
|
||||
std::fill(buffer, buffer + lengthRetrieve, static_cast<unsigned char>(0));
|
||||
return;
|
||||
}
|
||||
if ((position + lengthRetrieve) > style.Length()) {
|
||||
Platform::DebugPrintf("Bad GetStyleRange %d for %d of %d\n", position,
|
||||
lengthRetrieve, style.Length());
|
||||
@ -394,7 +399,7 @@ const char *CellBuffer::RangePointer(Sci::Position position, Sci::Position range
|
||||
}
|
||||
|
||||
Sci::Position CellBuffer::GapPosition() const {
|
||||
return substance.GapPosition();
|
||||
return static_cast<Sci::Position>(substance.GapPosition());
|
||||
}
|
||||
|
||||
// The char* returned is to an allocation owned by the undo history
|
||||
@ -414,6 +419,9 @@ const char *CellBuffer::InsertString(Sci::Position position, const char *s, Sci:
|
||||
}
|
||||
|
||||
bool CellBuffer::SetStyleAt(Sci::Position position, char styleValue) {
|
||||
if (!hasStyles) {
|
||||
return false;
|
||||
}
|
||||
const char curVal = style.ValueAt(position);
|
||||
if (curVal != styleValue) {
|
||||
style.SetValueAt(position, styleValue);
|
||||
@ -424,6 +432,9 @@ bool CellBuffer::SetStyleAt(Sci::Position position, char styleValue) {
|
||||
}
|
||||
|
||||
bool CellBuffer::SetStyleFor(Sci::Position position, Sci::Position lengthStyle, char styleValue) {
|
||||
if (!hasStyles) {
|
||||
return false;
|
||||
}
|
||||
bool changed = false;
|
||||
PLATFORM_ASSERT(lengthStyle == 0 ||
|
||||
(lengthStyle > 0 && lengthStyle + position <= style.Length()));
|
||||
@ -457,12 +468,14 @@ const char *CellBuffer::DeleteChars(Sci::Position position, Sci::Position delete
|
||||
}
|
||||
|
||||
Sci::Position CellBuffer::Length() const {
|
||||
return substance.Length();
|
||||
return static_cast<Sci::Position>(substance.Length());
|
||||
}
|
||||
|
||||
void CellBuffer::Allocate(Sci::Position newSize) {
|
||||
substance.ReAllocate(newSize);
|
||||
style.ReAllocate(newSize);
|
||||
if (hasStyles) {
|
||||
style.ReAllocate(newSize);
|
||||
}
|
||||
}
|
||||
|
||||
void CellBuffer::SetLineEndTypes(int utf8LineEnds_) {
|
||||
@ -608,7 +621,9 @@ void CellBuffer::BasicInsertString(Sci::Position position, const char *s, Sci::P
|
||||
}
|
||||
|
||||
substance.InsertFromArray(position, s, 0, insertLength);
|
||||
style.InsertValue(position, insertLength, 0);
|
||||
if (hasStyles) {
|
||||
style.InsertValue(position, insertLength, 0);
|
||||
}
|
||||
|
||||
Sci::Line lineInsert = lv.LineFromPosition(position) + 1;
|
||||
bool atLineStart = lv.LineStart(lineInsert-1) == position;
|
||||
@ -738,7 +753,9 @@ void CellBuffer::BasicDeleteChars(Sci::Position position, Sci::Position deleteLe
|
||||
}
|
||||
}
|
||||
substance.DeleteRange(position, deleteLength);
|
||||
style.DeleteRange(position, deleteLength);
|
||||
if (hasStyles) {
|
||||
style.DeleteRange(position, deleteLength);
|
||||
}
|
||||
}
|
||||
|
||||
bool CellBuffer::SetUndoCollection(bool collectUndo) {
|
||||
|
||||
@ -26,7 +26,7 @@ public:
|
||||
*/
|
||||
class LineVector {
|
||||
|
||||
Partitioning starts;
|
||||
Partitioning<int> starts;
|
||||
PerLine *perLine;
|
||||
|
||||
public:
|
||||
@ -135,6 +135,7 @@ public:
|
||||
*/
|
||||
class CellBuffer {
|
||||
private:
|
||||
bool hasStyles;
|
||||
SplitVector<char> substance;
|
||||
SplitVector<char> style;
|
||||
bool readOnly;
|
||||
@ -153,7 +154,7 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
CellBuffer();
|
||||
CellBuffer(bool hasStyles_);
|
||||
// Deleted so CellBuffer objects can not be copied.
|
||||
CellBuffer(const CellBuffer &) = delete;
|
||||
void operator=(const CellBuffer &) = delete;
|
||||
|
||||
@ -35,11 +35,11 @@ ContractionState::~ContractionState() {
|
||||
|
||||
void ContractionState::EnsureData() {
|
||||
if (OneToOne()) {
|
||||
visible.reset(new RunStyles());
|
||||
expanded.reset(new RunStyles());
|
||||
heights.reset(new RunStyles());
|
||||
visible.reset(new RunStyles<int, int>());
|
||||
expanded.reset(new RunStyles<int, int>());
|
||||
heights.reset(new RunStyles<int, int>());
|
||||
foldDisplayTexts.reset(new SparseVector<UniqueString>());
|
||||
displayLines.reset(new Partitioning(4));
|
||||
displayLines.reset(new Partitioning<int>(4));
|
||||
InsertLines(0, linesInDocument);
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,11 +17,11 @@ class SparseVector;
|
||||
*/
|
||||
class ContractionState {
|
||||
// These contain 1 element for every document line.
|
||||
std::unique_ptr<RunStyles> visible;
|
||||
std::unique_ptr<RunStyles> expanded;
|
||||
std::unique_ptr<RunStyles> heights;
|
||||
std::unique_ptr<RunStyles<int, int>> visible;
|
||||
std::unique_ptr<RunStyles<int, int>> expanded;
|
||||
std::unique_ptr<RunStyles<int, int>> heights;
|
||||
std::unique_ptr<SparseVector<UniqueString>> foldDisplayTexts;
|
||||
std::unique_ptr<Partitioning> displayLines;
|
||||
std::unique_ptr<Partitioning<int>> displayLines;
|
||||
Sci::Line linesInDocument;
|
||||
|
||||
void EnsureData();
|
||||
|
||||
@ -12,7 +12,7 @@ namespace Scintilla {
|
||||
class Decoration {
|
||||
int indicator;
|
||||
public:
|
||||
RunStyles rs;
|
||||
RunStyles<int, int> rs;
|
||||
|
||||
explicit Decoration(int indicator_);
|
||||
~Decoration();
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <cmath>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
@ -89,7 +90,8 @@ int LexInterface::LineEndTypesSupported() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Document::Document() {
|
||||
Document::Document(int options) :
|
||||
cb((options & SC_DOCUMENTOPTION_STYLES_NONE) == 0) {
|
||||
refCount = 0;
|
||||
#ifdef _WIN32
|
||||
eolMode = SC_EOL_CRLF;
|
||||
@ -559,7 +561,7 @@ void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, Sc
|
||||
}
|
||||
|
||||
Sci::Position Document::ClampPositionIntoDocument(Sci::Position pos) const {
|
||||
return Sci::clamp(pos, 0, static_cast<Sci::Position>(Length()));
|
||||
return std::clamp(pos, static_cast<Sci::Position>(0), static_cast<Sci::Position>(Length()));
|
||||
}
|
||||
|
||||
bool Document::IsCrLf(Sci::Position pos) const {
|
||||
@ -877,7 +879,7 @@ Sci::Position Document::GetRelativePositionUTF16(Sci::Position positionStart, Sc
|
||||
const Sci::Position posNext = NextPosition(pos, increment);
|
||||
if (posNext == pos)
|
||||
return INVALID_POSITION;
|
||||
if (abs(pos-posNext) > 3) // 4 byte character = 2*UTF16.
|
||||
if (std::abs(pos-posNext) > 3) // 4 byte character = 2*UTF16.
|
||||
characterOffset -= increment;
|
||||
pos = posNext;
|
||||
characterOffset -= increment;
|
||||
|
||||
@ -267,7 +267,7 @@ public:
|
||||
|
||||
DecorationList decorations;
|
||||
|
||||
Document();
|
||||
Document(int options);
|
||||
// Deleted so Document objects can not be copied.
|
||||
Document(const Document &) = delete;
|
||||
void operator=(const Document &) = delete;
|
||||
|
||||
@ -63,12 +63,13 @@ EditModel::EditModel() {
|
||||
highlightGuideColumn = 0;
|
||||
primarySelection = true;
|
||||
imeInteraction = imeWindowed;
|
||||
bidirectional = Bidirectional::bidiDisabled;
|
||||
foldFlags = 0;
|
||||
foldDisplayTextStyle = SC_FOLDDISPLAYTEXT_HIDDEN;
|
||||
hotspot = Range(Sci::invalidPosition);
|
||||
hoverIndicatorPos = Sci::invalidPosition;
|
||||
wrapWidth = LineLayout::wrapWidthInfinite;
|
||||
pdoc = new Document();
|
||||
pdoc = new Document(SC_DOCUMENTOPTION_DEFAULT);
|
||||
pdoc->AddRef();
|
||||
}
|
||||
|
||||
|
||||
@ -38,6 +38,8 @@ public:
|
||||
|
||||
enum IMEInteraction { imeWindowed, imeInline } imeInteraction;
|
||||
|
||||
enum class Bidirectional { bidiDisabled, bidiL2R, bidiR2L } bidirectional;
|
||||
|
||||
int foldFlags;
|
||||
int foldDisplayTextStyle;
|
||||
ContractionState cs;
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
#include <cstring>
|
||||
#include <cctype>
|
||||
#include <cstdio>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -900,11 +900,11 @@ SelectionPosition Editor::MovePositionSoVisible(SelectionPosition pos, int moveD
|
||||
Sci::Line lineDisplay = cs.DisplayFromDoc(lineDoc);
|
||||
if (moveDir > 0) {
|
||||
// lineDisplay is already line before fold as lines in fold use display line of line after fold
|
||||
lineDisplay = Sci::clamp(lineDisplay, 0, cs.LinesDisplayed());
|
||||
lineDisplay = std::clamp(lineDisplay, static_cast<Sci::Line>(0), cs.LinesDisplayed());
|
||||
return SelectionPosition(static_cast<Sci::Position>(
|
||||
pdoc->LineStart(cs.DocFromDisplay(lineDisplay))));
|
||||
} else {
|
||||
lineDisplay = Sci::clamp(lineDisplay - 1, 0, cs.LinesDisplayed());
|
||||
lineDisplay = std::clamp(lineDisplay - 1, static_cast<Sci::Line>(0), cs.LinesDisplayed());
|
||||
return SelectionPosition(static_cast<Sci::Position>(
|
||||
pdoc->LineEnd(cs.DocFromDisplay(lineDisplay))));
|
||||
}
|
||||
@ -929,12 +929,12 @@ void Editor::SetLastXChosen() {
|
||||
}
|
||||
|
||||
void Editor::ScrollTo(Sci::Line line, bool moveThumb) {
|
||||
const Sci::Line topLineNew = Sci::clamp(line, 0, MaxScrollPos());
|
||||
const Sci::Line topLineNew = std::clamp(line, static_cast<Sci::Line>(0), MaxScrollPos());
|
||||
if (topLineNew != topLine) {
|
||||
// Try to optimise small scrolls
|
||||
#ifndef UNDER_CE
|
||||
const Sci::Line linesToMove = topLine - topLineNew;
|
||||
const bool performBlit = (abs(linesToMove) <= 10) && (paintState == notPainting);
|
||||
const bool performBlit = (std::abs(linesToMove) <= 10) && (paintState == notPainting);
|
||||
willRedrawAll = !performBlit;
|
||||
#endif
|
||||
SetTopLine(topLineNew);
|
||||
@ -1169,7 +1169,7 @@ Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const SelectionRange &ran
|
||||
} else {
|
||||
// yMarginT must equal to caretYSlop, with a minimum of 1 and
|
||||
// a maximum of slightly less than half the heigth of the text area.
|
||||
yMarginT = Sci::clamp(caretYSlop, 1, halfScreen);
|
||||
yMarginT = std::clamp(static_cast<Sci::Line>(caretYSlop), static_cast<Sci::Line>(1), halfScreen);
|
||||
if (bEven) {
|
||||
yMarginB = yMarginT;
|
||||
} else {
|
||||
@ -1179,7 +1179,7 @@ Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const SelectionRange &ran
|
||||
yMoveT = yMarginT;
|
||||
if (bEven) {
|
||||
if (bJump) {
|
||||
yMoveT = Sci::clamp(caretYSlop * 3, 1, halfScreen);
|
||||
yMoveT = std::clamp(static_cast<Sci::Line>(caretYSlop * 3), static_cast<Sci::Line>(1), halfScreen);
|
||||
}
|
||||
yMoveB = yMoveT;
|
||||
} else {
|
||||
@ -1194,7 +1194,7 @@ Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const SelectionRange &ran
|
||||
}
|
||||
} else { // Not strict
|
||||
yMoveT = bJump ? caretYSlop * 3 : caretYSlop;
|
||||
yMoveT = Sci::clamp(yMoveT, 1, halfScreen);
|
||||
yMoveT = std::clamp(yMoveT, static_cast<Sci::Line>(1), halfScreen);
|
||||
if (bEven) {
|
||||
yMoveB = yMoveT;
|
||||
} else {
|
||||
@ -1244,7 +1244,7 @@ Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const SelectionRange &ran
|
||||
newXY.topLine = std::min(newXY.topLine, lineCaret);
|
||||
}
|
||||
}
|
||||
newXY.topLine = Sci::clamp(newXY.topLine, 0, MaxScrollPos());
|
||||
newXY.topLine = std::clamp(newXY.topLine, static_cast<Sci::Line>(0), MaxScrollPos());
|
||||
}
|
||||
|
||||
// Horizontal positioning
|
||||
@ -1266,7 +1266,7 @@ Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const SelectionRange &ran
|
||||
} else {
|
||||
// xMargin must equal to caretXSlop, with a minimum of 2 and
|
||||
// a maximum of slightly less than half the width of the text area.
|
||||
xMarginR = Sci::clamp(caretXSlop, 2, halfScreen);
|
||||
xMarginR = std::clamp(caretXSlop, 2, halfScreen);
|
||||
if (bEven) {
|
||||
xMarginL = xMarginR;
|
||||
} else {
|
||||
@ -1275,7 +1275,7 @@ Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const SelectionRange &ran
|
||||
}
|
||||
if (bJump && bEven) {
|
||||
// Jump is used only in even mode
|
||||
xMoveL = xMoveR = Sci::clamp(caretXSlop * 3, 1, halfScreen);
|
||||
xMoveL = xMoveR = std::clamp(caretXSlop * 3, 1, halfScreen);
|
||||
} else {
|
||||
xMoveL = xMoveR = 0; // Not used, avoid a warning
|
||||
}
|
||||
@ -1298,7 +1298,7 @@ Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const SelectionRange &ran
|
||||
}
|
||||
} else { // Not strict
|
||||
xMoveR = bJump ? caretXSlop * 3 : caretXSlop;
|
||||
xMoveR = Sci::clamp(xMoveR, 1, halfScreen);
|
||||
xMoveR = std::clamp(xMoveR, 1, halfScreen);
|
||||
if (bEven) {
|
||||
xMoveL = xMoveR;
|
||||
} else {
|
||||
@ -1510,7 +1510,7 @@ bool Editor::WrapLines(WrapScope ws) {
|
||||
const Sci::Line lineDocTop = cs.DocFromDisplay(topLine);
|
||||
const int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop);
|
||||
if (ws == WrapScope::wsVisible) {
|
||||
lineToWrap = Sci::clamp(lineDocTop-5, wrapPending.start, pdoc->LinesTotal());
|
||||
lineToWrap = std::clamp(lineDocTop-5, wrapPending.start, pdoc->LinesTotal());
|
||||
// Priority wrap to just after visible area.
|
||||
// Since wrapping could reduce display lines, treat each
|
||||
// as taking only one display line.
|
||||
@ -1566,7 +1566,7 @@ bool Editor::WrapLines(WrapScope ws) {
|
||||
|
||||
if (wrapOccurred) {
|
||||
SetScrollBars();
|
||||
SetTopLine(Sci::clamp(goodTopLine, 0, MaxScrollPos()));
|
||||
SetTopLine(std::clamp(goodTopLine, static_cast<Sci::Line>(0), MaxScrollPos()));
|
||||
SetVerticalScrollPos();
|
||||
}
|
||||
|
||||
@ -1819,7 +1819,7 @@ void Editor::SetScrollBars() {
|
||||
// TODO: ensure always showing as many lines as possible
|
||||
// May not be, if, for example, window made larger
|
||||
if (topLine > MaxScrollPos()) {
|
||||
SetTopLine(Sci::clamp(topLine, 0, MaxScrollPos()));
|
||||
SetTopLine(std::clamp(topLine, static_cast<Sci::Line>(0), MaxScrollPos()));
|
||||
SetVerticalScrollPos();
|
||||
Redraw();
|
||||
}
|
||||
@ -2623,7 +2623,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) {
|
||||
if (mh.linesAdded != 0) {
|
||||
// Avoid scrolling of display if change before current display
|
||||
if (mh.position < posTopLine && !CanDeferToLastStep(mh)) {
|
||||
Sci::Line newTop = Sci::clamp(topLine + mh.linesAdded, 0, MaxScrollPos());
|
||||
Sci::Line newTop = std::clamp(topLine + mh.linesAdded, static_cast<Sci::Line>(0), MaxScrollPos());
|
||||
if (newTop != topLine) {
|
||||
SetTopLine(newTop);
|
||||
SetVerticalScrollPos();
|
||||
@ -2859,8 +2859,8 @@ void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) {
|
||||
} else {
|
||||
Point pt = LocationFromPosition(sel.MainCaret());
|
||||
|
||||
topLineNew = Sci::clamp(
|
||||
topLine + direction * LinesToScroll(), 0, MaxScrollPos());
|
||||
topLineNew = std::clamp(
|
||||
topLine + direction * LinesToScroll(), static_cast<Sci::Line>(0), MaxScrollPos());
|
||||
newPos = SPositionFromLocation(
|
||||
Point::FromInts(lastXChosen - xOffset, static_cast<int>(pt.y) + direction * (vs.lineHeight * LinesToScroll())),
|
||||
false, false, UserVirtualSpace());
|
||||
@ -4455,7 +4455,7 @@ void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifie
|
||||
if (shift && !inSelMargin) {
|
||||
SetSelection(newPos);
|
||||
}
|
||||
if (((curTime - lastClickTime) < Platform::DoubleClickTime()) && Close(pt, lastClick, doubleClickCloseThreshold)) {
|
||||
if ((curTime < (lastClickTime+Platform::DoubleClickTime())) && Close(pt, lastClick, doubleClickCloseThreshold)) {
|
||||
//Platform::DebugPrintf("Double click %d %d = %d\n", curTime, lastClickTime, curTime - lastClickTime);
|
||||
SetMouseCapture(true);
|
||||
FineTickerStart(tickScroll, 100, 10);
|
||||
@ -5011,7 +5011,7 @@ Sci::Position Editor::PositionAfterMaxStyling(Sci::Position posMax, bool scrolli
|
||||
// When scrolling, allow less time to ensure responsive
|
||||
const double secondsAllowed = scrolling ? 0.005 : 0.02;
|
||||
|
||||
const Sci::Line linesToStyle = Sci::clamp(static_cast<int>(secondsAllowed / pdoc->durationStyleOneLine),
|
||||
const Sci::Line linesToStyle = std::clamp(static_cast<int>(secondsAllowed / pdoc->durationStyleOneLine),
|
||||
10, 0x10000);
|
||||
const Sci::Line stylingMaxLine = std::min(
|
||||
static_cast<Sci::Line>(pdoc->LineFromPosition(pdoc->GetEndStyled()) + linesToStyle),
|
||||
@ -5165,7 +5165,7 @@ void Editor::SetDocPointer(Document *document) {
|
||||
pdoc->RemoveWatcher(this, 0);
|
||||
pdoc->Release();
|
||||
if (document == NULL) {
|
||||
pdoc = new Document();
|
||||
pdoc = new Document(SC_DOCUMENTOPTION_DEFAULT);
|
||||
} else {
|
||||
pdoc = document;
|
||||
}
|
||||
@ -5362,18 +5362,18 @@ void Editor::EnsureLineVisible(Sci::Line lineDoc, bool enforcePolicy) {
|
||||
const Sci::Line lineDisplay = cs.DisplayFromDoc(lineDoc);
|
||||
if (visiblePolicy & VISIBLE_SLOP) {
|
||||
if ((topLine > lineDisplay) || ((visiblePolicy & VISIBLE_STRICT) && (topLine + visibleSlop > lineDisplay))) {
|
||||
SetTopLine(Sci::clamp(lineDisplay - visibleSlop, 0, MaxScrollPos()));
|
||||
SetTopLine(std::clamp(lineDisplay - visibleSlop, static_cast<Sci::Line>(0), MaxScrollPos()));
|
||||
SetVerticalScrollPos();
|
||||
Redraw();
|
||||
} else if ((lineDisplay > topLine + LinesOnScreen() - 1) ||
|
||||
((visiblePolicy & VISIBLE_STRICT) && (lineDisplay > topLine + LinesOnScreen() - 1 - visibleSlop))) {
|
||||
SetTopLine(Sci::clamp(lineDisplay - LinesOnScreen() + 1 + visibleSlop, 0, MaxScrollPos()));
|
||||
SetTopLine(std::clamp(lineDisplay - LinesOnScreen() + 1 + visibleSlop, static_cast<Sci::Line>(0), MaxScrollPos()));
|
||||
SetVerticalScrollPos();
|
||||
Redraw();
|
||||
}
|
||||
} else {
|
||||
if ((topLine > lineDisplay) || (lineDisplay > topLine + LinesOnScreen() - 1) || (visiblePolicy & VISIBLE_STRICT)) {
|
||||
SetTopLine(Sci::clamp(lineDisplay - LinesOnScreen() / 2 + 1, 0, MaxScrollPos()));
|
||||
SetTopLine(std::clamp(lineDisplay - LinesOnScreen() / 2 + 1, static_cast<Sci::Line>(0), MaxScrollPos()));
|
||||
SetVerticalScrollPos();
|
||||
Redraw();
|
||||
}
|
||||
@ -5978,7 +5978,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
return pdoc->MovePositionOutsideChar(static_cast<int>(wParam) + 1, 1, true);
|
||||
|
||||
case SCI_POSITIONRELATIVE:
|
||||
return Sci::clamp(static_cast<int>(pdoc->GetRelativePosition(static_cast<int>(wParam), static_cast<int>(lParam))),
|
||||
return std::clamp(static_cast<int>(pdoc->GetRelativePosition(static_cast<int>(wParam), static_cast<int>(lParam))),
|
||||
0, static_cast<int>(pdoc->Length()));
|
||||
|
||||
case SCI_LINESCROLL:
|
||||
@ -6739,6 +6739,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
case SCI_GETIMEINTERACTION:
|
||||
return imeInteraction;
|
||||
|
||||
case SCI_SETBIDIRECTIONAL:
|
||||
// SCI_SETBIDIRECTIONAL is implemented on platform subclasses if they support bidirectional text.
|
||||
break;
|
||||
|
||||
case SCI_GETBIDIRECTIONAL:
|
||||
return static_cast<sptr_t>(bidirectional);
|
||||
|
||||
// Marker definition and setting
|
||||
case SCI_MARKERDEFINE:
|
||||
if (wParam <= MARKER_MAX) {
|
||||
@ -7550,8 +7557,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
return 0;
|
||||
|
||||
case SCI_CREATEDOCUMENT: {
|
||||
Document *doc = new Document();
|
||||
Document *doc = new Document(static_cast<int>(lParam));
|
||||
doc->AddRef();
|
||||
doc->Allocate(static_cast<int>(wParam));
|
||||
return reinterpret_cast<sptr_t>(doc);
|
||||
}
|
||||
|
||||
@ -7564,7 +7572,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
break;
|
||||
|
||||
case SCI_CREATELOADER: {
|
||||
Document *doc = new Document();
|
||||
Document *doc = new Document(static_cast<int>(lParam));
|
||||
doc->AddRef();
|
||||
doc->Allocate(static_cast<int>(wParam));
|
||||
doc->SetUndoCollection(false);
|
||||
|
||||
@ -16,32 +16,33 @@ namespace Scintilla {
|
||||
/// in a range.
|
||||
/// Used by the Partitioning class.
|
||||
|
||||
class SplitVectorWithRangeAdd : public SplitVector<int> {
|
||||
template <typename T>
|
||||
class SplitVectorWithRangeAdd : public SplitVector<T> {
|
||||
public:
|
||||
explicit SplitVectorWithRangeAdd(int growSize_) {
|
||||
SetGrowSize(growSize_);
|
||||
ReAllocate(growSize_);
|
||||
explicit SplitVectorWithRangeAdd(ptrdiff_t growSize_) {
|
||||
this->SetGrowSize(growSize_);
|
||||
this->ReAllocate(growSize_);
|
||||
}
|
||||
// Deleted so SplitVectorWithRangeAdd objects can not be copied.
|
||||
SplitVectorWithRangeAdd(const SplitVectorWithRangeAdd &) = delete;
|
||||
void operator=(const SplitVectorWithRangeAdd &) = delete;
|
||||
~SplitVectorWithRangeAdd() {
|
||||
}
|
||||
void RangeAddDelta(int start, int end, int delta) {
|
||||
void RangeAddDelta(ptrdiff_t start, ptrdiff_t end, T delta) {
|
||||
// end is 1 past end, so end-start is number of elements to change
|
||||
int i = 0;
|
||||
const int rangeLength = end - start;
|
||||
int range1Length = rangeLength;
|
||||
const int part1Left = part1Length - start;
|
||||
ptrdiff_t i = 0;
|
||||
const ptrdiff_t rangeLength = end - start;
|
||||
ptrdiff_t range1Length = rangeLength;
|
||||
const ptrdiff_t part1Left = this->part1Length - start;
|
||||
if (range1Length > part1Left)
|
||||
range1Length = part1Left;
|
||||
while (i < range1Length) {
|
||||
body[start++] += delta;
|
||||
this->body[start++] += delta;
|
||||
i++;
|
||||
}
|
||||
start += gapLength;
|
||||
start += this->gapLength;
|
||||
while (i < rangeLength) {
|
||||
body[start++] += delta;
|
||||
this->body[start++] += delta;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@ -54,36 +55,37 @@ public:
|
||||
/// When needed, positions after the interval are considered part of the last partition
|
||||
/// but the end of the last partition can be found with PositionFromPartition(last+1).
|
||||
|
||||
template <typename T>
|
||||
class Partitioning {
|
||||
private:
|
||||
// To avoid calculating all the partition positions whenever any text is inserted
|
||||
// there may be a step somewhere in the list.
|
||||
int stepPartition;
|
||||
int stepLength;
|
||||
std::unique_ptr<SplitVectorWithRangeAdd> body;
|
||||
T stepPartition;
|
||||
T stepLength;
|
||||
std::unique_ptr<SplitVectorWithRangeAdd<T>> body;
|
||||
|
||||
// Move step forward
|
||||
void ApplyStep(int partitionUpTo) {
|
||||
void ApplyStep(T partitionUpTo) {
|
||||
if (stepLength != 0) {
|
||||
body->RangeAddDelta(stepPartition+1, partitionUpTo + 1, stepLength);
|
||||
}
|
||||
stepPartition = partitionUpTo;
|
||||
if (stepPartition >= body->Length()-1) {
|
||||
stepPartition = body->Length()-1;
|
||||
stepPartition = Partitions();
|
||||
stepLength = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Move step backward
|
||||
void BackStep(int partitionDownTo) {
|
||||
void BackStep(T partitionDownTo) {
|
||||
if (stepLength != 0) {
|
||||
body->RangeAddDelta(partitionDownTo+1, stepPartition+1, -stepLength);
|
||||
}
|
||||
stepPartition = partitionDownTo;
|
||||
}
|
||||
|
||||
void Allocate(int growSize) {
|
||||
body.reset(new SplitVectorWithRangeAdd(growSize));
|
||||
void Allocate(ptrdiff_t growSize) {
|
||||
body.reset(new SplitVectorWithRangeAdd<T>(growSize));
|
||||
stepPartition = 0;
|
||||
stepLength = 0;
|
||||
body->Insert(0, 0); // This value stays 0 for ever
|
||||
@ -102,11 +104,11 @@ public:
|
||||
~Partitioning() {
|
||||
}
|
||||
|
||||
int Partitions() const {
|
||||
return body->Length()-1;
|
||||
T Partitions() const {
|
||||
return static_cast<T>(body->Length())-1;
|
||||
}
|
||||
|
||||
void InsertPartition(int partition, int pos) {
|
||||
void InsertPartition(T partition, T pos) {
|
||||
if (stepPartition < partition) {
|
||||
ApplyStep(partition);
|
||||
}
|
||||
@ -114,7 +116,7 @@ public:
|
||||
stepPartition++;
|
||||
}
|
||||
|
||||
void SetPartitionStartPosition(int partition, int pos) {
|
||||
void SetPartitionStartPosition(T partition, T pos) {
|
||||
ApplyStep(partition+1);
|
||||
if ((partition < 0) || (partition > body->Length())) {
|
||||
return;
|
||||
@ -122,7 +124,7 @@ public:
|
||||
body->SetValueAt(partition, pos);
|
||||
}
|
||||
|
||||
void InsertText(int partitionInsert, int delta) {
|
||||
void InsertText(T partitionInsert, T delta) {
|
||||
// Point all the partitions after the insertion point further along in the buffer
|
||||
if (stepLength != 0) {
|
||||
if (partitionInsert >= stepPartition) {
|
||||
@ -134,7 +136,7 @@ public:
|
||||
BackStep(partitionInsert);
|
||||
stepLength += delta;
|
||||
} else {
|
||||
ApplyStep(body->Length()-1);
|
||||
ApplyStep(Partitions());
|
||||
stepPartition = partitionInsert;
|
||||
stepLength = delta;
|
||||
}
|
||||
@ -144,7 +146,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void RemovePartition(int partition) {
|
||||
void RemovePartition(T partition) {
|
||||
if (partition > stepPartition) {
|
||||
ApplyStep(partition);
|
||||
stepPartition--;
|
||||
@ -154,29 +156,29 @@ public:
|
||||
body->Delete(partition);
|
||||
}
|
||||
|
||||
int PositionFromPartition(int partition) const {
|
||||
T PositionFromPartition(T partition) const {
|
||||
PLATFORM_ASSERT(partition >= 0);
|
||||
PLATFORM_ASSERT(partition < body->Length());
|
||||
if ((partition < 0) || (partition >= body->Length())) {
|
||||
return 0;
|
||||
}
|
||||
int pos = body->ValueAt(partition);
|
||||
T pos = body->ValueAt(partition);
|
||||
if (partition > stepPartition)
|
||||
pos += stepLength;
|
||||
return pos;
|
||||
}
|
||||
|
||||
/// Return value in range [0 .. Partitions() - 1] even for arguments outside interval
|
||||
int PartitionFromPosition(int pos) const {
|
||||
T PartitionFromPosition(T pos) const {
|
||||
if (body->Length() <= 1)
|
||||
return 0;
|
||||
if (pos >= (PositionFromPartition(body->Length()-1)))
|
||||
return body->Length() - 1 - 1;
|
||||
int lower = 0;
|
||||
int upper = body->Length()-1;
|
||||
if (pos >= (PositionFromPartition(Partitions())))
|
||||
return Partitions() - 1;
|
||||
T lower = 0;
|
||||
T upper = Partitions();
|
||||
do {
|
||||
const int middle = (upper + lower + 1) / 2; // Round high
|
||||
int posMiddle = body->ValueAt(middle);
|
||||
const T middle = (upper + lower + 1) / 2; // Round high
|
||||
T posMiddle = body->ValueAt(middle);
|
||||
if (middle > stepPartition)
|
||||
posMiddle += stepLength;
|
||||
if (pos < posMiddle) {
|
||||
|
||||
@ -135,7 +135,7 @@ int LineMarkers::MarkValue(Sci::Line line) {
|
||||
Sci::Line LineMarkers::MarkerNext(Sci::Line lineStart, int mask) const {
|
||||
if (lineStart < 0)
|
||||
lineStart = 0;
|
||||
const Sci::Line length = markers.Length();
|
||||
const Sci::Line length = static_cast<Sci::Line>(markers.Length());
|
||||
for (Sci::Line iLine = lineStart; iLine < length; iLine++) {
|
||||
const MarkerHandleSet *onLine = markers[iLine].get();
|
||||
if (onLine && ((onLine->MarkValue() & mask) != 0))
|
||||
@ -281,7 +281,7 @@ int LineState::GetLineState(Sci::Line line) {
|
||||
}
|
||||
|
||||
Sci::Line LineState::GetMaxLineState() const {
|
||||
return lineStates.Length();
|
||||
return static_cast<Sci::Line>(lineStates.Length());
|
||||
}
|
||||
|
||||
static int NumberLines(const char *text) {
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
/**
|
||||
* A Position is a position within a document between two characters or at the beginning or end.
|
||||
* Sometimes used as a character index where it identifies the character after the position.
|
||||
* A Line is a document or screen line.
|
||||
*/
|
||||
|
||||
namespace Sci {
|
||||
@ -25,14 +26,6 @@ typedef int Line;
|
||||
|
||||
const Position invalidPosition = -1;
|
||||
|
||||
inline int clamp(int val, int minVal, int maxVal) {
|
||||
if (val > maxVal)
|
||||
val = maxVal;
|
||||
if (val < minVal)
|
||||
val = minVal;
|
||||
return val;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
|
||||
#include "Platform.h"
|
||||
@ -378,7 +379,7 @@ static inline int KeyFromString(const char *charBytes, size_t len) {
|
||||
}
|
||||
|
||||
SpecialRepresentations::SpecialRepresentations() {
|
||||
std::fill(startByteHasReprs, startByteHasReprs+0x100, static_cast<short>(0));
|
||||
std::fill(startByteHasReprs, std::end(startByteHasReprs), static_cast<short>(0));
|
||||
}
|
||||
|
||||
void SpecialRepresentations::SetRepresentation(const char *charBytes, const char *value) {
|
||||
@ -419,7 +420,7 @@ bool SpecialRepresentations::Contains(const char *charBytes, size_t len) const {
|
||||
|
||||
void SpecialRepresentations::Clear() {
|
||||
mapReprs.clear();
|
||||
std::fill(startByteHasReprs, startByteHasReprs+0x100, static_cast<short>(0));
|
||||
std::fill(startByteHasReprs, std::end(startByteHasReprs), static_cast<short>(0));
|
||||
}
|
||||
|
||||
void BreakFinder::Insert(int val) {
|
||||
|
||||
@ -205,6 +205,7 @@
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include "Position.h"
|
||||
#include "CharClassify.h"
|
||||
@ -254,9 +255,9 @@ RESearch::RESearch(CharClassify *charClassTable) {
|
||||
charClass = charClassTable;
|
||||
sta = NOP; /* status of lastpat */
|
||||
bol = 0;
|
||||
std::fill(bittab, bittab + BITBLK, static_cast<unsigned char>(0));
|
||||
std::fill(tagstk, tagstk + MAXTAG, 0);
|
||||
std::fill(nfa, nfa + MAXNFA, '\0');
|
||||
std::fill(bittab, std::end(bittab), static_cast<unsigned char>(0));
|
||||
std::fill(tagstk, std::end(tagstk), 0);
|
||||
std::fill(nfa, std::end(nfa), '\0');
|
||||
Clear();
|
||||
}
|
||||
|
||||
|
||||
@ -26,8 +26,9 @@
|
||||
using namespace Scintilla;
|
||||
|
||||
// Find the first run at a position
|
||||
int RunStyles::RunFromPosition(int position) const {
|
||||
int run = starts->PartitionFromPosition(position);
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
DISTANCE RunStyles<DISTANCE, STYLE>::RunFromPosition(DISTANCE position) const {
|
||||
DISTANCE run = starts->PartitionFromPosition(position);
|
||||
// Go to first element with this position
|
||||
while ((run > 0) && (position == starts->PositionFromPartition(run-1))) {
|
||||
run--;
|
||||
@ -36,11 +37,12 @@ int RunStyles::RunFromPosition(int position) const {
|
||||
}
|
||||
|
||||
// If there is no run boundary at position, insert one continuing style.
|
||||
int RunStyles::SplitRun(int position) {
|
||||
int run = RunFromPosition(position);
|
||||
const int posRun = starts->PositionFromPartition(run);
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
DISTANCE RunStyles<DISTANCE, STYLE>::SplitRun(DISTANCE position) {
|
||||
DISTANCE run = RunFromPosition(position);
|
||||
const DISTANCE posRun = starts->PositionFromPartition(run);
|
||||
if (posRun < position) {
|
||||
int runStyle = ValueAt(position);
|
||||
STYLE runStyle = ValueAt(position);
|
||||
run++;
|
||||
starts->InsertPartition(run, position);
|
||||
styles->InsertValue(run, 1, runStyle);
|
||||
@ -48,12 +50,14 @@ int RunStyles::SplitRun(int position) {
|
||||
return run;
|
||||
}
|
||||
|
||||
void RunStyles::RemoveRun(int run) {
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
void RunStyles<DISTANCE, STYLE>::RemoveRun(DISTANCE run) {
|
||||
starts->RemovePartition(run);
|
||||
styles->DeleteRange(run, 1);
|
||||
}
|
||||
|
||||
void RunStyles::RemoveRunIfEmpty(int run) {
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
void RunStyles<DISTANCE, STYLE>::RemoveRunIfEmpty(DISTANCE run) {
|
||||
if ((run < starts->Partitions()) && (starts->Partitions() > 1)) {
|
||||
if (starts->PositionFromPartition(run) == starts->PositionFromPartition(run+1)) {
|
||||
RemoveRun(run);
|
||||
@ -61,7 +65,8 @@ void RunStyles::RemoveRunIfEmpty(int run) {
|
||||
}
|
||||
}
|
||||
|
||||
void RunStyles::RemoveRunIfSameAsPrevious(int run) {
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
void RunStyles<DISTANCE, STYLE>::RemoveRunIfSameAsPrevious(DISTANCE run) {
|
||||
if ((run > 0) && (run < starts->Partitions())) {
|
||||
if (styles->ValueAt(run-1) == styles->ValueAt(run)) {
|
||||
RemoveRun(run);
|
||||
@ -69,30 +74,35 @@ void RunStyles::RemoveRunIfSameAsPrevious(int run) {
|
||||
}
|
||||
}
|
||||
|
||||
RunStyles::RunStyles() {
|
||||
starts.reset(new Partitioning(8));
|
||||
styles.reset(new SplitVector<int>());
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
RunStyles<DISTANCE, STYLE>::RunStyles() {
|
||||
starts.reset(new Partitioning<DISTANCE>(8));
|
||||
styles.reset(new SplitVector<STYLE>());
|
||||
styles->InsertValue(0, 2, 0);
|
||||
}
|
||||
|
||||
RunStyles::~RunStyles() {
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
RunStyles<DISTANCE, STYLE>::~RunStyles() {
|
||||
}
|
||||
|
||||
int RunStyles::Length() const {
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
DISTANCE RunStyles<DISTANCE, STYLE>::Length() const {
|
||||
return starts->PositionFromPartition(starts->Partitions());
|
||||
}
|
||||
|
||||
int RunStyles::ValueAt(int position) const {
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
STYLE RunStyles<DISTANCE, STYLE>::ValueAt(DISTANCE position) const {
|
||||
return styles->ValueAt(starts->PartitionFromPosition(position));
|
||||
}
|
||||
|
||||
int RunStyles::FindNextChange(int position, int end) const {
|
||||
const int run = starts->PartitionFromPosition(position);
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
DISTANCE RunStyles<DISTANCE, STYLE>::FindNextChange(DISTANCE position, DISTANCE end) const {
|
||||
const DISTANCE run = starts->PartitionFromPosition(position);
|
||||
if (run < starts->Partitions()) {
|
||||
const int runChange = starts->PositionFromPartition(run);
|
||||
const DISTANCE runChange = starts->PositionFromPartition(run);
|
||||
if (runChange > position)
|
||||
return runChange;
|
||||
const int nextChange = starts->PositionFromPartition(run + 1);
|
||||
const DISTANCE nextChange = starts->PositionFromPartition(run + 1);
|
||||
if (nextChange > position) {
|
||||
return nextChange;
|
||||
} else if (position < end) {
|
||||
@ -105,23 +115,26 @@ int RunStyles::FindNextChange(int position, int end) const {
|
||||
}
|
||||
}
|
||||
|
||||
int RunStyles::StartRun(int position) const {
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
DISTANCE RunStyles<DISTANCE, STYLE>::StartRun(DISTANCE position) const {
|
||||
return starts->PositionFromPartition(starts->PartitionFromPosition(position));
|
||||
}
|
||||
|
||||
int RunStyles::EndRun(int position) const {
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
DISTANCE RunStyles<DISTANCE, STYLE>::EndRun(DISTANCE position) const {
|
||||
return starts->PositionFromPartition(starts->PartitionFromPosition(position) + 1);
|
||||
}
|
||||
|
||||
bool RunStyles::FillRange(int &position, int value, int &fillLength) {
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
bool RunStyles<DISTANCE, STYLE>::FillRange(DISTANCE &position, STYLE value, DISTANCE &fillLength) {
|
||||
if (fillLength <= 0) {
|
||||
return false;
|
||||
}
|
||||
int end = position + fillLength;
|
||||
DISTANCE end = position + fillLength;
|
||||
if (end > Length()) {
|
||||
return false;
|
||||
}
|
||||
int runEnd = RunFromPosition(end);
|
||||
DISTANCE runEnd = RunFromPosition(end);
|
||||
if (styles->ValueAt(runEnd) == value) {
|
||||
// End already has value so trim range.
|
||||
end = starts->PositionFromPartition(runEnd);
|
||||
@ -133,7 +146,7 @@ bool RunStyles::FillRange(int &position, int value, int &fillLength) {
|
||||
} else {
|
||||
runEnd = SplitRun(end);
|
||||
}
|
||||
int runStart = RunFromPosition(position);
|
||||
DISTANCE runStart = RunFromPosition(position);
|
||||
if (styles->ValueAt(runStart) == value) {
|
||||
// Start is in expected value so trim range.
|
||||
runStart++;
|
||||
@ -148,7 +161,7 @@ bool RunStyles::FillRange(int &position, int value, int &fillLength) {
|
||||
if (runStart < runEnd) {
|
||||
styles->SetValueAt(runStart, value);
|
||||
// Remove each old run over the range
|
||||
for (int run=runStart+1; run<runEnd; run++) {
|
||||
for (DISTANCE run=runStart+1; run<runEnd; run++) {
|
||||
RemoveRun(runStart+1);
|
||||
}
|
||||
runEnd = RunFromPosition(end);
|
||||
@ -162,20 +175,22 @@ bool RunStyles::FillRange(int &position, int value, int &fillLength) {
|
||||
}
|
||||
}
|
||||
|
||||
void RunStyles::SetValueAt(int position, int value) {
|
||||
int len = 1;
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
void RunStyles<DISTANCE, STYLE>::SetValueAt(DISTANCE position, STYLE value) {
|
||||
DISTANCE len = 1;
|
||||
FillRange(position, value, len);
|
||||
}
|
||||
|
||||
void RunStyles::InsertSpace(int position, int insertLength) {
|
||||
int runStart = RunFromPosition(position);
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
void RunStyles<DISTANCE, STYLE>::InsertSpace(DISTANCE position, DISTANCE insertLength) {
|
||||
DISTANCE runStart = RunFromPosition(position);
|
||||
if (starts->PositionFromPartition(runStart) == position) {
|
||||
int runStyle = ValueAt(position);
|
||||
STYLE runStyle = ValueAt(position);
|
||||
// Inserting at start of run so make previous longer
|
||||
if (runStart == 0) {
|
||||
// Inserting at start of document so ensure 0
|
||||
if (runStyle) {
|
||||
styles->SetValueAt(0, 0);
|
||||
styles->SetValueAt(0, STYLE());
|
||||
starts->InsertPartition(1, 0);
|
||||
styles->InsertValue(1, 1, runStyle);
|
||||
starts->InsertText(0, insertLength);
|
||||
@ -195,16 +210,18 @@ void RunStyles::InsertSpace(int position, int insertLength) {
|
||||
}
|
||||
}
|
||||
|
||||
void RunStyles::DeleteAll() {
|
||||
starts.reset(new Partitioning(8));
|
||||
styles.reset(new SplitVector<int>());
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
void RunStyles<DISTANCE, STYLE>::DeleteAll() {
|
||||
starts.reset(new Partitioning<DISTANCE>(8));
|
||||
styles.reset(new SplitVector<STYLE>());
|
||||
styles->InsertValue(0, 2, 0);
|
||||
}
|
||||
|
||||
void RunStyles::DeleteRange(int position, int deleteLength) {
|
||||
int end = position + deleteLength;
|
||||
int runStart = RunFromPosition(position);
|
||||
int runEnd = RunFromPosition(end);
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
void RunStyles<DISTANCE, STYLE>::DeleteRange(DISTANCE position, DISTANCE deleteLength) {
|
||||
DISTANCE end = position + deleteLength;
|
||||
DISTANCE runStart = RunFromPosition(position);
|
||||
DISTANCE runEnd = RunFromPosition(end);
|
||||
if (runStart == runEnd) {
|
||||
// Deleting from inside one run
|
||||
starts->InsertText(runStart, -deleteLength);
|
||||
@ -214,7 +231,7 @@ void RunStyles::DeleteRange(int position, int deleteLength) {
|
||||
runEnd = SplitRun(end);
|
||||
starts->InsertText(runStart, -deleteLength);
|
||||
// Remove each old run over the range
|
||||
for (int run=runStart; run<runEnd; run++) {
|
||||
for (DISTANCE run=runStart; run<runEnd; run++) {
|
||||
RemoveRun(runStart);
|
||||
}
|
||||
RemoveRunIfEmpty(runStart);
|
||||
@ -222,11 +239,13 @@ void RunStyles::DeleteRange(int position, int deleteLength) {
|
||||
}
|
||||
}
|
||||
|
||||
int RunStyles::Runs() const {
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
DISTANCE RunStyles<DISTANCE, STYLE>::Runs() const {
|
||||
return starts->Partitions();
|
||||
}
|
||||
|
||||
bool RunStyles::AllSame() const {
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
bool RunStyles<DISTANCE, STYLE>::AllSame() const {
|
||||
for (int run = 1; run < starts->Partitions(); run++) {
|
||||
if (styles->ValueAt(run) != styles->ValueAt(run - 1))
|
||||
return false;
|
||||
@ -234,13 +253,15 @@ bool RunStyles::AllSame() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RunStyles::AllSameAs(int value) const {
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
bool RunStyles<DISTANCE, STYLE>::AllSameAs(STYLE value) const {
|
||||
return AllSame() && (styles->ValueAt(0) == value);
|
||||
}
|
||||
|
||||
int RunStyles::Find(int value, int start) const {
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
DISTANCE RunStyles<DISTANCE, STYLE>::Find(STYLE value, DISTANCE start) const {
|
||||
if (start < Length()) {
|
||||
int run = start ? RunFromPosition(start) : 0;
|
||||
DISTANCE run = start ? RunFromPosition(start) : 0;
|
||||
if (styles->ValueAt(run) == value)
|
||||
return start;
|
||||
run++;
|
||||
@ -253,7 +274,8 @@ int RunStyles::Find(int value, int start) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void RunStyles::Check() const {
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
void RunStyles<DISTANCE, STYLE>::Check() const {
|
||||
if (Length() < 0) {
|
||||
throw std::runtime_error("RunStyles: Length can not be negative.");
|
||||
}
|
||||
@ -263,9 +285,9 @@ void RunStyles::Check() const {
|
||||
if (starts->Partitions() != styles->Length()-1) {
|
||||
throw std::runtime_error("RunStyles: Partitions and styles different lengths.");
|
||||
}
|
||||
int start=0;
|
||||
DISTANCE start=0;
|
||||
while (start < Length()) {
|
||||
const int end = EndRun(start);
|
||||
const DISTANCE end = EndRun(start);
|
||||
if (start >= end) {
|
||||
throw std::runtime_error("RunStyles: Partition is 0 length.");
|
||||
}
|
||||
@ -280,3 +302,5 @@ void RunStyles::Check() const {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template class Scintilla::RunStyles<int, int>;
|
||||
|
||||
@ -12,36 +12,37 @@
|
||||
|
||||
namespace Scintilla {
|
||||
|
||||
template <typename DISTANCE, typename STYLE>
|
||||
class RunStyles {
|
||||
private:
|
||||
std::unique_ptr<Partitioning> starts;
|
||||
std::unique_ptr<SplitVector<int>> styles;
|
||||
int RunFromPosition(int position) const;
|
||||
int SplitRun(int position);
|
||||
void RemoveRun(int run);
|
||||
void RemoveRunIfEmpty(int run);
|
||||
void RemoveRunIfSameAsPrevious(int run);
|
||||
std::unique_ptr<Partitioning<DISTANCE>> starts;
|
||||
std::unique_ptr<SplitVector<STYLE>> styles;
|
||||
DISTANCE RunFromPosition(DISTANCE position) const;
|
||||
DISTANCE SplitRun(DISTANCE position);
|
||||
void RemoveRun(DISTANCE run);
|
||||
void RemoveRunIfEmpty(DISTANCE run);
|
||||
void RemoveRunIfSameAsPrevious(DISTANCE run);
|
||||
public:
|
||||
RunStyles();
|
||||
// Deleted so RunStyles objects can not be copied.
|
||||
RunStyles(const RunStyles &) = delete;
|
||||
void operator=(const RunStyles &) = delete;
|
||||
~RunStyles();
|
||||
int Length() const;
|
||||
int ValueAt(int position) const;
|
||||
int FindNextChange(int position, int end) const;
|
||||
int StartRun(int position) const;
|
||||
int EndRun(int position) const;
|
||||
DISTANCE Length() const;
|
||||
STYLE ValueAt(DISTANCE position) const;
|
||||
DISTANCE FindNextChange(DISTANCE position, DISTANCE end) const;
|
||||
DISTANCE StartRun(DISTANCE position) const;
|
||||
DISTANCE EndRun(DISTANCE position) const;
|
||||
// Returns true if some values may have changed
|
||||
bool FillRange(int &position, int value, int &fillLength);
|
||||
void SetValueAt(int position, int value);
|
||||
void InsertSpace(int position, int insertLength);
|
||||
bool FillRange(DISTANCE &position, STYLE value, DISTANCE &fillLength);
|
||||
void SetValueAt(DISTANCE position, STYLE value);
|
||||
void InsertSpace(DISTANCE position, DISTANCE insertLength);
|
||||
void DeleteAll();
|
||||
void DeleteRange(int position, int deleteLength);
|
||||
int Runs() const;
|
||||
void DeleteRange(DISTANCE position, DISTANCE deleteLength);
|
||||
DISTANCE Runs() const;
|
||||
bool AllSame() const;
|
||||
bool AllSameAs(int value) const;
|
||||
int Find(int value, int start) const;
|
||||
bool AllSameAs(STYLE value) const;
|
||||
DISTANCE Find(STYLE value, DISTANCE start) const;
|
||||
|
||||
void Check() const;
|
||||
};
|
||||
|
||||
@ -15,7 +15,7 @@ namespace Scintilla {
|
||||
template <typename T>
|
||||
class SparseVector {
|
||||
private:
|
||||
std::unique_ptr<Partitioning> starts;
|
||||
std::unique_ptr<Partitioning<int>> starts;
|
||||
std::unique_ptr<SplitVector<T>> values;
|
||||
T empty;
|
||||
// Deleted so SparseVector objects can not be copied.
|
||||
@ -26,7 +26,7 @@ private:
|
||||
}
|
||||
public:
|
||||
SparseVector() : empty() {
|
||||
starts.reset(new Partitioning(8));
|
||||
starts.reset(new Partitioning<int>(8));
|
||||
values.reset(new SplitVector<T>());
|
||||
values->InsertEmpty(0, 2);
|
||||
}
|
||||
|
||||
@ -16,15 +16,15 @@ class SplitVector {
|
||||
protected:
|
||||
std::vector<T> body;
|
||||
T empty; /// Returned as the result of out-of-bounds access.
|
||||
int lengthBody;
|
||||
int part1Length;
|
||||
int gapLength; /// invariant: gapLength == body.size() - lengthBody
|
||||
int growSize;
|
||||
ptrdiff_t lengthBody;
|
||||
ptrdiff_t part1Length;
|
||||
ptrdiff_t gapLength; /// invariant: gapLength == body.size() - lengthBody
|
||||
ptrdiff_t growSize;
|
||||
|
||||
/// Move the gap to a particular position so that insertion and
|
||||
/// deletion at that point will not require much copying and
|
||||
/// hence be fast.
|
||||
void GapTo(int position) {
|
||||
void GapTo(ptrdiff_t position) {
|
||||
if (position != part1Length) {
|
||||
if (position < part1Length) {
|
||||
// Moving the gap towards start so moving elements towards end
|
||||
@ -45,11 +45,11 @@ protected:
|
||||
|
||||
/// Check that there is room in the buffer for an insertion,
|
||||
/// reallocating if more space needed.
|
||||
void RoomFor(int insertionLength) {
|
||||
void RoomFor(ptrdiff_t insertionLength) {
|
||||
if (gapLength <= insertionLength) {
|
||||
while (growSize < static_cast<int>(body.size() / 6))
|
||||
while (growSize < static_cast<ptrdiff_t>(body.size() / 6))
|
||||
growSize *= 2;
|
||||
ReAllocate(static_cast<int>(body.size()) + insertionLength + growSize);
|
||||
ReAllocate(body.size() + insertionLength + growSize);
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,25 +75,25 @@ public:
|
||||
~SplitVector() {
|
||||
}
|
||||
|
||||
int GetGrowSize() const {
|
||||
ptrdiff_t GetGrowSize() const {
|
||||
return growSize;
|
||||
}
|
||||
|
||||
void SetGrowSize(int growSize_) {
|
||||
|
||||
void SetGrowSize(ptrdiff_t growSize_) {
|
||||
growSize = growSize_;
|
||||
}
|
||||
|
||||
/// Reallocate the storage for the buffer to be newSize and
|
||||
/// copy exisiting contents to the new buffer.
|
||||
/// Must not be used to decrease the size of the buffer.
|
||||
void ReAllocate(int newSize) {
|
||||
void ReAllocate(ptrdiff_t newSize) {
|
||||
if (newSize < 0)
|
||||
throw std::runtime_error("SplitVector::ReAllocate: negative size.");
|
||||
|
||||
if (newSize > static_cast<int>(body.size())) {
|
||||
if (newSize > static_cast<ptrdiff_t>(body.size())) {
|
||||
// Move the gap to the end
|
||||
GapTo(lengthBody);
|
||||
gapLength += newSize - static_cast<int>(body.size());
|
||||
gapLength += newSize - static_cast<ptrdiff_t>(body.size());
|
||||
// RoomFor implements a growth strategy but so does vector::resize so
|
||||
// ensure vector::resize allocates exactly the amount wanted by
|
||||
// calling reserve first.
|
||||
@ -104,7 +104,7 @@ public:
|
||||
|
||||
/// Retrieve the element at a particular position.
|
||||
/// Retrieving positions outside the range of the buffer returns empty or 0.
|
||||
const T& ValueAt(int position) const {
|
||||
const T& ValueAt(ptrdiff_t position) const {
|
||||
if (position < part1Length) {
|
||||
if (position < 0) {
|
||||
return empty;
|
||||
@ -124,7 +124,7 @@ public:
|
||||
/// Setting positions outside the range of the buffer performs no assignment
|
||||
/// but asserts in debug builds.
|
||||
template <typename ParamType>
|
||||
void SetValueAt(int position, ParamType&& v) {
|
||||
void SetValueAt(ptrdiff_t position, ParamType&& v) {
|
||||
if (position < part1Length) {
|
||||
PLATFORM_ASSERT(position >= 0);
|
||||
if (position < 0) {
|
||||
@ -144,7 +144,7 @@ public:
|
||||
|
||||
/// Retrieve the element at a particular position.
|
||||
/// The position must be within bounds or an assertion is triggered.
|
||||
const T &operator[](int position) const {
|
||||
const T &operator[](ptrdiff_t position) const {
|
||||
PLATFORM_ASSERT(position >= 0 && position < lengthBody);
|
||||
if (position < part1Length) {
|
||||
return body[position];
|
||||
@ -156,7 +156,7 @@ public:
|
||||
/// Retrieve reference to the element at a particular position.
|
||||
/// This, instead of the const variant, can be used to mutate in-place.
|
||||
/// The position must be within bounds or an assertion is triggered.
|
||||
T &operator[](int position) {
|
||||
T &operator[](ptrdiff_t position) {
|
||||
PLATFORM_ASSERT(position >= 0 && position < lengthBody);
|
||||
if (position < part1Length) {
|
||||
return body[position];
|
||||
@ -166,13 +166,13 @@ public:
|
||||
}
|
||||
|
||||
/// Retrieve the length of the buffer.
|
||||
int Length() const {
|
||||
ptrdiff_t Length() const {
|
||||
return lengthBody;
|
||||
}
|
||||
|
||||
/// Insert a single value into the buffer.
|
||||
/// Inserting at positions outside the current range fails.
|
||||
void Insert(int position, T v) {
|
||||
void Insert(ptrdiff_t position, T v) {
|
||||
PLATFORM_ASSERT((position >= 0) && (position <= lengthBody));
|
||||
if ((position < 0) || (position > lengthBody)) {
|
||||
return;
|
||||
@ -187,7 +187,7 @@ public:
|
||||
|
||||
/// Insert a number of elements into the buffer setting their value.
|
||||
/// Inserting at positions outside the current range fails.
|
||||
void InsertValue(int position, int insertLength, T v) {
|
||||
void InsertValue(ptrdiff_t position, ptrdiff_t insertLength, T v) {
|
||||
PLATFORM_ASSERT((position >= 0) && (position <= lengthBody));
|
||||
if (insertLength > 0) {
|
||||
if ((position < 0) || (position > lengthBody)) {
|
||||
@ -205,7 +205,7 @@ public:
|
||||
/// Add some new empty elements.
|
||||
/// InsertValue is good for value objects but not for unique_ptr objects
|
||||
/// since they can only be moved from once.
|
||||
void InsertEmpty(int position, int insertLength) {
|
||||
void InsertEmpty(ptrdiff_t position, ptrdiff_t insertLength) {
|
||||
PLATFORM_ASSERT((position >= 0) && (position <= lengthBody));
|
||||
if (insertLength > 0) {
|
||||
if ((position < 0) || (position > lengthBody)) {
|
||||
@ -213,7 +213,7 @@ public:
|
||||
}
|
||||
RoomFor(insertLength);
|
||||
GapTo(position);
|
||||
for (int elem = part1Length; elem < part1Length + insertLength; elem++) {
|
||||
for (ptrdiff_t elem = part1Length; elem < part1Length + insertLength; elem++) {
|
||||
T emptyOne = {};
|
||||
body[elem] = std::move(emptyOne);
|
||||
}
|
||||
@ -225,14 +225,14 @@ public:
|
||||
|
||||
/// Ensure at least length elements allocated,
|
||||
/// appending zero valued elements if needed.
|
||||
void EnsureLength(int wantedLength) {
|
||||
void EnsureLength(ptrdiff_t wantedLength) {
|
||||
if (Length() < wantedLength) {
|
||||
InsertEmpty(Length(), wantedLength - Length());
|
||||
}
|
||||
}
|
||||
|
||||
/// Insert text into the buffer from an array.
|
||||
void InsertFromArray(int positionToInsert, const T s[], int positionFrom, int insertLength) {
|
||||
void InsertFromArray(ptrdiff_t positionToInsert, const T s[], ptrdiff_t positionFrom, ptrdiff_t insertLength) {
|
||||
PLATFORM_ASSERT((positionToInsert >= 0) && (positionToInsert <= lengthBody));
|
||||
if (insertLength > 0) {
|
||||
if ((positionToInsert < 0) || (positionToInsert > lengthBody)) {
|
||||
@ -248,7 +248,7 @@ public:
|
||||
}
|
||||
|
||||
/// Delete one element from the buffer.
|
||||
void Delete(int position) {
|
||||
void Delete(ptrdiff_t position) {
|
||||
PLATFORM_ASSERT((position >= 0) && (position < lengthBody));
|
||||
if ((position < 0) || (position >= lengthBody)) {
|
||||
return;
|
||||
@ -258,7 +258,7 @@ public:
|
||||
|
||||
/// Delete a range from the buffer.
|
||||
/// Deleting positions outside the current range fails.
|
||||
void DeleteRange(int position, int deleteLength) {
|
||||
void DeleteRange(ptrdiff_t position, ptrdiff_t deleteLength) {
|
||||
PLATFORM_ASSERT((position >= 0) && (position + deleteLength <= lengthBody));
|
||||
if ((position < 0) || ((position + deleteLength) > lengthBody)) {
|
||||
return;
|
||||
@ -277,23 +277,23 @@ public:
|
||||
|
||||
/// Delete all the buffer contents.
|
||||
void DeleteAll() {
|
||||
DeleteRange(0, static_cast<int>(lengthBody));
|
||||
DeleteRange(0, lengthBody);
|
||||
}
|
||||
|
||||
/// Retrieve a range of elements into an array
|
||||
void GetRange(T *buffer, int position, int retrieveLength) const {
|
||||
void GetRange(T *buffer, ptrdiff_t position, ptrdiff_t retrieveLength) const {
|
||||
// Split into up to 2 ranges, before and after the split then use memcpy on each.
|
||||
int range1Length = 0;
|
||||
ptrdiff_t range1Length = 0;
|
||||
if (position < part1Length) {
|
||||
const int part1AfterPosition = part1Length - position;
|
||||
const ptrdiff_t part1AfterPosition = part1Length - position;
|
||||
range1Length = retrieveLength;
|
||||
if (range1Length > part1AfterPosition)
|
||||
range1Length = part1AfterPosition;
|
||||
}
|
||||
std::copy(body.data() + position, body.data() + position + range1Length, buffer);
|
||||
buffer += range1Length;
|
||||
position = static_cast<int>(position + range1Length + gapLength);
|
||||
int range2Length = retrieveLength - range1Length;
|
||||
position = position + range1Length + gapLength;
|
||||
ptrdiff_t range2Length = retrieveLength - range1Length;
|
||||
std::copy(body.data() + position, body.data() + position + range2Length, buffer);
|
||||
}
|
||||
|
||||
@ -308,7 +308,7 @@ public:
|
||||
|
||||
/// Return a pointer to a range of elements, first rearranging the buffer if
|
||||
/// needed to make that range contiguous.
|
||||
T *RangePointer(int position, int rangeLength) {
|
||||
T *RangePointer(ptrdiff_t position, ptrdiff_t rangeLength) {
|
||||
if (position < part1Length) {
|
||||
if ((position + rangeLength) > part1Length) {
|
||||
// Range overlaps gap, so move gap to start of range.
|
||||
@ -323,7 +323,7 @@ public:
|
||||
}
|
||||
|
||||
/// Return the position of the gap within the buffer.
|
||||
int GapPosition() const {
|
||||
ptrdiff_t GapPosition() const {
|
||||
return part1Length;
|
||||
}
|
||||
};
|
||||
|
||||
@ -458,7 +458,7 @@ void ViewStyle::CalcLargestMarkerHeight() {
|
||||
}
|
||||
|
||||
int ViewStyle::GetFrameWidth() const {
|
||||
return Sci::clamp(caretLineFrame, 1, lineHeight / 3);
|
||||
return static_cast<int>(std::clamp(caretLineFrame, 1, lineHeight / 3));
|
||||
}
|
||||
|
||||
bool ViewStyle::IsLineFrameOpaque(bool caretActive, bool lineContainsCaret) const {
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
|
||||
#include "Platform.h"
|
||||
@ -87,7 +89,7 @@ void XPM::Init(const char *const *linesForm) {
|
||||
if (!linesForm)
|
||||
return;
|
||||
|
||||
std::fill(colourCodeTable, colourCodeTable+256, 0);
|
||||
std::fill(colourCodeTable, std::end(colourCodeTable), 0);
|
||||
const char *line0 = linesForm[0];
|
||||
width = atoi(line0);
|
||||
line0 = NextField(line0);
|
||||
|
||||
@ -308,7 +308,7 @@ class ScintillaWin :
|
||||
|
||||
Sci::Position TargetAsUTF8(char *text);
|
||||
void AddCharUTF16(wchar_t const *wcs, unsigned int wclen);
|
||||
Sci::Position EncodedFromUTF8(char *utf8, char *encoded) const;
|
||||
Sci::Position EncodedFromUTF8(const char *utf8, char *encoded) const;
|
||||
sptr_t WndPaint(uptr_t wParam);
|
||||
|
||||
sptr_t HandleCompositionWindowed(uptr_t wParam, sptr_t lParam);
|
||||
@ -769,8 +769,8 @@ Sci::Position ScintillaWin::TargetAsUTF8(char *text) {
|
||||
|
||||
// Translates a nul terminated UTF8 string into the document encoding.
|
||||
// Return the length of the result in bytes.
|
||||
Sci::Position ScintillaWin::EncodedFromUTF8(char *utf8, char *encoded) const {
|
||||
Sci::Position inputLength = (lengthForEncode >= 0) ? lengthForEncode : static_cast<Sci::Position>(strlen(utf8));
|
||||
Sci::Position ScintillaWin::EncodedFromUTF8(const char *utf8, char *encoded) const {
|
||||
const Sci::Position inputLength = (lengthForEncode >= 0) ? lengthForEncode : static_cast<Sci::Position>(strlen(utf8));
|
||||
if (IsUnicodeMode()) {
|
||||
if (encoded) {
|
||||
memcpy(encoded, utf8, inputLength);
|
||||
@ -778,11 +778,11 @@ Sci::Position ScintillaWin::EncodedFromUTF8(char *utf8, char *encoded) const {
|
||||
return inputLength;
|
||||
} else {
|
||||
// Need to convert
|
||||
int charsLen = ::MultiByteToWideChar(CP_UTF8, 0, utf8, inputLength, NULL, 0);
|
||||
const int charsLen = ::MultiByteToWideChar(CP_UTF8, 0, utf8, static_cast<int>(inputLength), NULL, 0);
|
||||
std::wstring characters(charsLen, '\0');
|
||||
::MultiByteToWideChar(CP_UTF8, 0, utf8, inputLength, &characters[0], charsLen);
|
||||
::MultiByteToWideChar(CP_UTF8, 0, utf8, static_cast<int>(inputLength), &characters[0], charsLen);
|
||||
|
||||
int encodedLen = ::WideCharToMultiByte(CodePageOfDocument(),
|
||||
const int encodedLen = ::WideCharToMultiByte(CodePageOfDocument(),
|
||||
0, &characters[0], charsLen, NULL, 0, 0, 0);
|
||||
if (encoded) {
|
||||
::WideCharToMultiByte(CodePageOfDocument(), 0, &characters[0], charsLen, encoded, encodedLen, 0, 0);
|
||||
@ -1655,10 +1655,10 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
|
||||
|
||||
case EM_GETSEL:
|
||||
if (wParam) {
|
||||
*reinterpret_cast<int *>(wParam) = SelectionStart().Position();
|
||||
*reinterpret_cast<int *>(wParam) = static_cast<int>(SelectionStart().Position());
|
||||
}
|
||||
if (lParam) {
|
||||
*reinterpret_cast<int *>(lParam) = SelectionEnd().Position();
|
||||
*reinterpret_cast<int *>(lParam) = static_cast<int>(SelectionEnd().Position());
|
||||
}
|
||||
return MAKELONG(SelectionStart().Position(), SelectionEnd().Position());
|
||||
|
||||
@ -1667,8 +1667,8 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
|
||||
return 0;
|
||||
}
|
||||
Sci_CharacterRange *pCR = reinterpret_cast<Sci_CharacterRange *>(lParam);
|
||||
pCR->cpMin = SelectionStart().Position();
|
||||
pCR->cpMax = SelectionEnd().Position();
|
||||
pCR->cpMin = static_cast<Sci_PositionCR>(SelectionStart().Position());
|
||||
pCR->cpMax = static_cast<Sci_PositionCR>(SelectionEnd().Position());
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1745,6 +1745,17 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
|
||||
}
|
||||
break;
|
||||
|
||||
case SCI_SETBIDIRECTIONAL:
|
||||
if (technology == SC_TECHNOLOGY_DEFAULT) {
|
||||
bidirectional = EditModel::Bidirectional::bidiDisabled;
|
||||
} else if ((wParam >= SC_BIDIRECTIONAL_DISABLED) && (wParam <= SC_BIDIRECTIONAL_R2L)) {
|
||||
bidirectional = static_cast<EditModel::Bidirectional>(wParam);
|
||||
}
|
||||
// Invalidate all cached information including layout.
|
||||
DropGraphics(true);
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
#ifdef SCI_LEXER
|
||||
case SCI_LOADLEXERLIBRARY:
|
||||
LexerManager::GetInstance()->Load(reinterpret_cast<const char *>(lParam));
|
||||
@ -1755,7 +1766,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
|
||||
return TargetAsUTF8(reinterpret_cast<char*>(lParam));
|
||||
|
||||
case SCI_ENCODEDFROMUTF8:
|
||||
return EncodedFromUTF8(reinterpret_cast<char*>(wParam),
|
||||
return EncodedFromUTF8(reinterpret_cast<const char*>(wParam),
|
||||
reinterpret_cast<char*>(lParam));
|
||||
|
||||
default:
|
||||
@ -1894,7 +1905,7 @@ void ScintillaWin::ChangeScrollPos(int barType, Sci::Position pos) {
|
||||
GetScrollInfo(barType, &sci);
|
||||
if (sci.nPos != pos) {
|
||||
DwellEnd(true);
|
||||
sci.nPos = pos;
|
||||
sci.nPos = static_cast<int>(pos);
|
||||
SetScrollInfo(barType, &sci, TRUE);
|
||||
}
|
||||
}
|
||||
@ -1923,8 +1934,8 @@ bool ScintillaWin::ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) {
|
||||
(sci.nPos != 0)) {
|
||||
sci.fMask = SIF_PAGE | SIF_RANGE;
|
||||
sci.nMin = 0;
|
||||
sci.nMax = vertEndPreferred;
|
||||
sci.nPage = nPage;
|
||||
sci.nMax = static_cast<int>(vertEndPreferred);
|
||||
sci.nPage = static_cast<UINT>(nPage);
|
||||
sci.nPos = 0;
|
||||
sci.nTrackPos = 1;
|
||||
SetScrollInfo(SB_VERT, &sci, TRUE);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user