[colobot] 213/377: Improvements to auto-indent (#698)
Didier Raboud
odyx at moszumanska.debian.org
Wed Mar 30 13:34:17 UTC 2016
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository colobot.
commit 3b4ccc3535e8270d410e38ab28194e5fe91b0fde
Author: krzys-h <krzys_h at interia.pl>
Date: Sat Dec 26 20:16:47 2015 +0100
Improvements to auto-indent (#698)
---
src/ui/controls/edit.cpp | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/ui/controls/edit.cpp b/src/ui/controls/edit.cpp
index eb5f829..badcedf 100644
--- a/src/ui/controls/edit.cpp
+++ b/src/ui/controls/edit.cpp
@@ -2654,22 +2654,32 @@ void CEdit::Insert(char character)
}
else if ( m_bAutoIndent )
{
- if ( character == '{' )
+ if (character == '{')
{
InsertOne(character);
- InsertOne('\n');
- InsertOne('\n');
InsertOne('}');
MoveChar(-1, false, false);
- MoveChar(-1, false, false);
}
- else if ( character == '\t' )
+ else if (character == '\t')
{
for ( i=0 ; i<m_engine->GetEditIndentValue() ; i++ )
{
InsertOne(' ');
}
}
+ else if (character == '\n')
+ {
+ if (m_cursor1 > 1 && m_text[m_cursor1-1] == '{')
+ {
+ InsertOne(character);
+ InsertOne('\n');
+ MoveChar(-1, false, false);
+ }
+ else
+ {
+ InsertOne(character);
+ }
+ }
else
{
InsertOne(character);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git
More information about the Pkg-games-commits
mailing list