fixing newline char in gtk memo from Andrew Haines

git-svn-id: trunk@7658 -
This commit is contained in:
mattias 2005-09-10 01:39:09 +00:00
parent 28b576b12b
commit 222325455c
3 changed files with 30 additions and 8 deletions

View File

@ -21,6 +21,10 @@ Abstract:
The following steps don't need the root user. They can be done as normal user.
There is a script in tools/install/cross_unix/update_cross_fpc.sh, that will
do the below steps. It downloads bintuils, fpc and builds the cross targets.
1. Download the fpc sources
IMPORTANT: Your current FPC must be the same version/date as the fpc sources.
@ -33,12 +37,21 @@ The following steps don't need the root user. They can be done as normal user.
For example:
[]$ mkdir freepascal
[]$ cd freepascal
[]$ mkdir ~/freepascal/
[]$ cd ~/freepascal/
[]$ svn co http://svn.freepascal.org/svn/fpc/branches/fixes_2_0 fpc
[]$ svn co http://svn.freepascal.org/svn/fpcbuild/branches/fixes_2_0/install install
If you want the unstable development version use:
[]$ svn co http://svn.freepascal.org/svn/fpc/trunk fpc
[]$ svn co http://svn.freepascal.org/svn/fpcbuild/trunk/install install
For the following examples the fpc sources were downloaded to ~/sources/fpc.
Keep in mind that the development version has a lot more features, but often
some serious bugs.
For the following examples the fpc sources were downloaded
to ~/freepascal/fpc.
2. Download the binutils.
@ -53,7 +66,7 @@ The following steps don't need the root user. They can be done as normal user.
For example:
[]$ cd download
[]$ cd ~/download
[]$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.16.tar.gz

View File

@ -2143,7 +2143,8 @@ begin
DeliverMessage(Data, Mess);
end;
function gtkInsertText( widget: PGtkWidget; char : pChar; NewTextLength : Integer; Position : pgint; data: gPointer) : GBoolean; cdecl;
function gtkInsertText(widget: PGtkWidget; char : pChar;
NewTextLength : Integer; Position : pgint; data: gPointer) : GBoolean; cdecl;
var
Memo: TCustomMemo;
CurrLength, CutLength: integer;
@ -2153,7 +2154,9 @@ begin
{ GTK does not provide its own max. length for memos
we have to do our own. }
if TControl(Data) is TCustomMemo then begin
if TObject(Data) is TCustomMemo then begin
if (NewTextLength = 1) and (char^ = #13) and (LineEnding = #10) then
char^ := #10;
Memo:= TCustomMemo(Data);
if Memo.MaxLength < 0 then Exit;
@ -2163,14 +2166,19 @@ begin
CutLength:= CurrLength + NewTextLength - Memo.MaxLength;
if NewTextLength - CutLength > 0 then begin
gtk_editable_insert_text(PGtkEditable(widget), char, NewTextLength - CutLength, Position);
gtk_editable_insert_text(PGtkEditable(widget), char,
NewTextLength - CutLength, Position);
end;
g_signal_stop_emission_by_name(PGtkObject(widget), 'insert_text');
end;
if TObject(Data) is TCustomEdit then
if (NewTextLength = 1) and (char^ = #13) then
g_signal_stop_emission_by_name(PGtkObject(widget), 'insert_text');
end;
function gtkDeleteText( widget: PGtkWidget; Startpos, EndPos : Integer; data: gPointer) : GBoolean; cdecl;
function gtkDeleteText( widget: PGtkWidget; Startpos, EndPos : Integer;
data: gPointer) : GBoolean; cdecl;
var
Mess : TLMessage;
begin

View File

@ -3948,6 +3948,7 @@ begin
SetCallback(LM_CUTTOCLIP, AGTKObject, ALCLObject);
SetCallback(LM_COPYTOCLIP, AGTKObject, ALCLObject);
SetCallback(LM_PASTEFROMCLIP, AGTKObject, ALCLObject);
SetCallback(LM_INSERTTEXT, AGTKObject, ALCLObject);
end;
csMemo: