Auto indent added for () [] braces

This commit is contained in:
Sergey Kalinin
2018-02-08 11:07:14 +03:00
parent be2f63b14f
commit 70bf20d61e
6 changed files with 30 additions and 37 deletions

View File

@@ -171,5 +171,6 @@ proc auto_completition_key { widget K A } {

View File

@@ -798,6 +798,29 @@ proc TabIns {text} {
set shouldBeSpaces [expr {$shouldBeSpaces - $indentSize}]
}
}
if {$lastSymbol == "\["} {
incr shouldBeSpaces $indentSize
}
set a ""
regexp "^| *\]" $curText a
if {$a != ""} {
# make unindent
if {$shouldBeSpaces >= $indentSize} {
set shouldBeSpaces [expr {$shouldBeSpaces - $indentSize}]
}
}
if {$lastSymbol == "\("} {
incr shouldBeSpaces $indentSize
}
set a ""
regexp {^| *\)} $curText a
if {$a != ""} {
# make unindent
if {$shouldBeSpaces >= $indentSize} {
set shouldBeSpaces [expr {$shouldBeSpaces - $indentSize}]
}
}
set spaceNum [string length $spaces]
if {$shouldBeSpaces > $spaceNum} {
#insert spaces
@@ -1202,6 +1225,3 @@ proc TextOperation {oper} {
####################################
GetOp

View File

@@ -324,37 +324,3 @@ proc TopLevelHelp {} {
#GetContent $docDir/tcl.toc.html

View File

@@ -212,3 +212,4 @@ proc HighLightTCL {text line lineNumber node} {
}

View File

@@ -1087,3 +1087,4 @@ proc GetExtention {node} {