mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-10-26 16:22:04 +01:00 
			
		
		
		
	fixed encoding
git-svn-id: trunk@15771 -
This commit is contained in:
		
							parent
							
								
									5bd40abaab
								
							
						
					
					
						commit
						ebd4d40039
					
				| @ -42,7 +42,7 @@ unit SynEditTypes; | |||||||
| interface | interface | ||||||
| 
 | 
 | ||||||
| const | const | ||||||
|   TSynSpecialChars = ['À'..'Ö', 'Ø'..'ö', 'ø'..'ÿ']; |   TSynSpecialChars = ['À'..'Ö', 'Ø'..'ö', 'ø'..'ÿ']; | ||||||
|   TSynValidStringChars = ['_', '0'..'9', 'A'..'Z', 'a'..'z'] + TSynSpecialChars; |   TSynValidStringChars = ['_', '0'..'9', 'A'..'Z', 'a'..'z'] + TSynSpecialChars; | ||||||
|   TSynWhiteChars = [' ', #9]; |   TSynWhiteChars = [' ', #9]; | ||||||
|   TSynWordBreakChars = ['.', ',', ';', ':', '"', '''', '!', '?', '[', ']', '(', |   TSynWordBreakChars = ['.', ',', ';', ':', '"', '''', '!', '?', '[', ']', '(', | ||||||
|  | |||||||
| @ -411,8 +411,8 @@ type | |||||||
|     property ModifierR : boolean index 2 read GetModifier write SetModifier; |     property ModifierR : boolean index 2 read GetModifier write SetModifier; | ||||||
|     // Modifier /r - use r.e.syntax extended for russian, |     // Modifier /r - use r.e.syntax extended for russian, | ||||||
|     // (was property ExtSyntaxEnabled in previous versions) |     // (was property ExtSyntaxEnabled in previous versions) | ||||||
|     // If true, then à-ÿ  additional include russian letter '¸', |     // If true, then а-я  additional include russian letter 'ё', | ||||||
|     // À-ß  additional include '¨', and à-ß include all russian symbols. |     // А-Я  additional include 'Ё', and а-Я include all russian symbols. | ||||||
|     // You have to turn it off if it may interfere with you national alphabet. |     // You have to turn it off if it may interfere with you national alphabet. | ||||||
|     // , initialized from RegExprModifierR |     // , initialized from RegExprModifierR | ||||||
| 
 | 
 | ||||||
| @ -1480,7 +1480,7 @@ procedure TRegExpr.Tail (p : PRegExprChar; val : PRegExprChar); | |||||||
|    // shr after subtraction to calculate widechar distance %-( ) |    // shr after subtraction to calculate widechar distance %-( ) | ||||||
|    // so, if difference is negative we have .. the "feature" :( |    // so, if difference is negative we have .. the "feature" :( | ||||||
|    // I could wrap it in $IFDEF UniCode, but I didn't because |    // I could wrap it in $IFDEF UniCode, but I didn't because | ||||||
|    // "P – Q computes the difference between the address given |    // "P – Q computes the difference between the address given | ||||||
|    // by P (the higher address) and the address given by Q (the |    // by P (the higher address) and the address given by Q (the | ||||||
|    // lower address)" - Delphi help quotation. |    // lower address)" - Delphi help quotation. | ||||||
|    else PRENextOff (scan + REOpSz)^ := val - scan; //###0.933 |    else PRENextOff (scan + REOpSz)^ := val - scan; //###0.933 | ||||||
| @ -1591,17 +1591,17 @@ const | |||||||
|    #$418,#$419,#$41A,#$41B,#$41C,#$41D,#$41E,#$41F, |    #$418,#$419,#$41A,#$41B,#$41C,#$41D,#$41E,#$41F, | ||||||
|    #$420,#$421,#$422,#$423,#$424,#$425,#$426,#$427, |    #$420,#$421,#$422,#$423,#$424,#$425,#$426,#$427, | ||||||
|    #$428,#$429,#$42A,#$42B,#$42C,#$42D,#$42E,#$42F,#0); |    #$428,#$429,#$42A,#$42B,#$42C,#$42D,#$42E,#$42F,#0); | ||||||
|  RusRangeLoLow = #$430{'à'}; |  RusRangeLoLow = #$430{'а'}; | ||||||
|  RusRangeLoHigh = #$44F{'ÿ'}; |  RusRangeLoHigh = #$44F{'я'}; | ||||||
|  RusRangeHiLow = #$410{'À'}; |  RusRangeHiLow = #$410{'А'}; | ||||||
|  RusRangeHiHigh = #$42F{'ß'}; |  RusRangeHiHigh = #$42F{'Я'}; | ||||||
| {$ELSE} | {$ELSE} | ||||||
|  RusRangeLo = 'àáâãä叿çèéêëìíîïðñòóôõö÷øùúûüýþÿ'; |  RusRangeLo = 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя'; | ||||||
|  RusRangeHi = 'ÀÁÂÃÄŨÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß'; |  RusRangeHi = 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ'; | ||||||
|  RusRangeLoLow = 'à'; |  RusRangeLoLow = 'а'; | ||||||
|  RusRangeLoHigh = 'ÿ'; |  RusRangeLoHigh = 'я'; | ||||||
|  RusRangeHiLow = 'À'; |  RusRangeHiLow = 'А'; | ||||||
|  RusRangeHiHigh = 'ß'; |  RusRangeHiHigh = 'Я'; | ||||||
| {$ENDIF} | {$ENDIF} | ||||||
| 
 | 
 | ||||||
| function TRegExpr.CompileRegExpr (exp : PRegExprChar) : boolean; | function TRegExpr.CompileRegExpr (exp : PRegExprChar) : boolean; | ||||||
| @ -3621,7 +3621,7 @@ procedure TRegExpr.SetInputString (const AInputString : RegExprString); | |||||||
|   fInputStart := PChar (fInputString); |   fInputStart := PChar (fInputString); | ||||||
|   Len := length (fInputString); |   Len := length (fInputString); | ||||||
|   fInputEnd := PRegExprChar (integer (fInputStart) + Len); ?? |   fInputEnd := PRegExprChar (integer (fInputStart) + Len); ?? | ||||||
|   !! startp/endp âñå ðàâíî áóäåò îïàñíî èñïîëüçîâàòü ? |   !! startp/endp все равно будет опасно использовать ? | ||||||
|   } |   } | ||||||
|  end; { of procedure TRegExpr.SetInputString |  end; { of procedure TRegExpr.SetInputString | ||||||
| --------------------------------------------------------------} | --------------------------------------------------------------} | ||||||
|  | |||||||
| @ -4422,11 +4422,6 @@ begin | |||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| function GuessEncoding(const s: string): string; | function GuessEncoding(const s: string): string; | ||||||
| var |  | ||||||
|   l: Integer; |  | ||||||
|   p: Integer; |  | ||||||
|   EndPos: LongInt; |  | ||||||
|   i: LongInt; |  | ||||||
| 
 | 
 | ||||||
|   function CompareI(p1, p2: PChar; Count: integer): boolean; |   function CompareI(p1, p2: PChar; Count: integer): boolean; | ||||||
|   var |   var | ||||||
| @ -4450,6 +4445,37 @@ var | |||||||
|     Result:=true; |     Result:=true; | ||||||
|   end; |   end; | ||||||
|    |    | ||||||
|  |   {$IFDEF VerboseIDEEncoding} | ||||||
|  |   function PosToStr(p: integer): string; | ||||||
|  |   var | ||||||
|  |     y: Integer; | ||||||
|  |     x: Integer; | ||||||
|  |     i: Integer; | ||||||
|  |   begin | ||||||
|  |     y:=1; | ||||||
|  |     x:=1; | ||||||
|  |     i:=1; | ||||||
|  |     while (i<=length(s)) and (i<p) do begin | ||||||
|  |       if s[i] in [#10,#13] then begin | ||||||
|  |         inc(i); | ||||||
|  |         x:=1; | ||||||
|  |         inc(y); | ||||||
|  |         if (i<=length(s)) and (s[i] in [#10,#13]) and (s[i]<>s[i-1]) then | ||||||
|  |           inc(i); | ||||||
|  |       end else begin | ||||||
|  |         inc(i); | ||||||
|  |         inc(x); | ||||||
|  |       end; | ||||||
|  |     end; | ||||||
|  |     Result:='x='+IntToStr(x)+',y='+IntToStr(y); | ||||||
|  |   end; | ||||||
|  |   {$ENDIF} | ||||||
|  | 
 | ||||||
|  | var | ||||||
|  |   l: Integer; | ||||||
|  |   p: Integer; | ||||||
|  |   EndPos: LongInt; | ||||||
|  |   i: LongInt; | ||||||
| begin | begin | ||||||
|   l:=length(s); |   l:=length(s); | ||||||
|   if l=0 then begin |   if l=0 then begin | ||||||
| @ -4484,7 +4510,7 @@ begin | |||||||
|       //DebugLn(['GuessEncoding ',i,' ',DbgStr(s[p])]); |       //DebugLn(['GuessEncoding ',i,' ',DbgStr(s[p])]); | ||||||
|       if i=0 then begin |       if i=0 then begin | ||||||
|         {$IFDEF VerboseIDEEncoding} |         {$IFDEF VerboseIDEEncoding} | ||||||
|         DebugLn(['GuessEncoding non UTF-8 found at ',p,' ',dbgstr(copy(s,p-10,20))]); |         DebugLn(['GuessEncoding non UTF-8 found at ',PosToStr(p),' ',dbgstr(copy(s,p-10,20))]); | ||||||
|         {$ENDIF} |         {$ENDIF} | ||||||
|         break; |         break; | ||||||
|       end; |       end; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 mattias
						mattias