From 113a53ab54f4bcfd799f16aa9ce110a52d4fab0e Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Mon, 16 Apr 2018 00:23:30 +0200 Subject: [PATCH] terminal, add the scrollbacklines property --- etc/terminal/terminalctrls.pas | 14 ++++++++++++++ src/ce_term.pas | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/etc/terminal/terminalctrls.pas b/etc/terminal/terminalctrls.pas index 29b450d4..f479e6ef 100644 --- a/etc/terminal/terminalctrls.pas +++ b/etc/terminal/terminalctrls.pas @@ -33,9 +33,11 @@ type fBackgroundColor: TColor; fForegroundColor: TColor; fSelectedColor: TColor; + fScrollbackLines: LongWord; procedure setBackgroundColor(value: TColor); procedure setForegroundColor(value: TColor); procedure setSelectedColor(value: TColor); + procedure setScrollBackLines(value: LongWord); protected // Only used at design-time. procedure Paint; override; @@ -53,6 +55,7 @@ type {$ifdef windows} property terminalProgram: string read fTermProgram write fTermProgram; {$endif} + property scrollbackLines: LongWord read fScrollbackLines write setScrollBackLines default 512; // Background color property backgroundColor: TColor read fBackgroundColor write setBackgroundColor default clBlack; // Font color @@ -326,6 +329,7 @@ begin fSelectedColor:= clWhite; Font.Height:=11; Font.Name:='Monospace'; + fScrollbackLines:=512; {$ifdef windows} fTermProgram := 'cmd.exe'; @@ -349,6 +353,16 @@ procedure TTerminal.Paint; begin end; +procedure TTerminal.setScrollBackLines(value: LongWord); +var + v: TGValue; +begin + fScrollbackLines:=value; + v.g_type:= 1; + v.data[0].v_uint := fScrollbackLines; + g_object_set_property(PGObject(PWidgetInfo(FInfo).ClientWidget), 'scrollback-lines', @v); +end; + procedure TTerminal.setBackgroundColor(value: TColor); {$ifdef hasgtk2term} var diff --git a/src/ce_term.pas b/src/ce_term.pas index a4186dd1..3047aec5 100644 --- a/src/ce_term.pas +++ b/src/ce_term.pas @@ -19,6 +19,7 @@ type fSelectedColor: TColor; fFollowEditors: boolean; fFollowProjects: boolean; + fScrollbackLines: longword; fFont: TFont; procedure setFont(value: TFont); public @@ -32,6 +33,7 @@ type property font: TFont read fFont write setFont; property followEditors: boolean read fFollowEditors write fFollowEditors; property followProjects: boolean read fFollowProjects write fFollowProjects; + property scrollbackLines: longword read fScrollbackLines write fScrollbackLines default 512; end; // Editable and reversible Terminal options @@ -92,6 +94,7 @@ begin fSelectedColor:= clBlack; fFont.Name:= 'Monospace'; fFont.Size:= 12; + fScrollbackLines:=512; end; destructor TCETerminalOptionsBase.destroy; @@ -121,6 +124,7 @@ begin fFont.Height:=fFont.Height-1; fFont.Assign(s.font); fFont.EndUpdate; + fScrollbackLines := s.fScrollbackLines; end else inherited; end; @@ -145,6 +149,7 @@ begin w.fTerm.Font.Size := w.fTerm.Font.Size +1; w.fTerm.Font.Size := w.fTerm.Font.Size -1; w.fTerm.Font.endUpdate; + w.fTerm.scrollbackLines:=fScrollbackLines; end; function TCETerminalOptions.optionedWantCategory(): string;