aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Document.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2001-05-14 03:26:53 +0000
committernyamatongwe <devnull@localhost>2001-05-14 03:26:53 +0000
commitd2af76b9da8cd7b74ec1fdc22a4e9de1bb7e836c (patch)
tree130d3d877cd2b55ce719a4dec978ce3bc8e8b3fe /src/Document.cxx
parent17cae950f3e55b309f1d7da372519810c7ff9619 (diff)
downloadscintilla-mirror-d2af76b9da8cd7b74ec1fdc22a4e9de1bb7e836c.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);