From a8520ad03e940aca0bb07733be738f19579f5848 Mon Sep 17 00:00:00 2001 From: Margers Date: Mon, 11 Nov 2024 08:06:37 +0000 Subject: [PATCH] Show line indents in Textmode IDE --- packages/ide/fpconst.pas | 2 +- packages/ide/fpide.pas | 1 + packages/ide/fpmopts.inc | 41 +++++++++++++++++++++------------------- packages/ide/weditor.pas | 12 +++++++++++- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/packages/ide/fpconst.pas b/packages/ide/fpconst.pas index 86fcbaadd9..84c36051c6 100644 --- a/packages/ide/fpconst.pas +++ b/packages/ide/fpconst.pas @@ -490,7 +490,7 @@ const { CSourceWindow } {167-182}#$17#$1F#$1A#$31#$31#$1E#$71#$1F#$00#$00#$00#$00#$00#$00#$00#$00 + { 1-16} {183-198}#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00 + {17-32} -{199-214}#$1E#$1F#$17#$1F#$1E#$1B#$13#$1A#$1E#$71#$3F#$30#$1C#$13#$1F#$4E + {33-48} +{199-214}#$1E#$19#$17#$1F#$1E#$1B#$13#$1A#$1E#$71#$3F#$30#$1C#$13#$19#$4E + {33-48} { CBrowserWindow } {215-226}#$31#$3F#$3A#$31#$31#$31#$71#$1F#$31#$2F#$3E#$3F + { CFPClockView } diff --git a/packages/ide/fpide.pas b/packages/ide/fpide.pas index 87a48d3c0e..9bcc5ae3e4 100644 --- a/packages/ide/fpide.pas +++ b/packages/ide/fpide.pas @@ -607,6 +607,7 @@ resourcestring menu_local_gotosource = '~G~oto source'; label_editor_persistentblocks = '~P~ersistent blocks'; label_editor_overwriteblocks = '~O~verwrite blocks'; label_editor_syntaxhighlight = '~S~yntax highlight'; + label_editor_showlineindents = 'Sho~w~ line indents'; label_editor_blockinsertcursor = 'B~l~ock insert cursor'; label_editor_verticalblocks = '~V~ertical blocks'; label_editor_highlightcolumn = 'Highlight ~c~olumn'; diff --git a/packages/ide/fpmopts.inc b/packages/ide/fpmopts.inc index c8da1d503b..7977f1490c 100644 --- a/packages/ide/fpmopts.inc +++ b/packages/ide/fpmopts.inc @@ -1217,21 +1217,22 @@ begin if (EFlags and efPersistentBlocks )<>0 then EFValue:=EFValue or (1 shl 5); if (EFlags and efOverwriteBlocks )<>0 then EFValue:=EFValue or (1 shl 6); if (EFlags and efSyntaxHighlight )<>0 then EFValue:=EFValue or (1 shl 7); - if (EFlags and efVerticalBlocks )<>0 then EFValue:=EFValue or (1 shl 8); - if (EFlags and efHighlightColumn )<>0 then EFValue:=EFValue or (1 shl 9); - if (EFlags and efHighlightRow )<>0 then EFValue:=EFValue or (1 shl 10); - if (EFlags and efAutoBrackets )<>0 then EFValue:=EFValue or (1 shl 11); - if (EFlags and efKeepTrailingSpaces)<>0 then EFValue:=EFValue or (1 shl 12); - if (EFlags and efCodeComplete )<>0 then EFValue:=EFValue or (1 shl 13); - if (EFlags and efFolds )<>0 then EFValue:=EFValue or (1 shl 14); - if (EFlags and efBlockInsCursor )<>0 then EFValue:=EFValue or (1 shl 15); + if (EFlags and efShowIndent )<>0 then EFValue:=EFValue or (1 shl 8); + if (EFlags and efVerticalBlocks )<>0 then EFValue:=EFValue or (1 shl 9); + if (EFlags and efHighlightColumn )<>0 then EFValue:=EFValue or (1 shl 10); + if (EFlags and efHighlightRow )<>0 then EFValue:=EFValue or (1 shl 11); + if (EFlags and efAutoBrackets )<>0 then EFValue:=EFValue or (1 shl 12); + if (EFlags and efKeepTrailingSpaces)<>0 then EFValue:=EFValue or (1 shl 13); + if (EFlags and efCodeComplete )<>0 then EFValue:=EFValue or (1 shl 14); + if (EFlags and efFolds )<>0 then EFValue:=EFValue or (1 shl 15); + if (EFlags and efBlockInsCursor )<>0 then EFValue:=EFValue or (1 shl 16); - R.Assign(0,0,66,20); + R.Assign(0,0,66,21); New(D, Init(R, Title)); with D^ do begin HelpCtx:=hcEditor; - GetExtent(R); R.Grow(-2,-2); R.B.Y:=R.A.Y+9; + GetExtent(R); R.Grow(-2,-2); R.B.Y:=R.A.Y+10; R2.Copy(R); Inc(R2.A.Y); New(CB, Init(R2, NewSItem(label_editor_backupfiles, @@ -1242,6 +1243,7 @@ begin NewSItem(label_editor_persistentblocks, NewSItem(label_editor_overwriteblocks, NewSItem(label_editor_syntaxhighlight, + NewSItem(label_editor_showlineindents, NewSItem(label_editor_verticalblocks, NewSItem(label_editor_highlightcolumn, NewSItem(label_editor_highlightrow, @@ -1250,7 +1252,7 @@ begin NewSItem(label_editor_codecomplete, NewSItem(label_editor_folds, NewSItem(label_editor_blockinsertcursor, - nil)))))))))))))))))); + nil))))))))))))))))))); CB^.Value:=EFValue; Insert(CB); R2.Move(0,-1); R2.B.Y:=R2.A.Y+1; @@ -1300,14 +1302,15 @@ begin if (CB^.Value and (1 shl 5))<>0 then EFlags:=EFlags or efPersistentBlocks; if (CB^.Value and (1 shl 6))<>0 then EFlags:=EFlags or efOverwriteBlocks; if (CB^.Value and (1 shl 7))<>0 then EFlags:=EFlags or efSyntaxHighlight; - if (CB^.Value and (1 shl 8))<>0 then EFlags:=EFlags or efVerticalBlocks; - if (CB^.Value and (1 shl 9))<>0 then EFlags:=EFlags or efHighlightColumn; - if (CB^.Value and (1 shl 10))<>0 then EFlags:=EFlags or efHighlightRow; - if (CB^.Value and (1 shl 11))<>0 then EFlags:=EFlags or efAutoBrackets; - if (CB^.Value and (1 shl 12))<>0 then EFlags:=EFlags or efKeepTrailingSpaces; - if (CB^.Value and (1 shl 13))<>0 then EFlags:=EFlags or efCodeComplete; - if (CB^.Value and (1 shl 14))<>0 then EFlags:=EFlags or efFolds; - if (CB^.Value and (1 shl 15))<>0 then EFlags:=EFlags or efBlockInsCursor; + if (CB^.Value and (1 shl 8))<>0 then EFlags:=EFlags or efShowIndent; + if (CB^.Value and (1 shl 9))<>0 then EFlags:=EFlags or efVerticalBlocks; + if (CB^.Value and (1 shl 10))<>0 then EFlags:=EFlags or efHighlightColumn; + if (CB^.Value and (1 shl 11))<>0 then EFlags:=EFlags or efHighlightRow; + if (CB^.Value and (1 shl 12))<>0 then EFlags:=EFlags or efAutoBrackets; + if (CB^.Value and (1 shl 13))<>0 then EFlags:=EFlags or efKeepTrailingSpaces; + if (CB^.Value and (1 shl 14))<>0 then EFlags:=EFlags or efCodeComplete; + if (CB^.Value and (1 shl 15))<>0 then EFlags:=EFlags or efFolds; + if (CB^.Value and (1 shl 16))<>0 then EFlags:=EFlags or efBlockInsCursor; TabSize:=StrToInt(ILTab^.Data^); IndentSize:=StrToInt(ILIdent^.Data^); if Editor=nil then diff --git a/packages/ide/weditor.pas b/packages/ide/weditor.pas index a7faa46cf6..5fdeaa062c 100644 --- a/packages/ide/weditor.pas +++ b/packages/ide/weditor.pas @@ -95,6 +95,7 @@ const efNoIndent = $00010000; efKeepLineAttr = $00020000; efOverwriteBlocks = $00040000; + efShowIndent = $00080000; efStoreContent = $80000000; attrAsm = 1; @@ -3926,7 +3927,7 @@ begin Color:=(Color and $F0) or $F; CombineColors:=Color; end; -var +var ShowIndent:boolean; FoldPrefix,FoldSuffix: string; { SkipLine: boolean;} { FoldStartLine: sw_integer;} @@ -3962,6 +3963,7 @@ begin HighlightColColor:=GetColor(11); HighlightRowColor:=GetColor(12); ErrorMessageColor:=GetColor(16); + ShowIndent:=IsFlagSet(efShowIndent) and IsFlagSet(efSyntaxHighlight); {$ifdef TEST_PARTIAL_SYNTAX} If (not GetSyntaxCompleted) and (GetLastSyntaxedLine ' ' then break; + if (X>1 ) and (X and 1 = 1) then + if ord(Format[X]) in [coWhiteSpaceColor,coTabColor] then + LineText[X]:=#179; { | show line indent } + end; MaxX:=Min(Delta.X+1+Size.X,MaxLineLength); for X:=(MaxX-Size.X) to MaxX+1 do