Antonio Linares wrote:Cristobal,
Te está funcionando bien la indentación ? Esperaré a que esté bien y la incluyo. Gracias
Antonio, en mi anterior post te preguntaba como funcionaba el cierre de indentacion, mira a ver si me puedes decir algo para seguir
Hacia la derecha ya funciona bastante bien
--------------------------------------------- EDITADO
De momento, esto funciona muy bien
Currently, this works very well
- Code: Select all Expand view
METHOD AutoIndent( cLine ) CLASS TEdtScint
Local nCurLine := ::GetCurrentLine()
Local nIndentation := ::SendEditor( SCI_GETLINEINDENTATION, nCurLine-1 , 0 )
Local x
Local nPos := 0
Local nInd := ::SendEditor( SCI_GETINDENT, 0, 0 )
Local aCad1 := {"for ", "while ", "if ", "with ", "case " }
Local aCad2 := {"next ", "enddo ", "endif ", "end ", "endcase ", ;
"endwhile ", "endwith ", "else ", "otherwise " }//loop switch "
Local nPosInd := ::SendEditor( SCI_GETLINEINDENTPOSITION, nCurLine, )
DEFAULT cLine := ""
For x = 1 to Len( aCad1 )
nPos := At( aCad1[ x ], Lower( cLine ) )
if !Empty( nPos )
x := Len( aCad1 ) + 1
endif
Next x
if Empty( nPos )
/*
For x = 1 to Len( aCad2 )
nPos := At( aCad2[ x ], Lower( cLine ) )
if !Empty( nPos )
x := Len( aCad2 ) + 1
endif
Next x
*/
/*
if !Empty( nPos )
nIndentation := nIndentation - nInd
endif
*/
nPosInd := 0
else
nIndentation := nIndentation + nInd
endif
if ::GetLineCount() > nCurLine
::GoLine( nCurLine + 1 )
endif
::SendEditor( SCI_SETLINEINDENTATION, nCurLine, nPosInd + nIndentation )
::GotoPos( ::GetCurrentPos() + nIndentation )
return nil