[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH] kedit: Syntax-Highlighting
* kedit: Eine elegante Lösung für das Herausfinden der Dateiendung gefunden
Signed-off-by: Alexander Hartmut Kluth <hartmut@xxxxxxxxxx>
---
src/modules/pas/kedit/kedit_main.pas | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/src/modules/pas/kedit/kedit_main.pas b/src/modules/pas/kedit/kedit_main.pas
index 18dbef7..91d39df 100644
--- a/src/modules/pas/kedit/kedit_main.pas
+++ b/src/modules/pas/kedit/kedit_main.pas
@@ -12,6 +12,7 @@ type
// Beschreibt einen offenen Puffer
kedit_state = record
filename: String;
+ extension: String;
cursX: longint;
cursY: longint;
@@ -141,6 +142,8 @@ var lfile: textfile;
i: integer;
attr: word;
s: String;
+ ext: String;
+ reversed: String;
begin
if loadname = '' then begin
Textbackground(1);
@@ -149,11 +152,13 @@ begin
Textbackground(0);
end;
+ Write(loadname);
+
if loadname = '' then begin
exit;
end;
- if not FileExists(loadname) then begin
+ if not FileExists(loadname) then begin
if create then begin
state^.filename := loadname;
exit;
@@ -167,6 +172,27 @@ begin
end;
with state^ do begin
+ loadname := Trim(loadname);
+
+ {
+ Dieses wundervolle Code-Konstrukt ist das Ergebnis
+ stundenlanger Codearbeit von Patrick Pokatilo a.k.a
+ the incredible SHyx0rmz und von Alexander H. Kluth a.k.a.
+ 'Pagefault-it!'-DerHartmut.
+ }
+ if CompareStr(RightStr(loadname, 4), '.pas') = 0 then begin
+ extension := 'pas';
+ end else if CompareStr(RightStr(loadname, 4), '.asm') = 0 then begin
+ extension := 'asm';
+ end else if CompareStr(RightStr(loadname, 2), '.c') = 0 then begin
+ extension := 'c';
+ end else if CompareStr(RightStr(loadname, 2), '.S') = 0 then begin
+ extension := 's';
+ end else begin
+ end;
+
+ SetSyntaxHighlighting(state);
+
Assign(lfile,loadname);
GetFAttr(lfile, attr);
if attr and dos.ReadOnly = dos.ReadOnly then readonly := true;
--
1.6.0.4