diff options
| author | nyamatongwe <unknown> | 2000-11-03 12:04:24 +0000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2000-11-03 12:04:24 +0000 | 
| commit | e71300aff5ea1a263f7ab003b39b2c1c88c3878d (patch) | |
| tree | 83c69fd5be64d4351be572d4c8ca82fc34171e76 /src | |
| parent | 110ed1eaae1ecdce22f6a54b64077bbe1c6cd506 (diff) | |
| download | scintilla-mirror-e71300aff5ea1a263f7ab003b39b2c1c88c3878d.tar.gz | |
Shift+Tab when selection on one line moves cursor backwards to tab stops
just as it does in VC++.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Editor.cxx | 35 | 
1 files changed, 23 insertions, 12 deletions
| diff --git a/src/Editor.cxx b/src/Editor.cxx index 466f5efc0..9fd970e99 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2321,19 +2321,30 @@ void Editor::Indent(bool forwards) {  	int lineOfAnchor = pdoc->LineFromPosition(anchor);  	int lineCurrentPos = pdoc->LineFromPosition(currentPos);  	if (lineOfAnchor == lineCurrentPos) { -		ClearSelection(); -		if (pdoc->useTabs) { -			pdoc->InsertChar(currentPos, '\t'); -			SetEmptySelection(currentPos + 1); -		} else { -			int numSpaces = (pdoc->tabInChars) -  -				(pdoc->GetColumn(currentPos) % (pdoc->tabInChars)); -			if (numSpaces < 1) -				numSpaces = pdoc->tabInChars; -			for (int i = 0; i < numSpaces; i++) { -				pdoc->InsertChar(currentPos, ' '); +		if (forwards) { +			ClearSelection(); +			if (pdoc->useTabs) { +				pdoc->InsertChar(currentPos, '\t'); +				SetEmptySelection(currentPos + 1); +			} else { +				int numSpaces = (pdoc->tabInChars) -  +					(pdoc->GetColumn(currentPos) % (pdoc->tabInChars)); +				if (numSpaces < 1) +					numSpaces = pdoc->tabInChars; +				for (int i = 0; i < numSpaces; i++) { +					pdoc->InsertChar(currentPos, ' '); +				} +				SetEmptySelection(currentPos + numSpaces);  			} -			SetEmptySelection(currentPos + numSpaces); +		} else { +			int newColumn = ((pdoc->GetColumn(currentPos)-1) / pdoc->tabInChars) *  +				pdoc->tabInChars; +			if (newColumn < 0) +				newColumn = 0; +			int newPos = currentPos; +			while (pdoc->GetColumn(newPos) > newColumn) +				newPos--; +			SetEmptySelection(newPos);  		}  	} else {  		int anchorPosOnLine = anchor - pdoc->LineStart(lineOfAnchor); | 
