aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Document.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2001-05-14 03:26:53 +0000
committernyamatongwe <unknown>2001-05-14 03:26:53 +0000
commit466ec638ae719c9256286862355b33a39c7f136b (patch)
tree130d3d877cd2b55ce719a4dec978ce3bc8e8b3fe /src/Document.cxx
parent94eccf378241a5cefbfe7cec6734694cc85ee8b8 (diff)
downloadscintilla-mirror-466ec638ae719c9256286862355b33a39c7f136b.tar.gz
Merged patch from Michele to add ability for tab key to perform indent when
selection is empty and within indentation and for backspace to unindent in the same circumstances.
Diffstat (limited to 'src/Document.cxx')
-rw-r--r--src/Document.cxx23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/Document.cxx b/src/Document.cxx
index befae4570..1ea2da012 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -44,6 +44,8 @@ Document::Document() {
tabInChars = 8;
indentInChars = 0;
useTabs = true;
+ tabIndents = true;
+ backspaceUnindents = false;
watchers = 0;
lenWatchers = 0;
@@ -150,8 +152,8 @@ int Document::VCHomePosition(int position) {
int Document::SetLevel(int line, int level) {
int prev = cb.SetLevel(line, level);
if (prev != level) {
- DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER,
- LineStart(line), 0, 0, 0);
+ DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER,
+ LineStart(line), 0, 0, 0);
mh.line = line;
mh.foldLevelNow = level;
mh.foldLevelPrev = prev;
@@ -331,6 +333,7 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) {
//Platform::DebugPrintf("DBCS %s\n", atlead ? "D" : "-");
}
+
if (atLeadByte) {
// Position is between a lead byte and a trail byte
if (moveDir > 0)
@@ -837,7 +840,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
int lineRangeStart = LineFromPosition(startPos);
int lineRangeEnd = LineFromPosition(endPos);
if ((startPos >= LineEnd(lineRangeStart)) && (lineRangeStart < lineRangeEnd)) {
- // the start position is at end of line or between line end characters.
+ // the start position is at end of line or between line end characters.
lineRangeStart++;
startPos = LineStart(lineRangeStart);
}
@@ -851,7 +854,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
startPos++;
} else if (s[0] == '$') {
if ((startPos == LineEnd(lineRangeStart)) && (lineRangeStart < lineRangeEnd))
- startPos = LineStart(lineRangeStart+1);
+ startPos = LineStart(lineRangeStart + 1);
}
lineRangeStart = LineFromPosition(startPos);
lineRangeEnd = LineFromPosition(endPos);
@@ -955,9 +958,9 @@ const char *Document::SubstituteByPosition(const char *text, int *length) {
if (!pre->GrabMatches(di))
return 0;
unsigned int lenResult = 0;
- for (int i=0; i<*length; i++) {
- if ((text[i] == '\\') && (text[i+1] >= '1' && text[i+1] <= '9')) {
- unsigned int patNum = text[i+1] - '0';
+ for (int i = 0; i < *length; i++) {
+ if ((text[i] == '\\') && (text[i + 1] >= '1' && text[i + 1] <= '9')) {
+ unsigned int patNum = text[i + 1] - '0';
lenResult += pre->eopat[patNum] - pre->bopat[patNum];
i++;
} else {
@@ -968,9 +971,9 @@ const char *Document::SubstituteByPosition(const char *text, int *length) {
if (!substituted)
return 0;
char *o = substituted;
- for (int j=0; j<*length; j++) {
- if ((text[j] == '\\') && (text[j+1] >= '1' && text[j+1] <= '9')) {
- unsigned int patNum = text[j+1] - '0';
+ for (int j = 0; j < *length; j++) {
+ if ((text[j] == '\\') && (text[j + 1] >= '1' && text[j + 1] <= '9')) {
+ unsigned int patNum = text[j + 1] - '0';
unsigned int len = pre->eopat[patNum] - pre->bopat[patNum];
if (pre->pat[patNum]) // Will be null if try for a match that did not occur
memcpy(o, pre->pat[patNum], len);