diff --git a/linux.mak b/linux.mak index 7698391..127865d 100644 --- a/linux.mak +++ b/linux.mak @@ -18,17 +18,17 @@ LDFLG=-g \ all: $B/med SRC= $S/ed.d $S/basic.d $S/buffer.d $S/display.d $S/file.d $S/fileio.d $S/line.d \ - $S/random.d $S/region.d $S/search.d $S/spawn.d $S/terminal.d \ + $S/random.d $S/region.d $S/search.d $S/spawn.d $S/syntaxd.d $S/terminal.d \ $S/window.d $S/word.d $S/main.d $S/more.d $S/disprev.d \ $S/termio.d $S/xterm.d \ $S/tcap.d $S/console.d $S/mouse.d $S/disp.d $S/url.d $S/utf.d OBJ= $O/ed.o $O/basic.o $O/buffer.o $O/display.o $O/file.o $O/fileio.o $O/line.o \ - $O/random.o $O/region.o $O/search.o $O/spawn.o $O/terminal.o \ + $O/random.o $O/region.o $O/search.o $O/spawn.o $O/syntaxd.o $O/terminal.o \ $O/window.o $O/word.o $O/main.o $O/more.o $O/disprev.o \ $O/termio.o $O/xterm.o \ - $O/tcap.o $O/console.o $O/mouse.o $O/disp.o $O/url.o $O/utf.d + $O/tcap.o $O/console.o $O/mouse.o $O/disp.o $O/url.o $O/utf.o SOURCE= $(SRC) win32.mak linux.mak me.html @@ -77,6 +77,9 @@ $O/search.o: $S/search.d $O/spawn.o: $S/spawn.d $(DMD) -c $(DFLAGS) $S/spawn.d +$O/syntaxd.o: $S/syntaxd.d + $(DMD) -c $(DFLAGS) $S/syntaxd.d + $O/terminal.o: $S/terminal.d $(DMD) -c $(DFLAGS) $S/terminal.d @@ -86,6 +89,9 @@ $O/termio.o: $S/termio.d $O/url.o: $S/url.d $(DMD) -c $(DFLAGS) $S/url.d +$O/utf.o: $S/utf.d + $(DMD) -c $(DFLAGS) $S/utf.d + $O/window.o: $S/window.d $(DMD) -c $(DFLAGS) $S/window.d diff --git a/src/med/console.d b/src/med/console.d index 7f67b4a..246a069 100644 --- a/src/med/console.d +++ b/src/med/console.d @@ -14,23 +14,20 @@ module console; + version (Windows) { - import std.stdio; import core.stdc.stdlib; import core.stdc.string; import core.sys.windows.windows; import core.sys.windows.winuser; - import ed; import disp; - enum BEL = 0x07; /* BEL character. */ enum ESC = 0x1B; /* ESC character. */ - static HANDLE hStdin; // console input handle static DWORD fdwSaveOldMode; @@ -487,5 +484,4 @@ int help(bool f, int n) return ed.FALSE; } -} - +} // Windows version diff --git a/src/med/display.d b/src/med/display.d index a930e09..0f1a008 100644 --- a/src/med/display.d +++ b/src/med/display.d @@ -318,13 +318,15 @@ int coltodoto(LINE* lp, int col) { size_t len = llength(lp); size_t i = 0; + int ii = 0; while (i < len) { - if (getcol(lp,i) >= col) - return i; + ii = cast(int) i; + if (getcol(lp, ii) >= col) + return ii; decodeUTF8(lp.l_text, i); } - return i; + return ii; } /*********************** @@ -542,7 +544,7 @@ Lout: assert(p); lineAttr = p[0 .. newlen]; } - const nextState = syntaxHighlightD(lp.syntaxState, lp.l_text, lineAttr); + const nextState = syntaxHighlightD(lp.syntaxState, lp.l_text, lineAttr); auto lpn = lforw(lp); if (lpn != wp.w_bufp.b_linep) /* if not end of buffer */ { @@ -591,12 +593,12 @@ Lout: } if (inmark == 2) inmark = 0; + if (!nextLine) + break; lp = lforw(lp); } vteeol(wp.w_startcol); ++i; - if (!nextLine) - break; } } debug (WFDEBUG) diff --git a/src/med/line.d b/src/med/line.d index 9e5a614..39c5489 100644 --- a/src/med/line.d +++ b/src/med/line.d @@ -42,10 +42,10 @@ import random; * additions will include update hints, and a list of marks into the line. */ struct LINE { - LINE *l_fp; /* Link to the next line */ - LINE *l_bp; /* Link to the previous line */ - SyntaxState syntaxState; // state at the beginning of the line - char[] l_text; /* A bunch of characters. */ + LINE *l_fp; /* Link to the next line */ + LINE *l_bp; /* Link to the previous line */ + SyntaxState syntaxState; /* state at the beginning of the line */ + char[] l_text; /* A bunch of characters. */ } LINE* lforw(LINE* lp) { return lp.l_fp; } diff --git a/src/med/url.d b/src/med/url.d index 5c02c0b..7aaf951 100644 --- a/src/med/url.d +++ b/src/med/url.d @@ -1,3 +1,4 @@ +module url; import core.stdc.stdio; import core.stdc.ctype; diff --git a/src/med/utf.d b/src/med/utf.d index 3c30f5d..aaeb115 100644 --- a/src/med/utf.d +++ b/src/med/utf.d @@ -1,4 +1,4 @@ - +module utf; /* This version of microEmacs is based on the public domain C * version written by Dave G. Conroy. diff --git a/src/med/xterm.d b/src/med/xterm.d index 86b739d..9c9704f 100644 --- a/src/med/xterm.d +++ b/src/med/xterm.d @@ -596,4 +596,14 @@ debug } } +import std.process: spawnProcess; + +int help(bool f, int n) +{ + printf("\nhelp \n"); + auto dmdPid = spawnProcess(["xdg-open", "me.html"]); + + return ed.FALSE; } + +} // Posix version