Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dejan/various fixes #7

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions linux.mak
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
8 changes: 2 additions & 6 deletions src/med/console.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -487,5 +484,4 @@ int help(bool f, int n)
return ed.FALSE;
}

}

} // Windows version
14 changes: 8 additions & 6 deletions src/med/display.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/***********************
Expand Down Expand Up @@ -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 */
{
Expand Down Expand Up @@ -591,12 +593,12 @@ Lout:
}
if (inmark == 2)
inmark = 0;
if (!nextLine)
break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? It's broken on Windows.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, I can't remember typing in that ... No idea how that sneaked in! :)

lp = lforw(lp);
}
vteeol(wp.w_startcol);
++i;
if (!nextLine)
break;
}
}
debug (WFDEBUG)
Expand Down
8 changes: 4 additions & 4 deletions src/med/line.d
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
1 change: 1 addition & 0 deletions src/med/url.d
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module url;

import core.stdc.stdio;
import core.stdc.ctype;
Expand Down
2 changes: 1 addition & 1 deletion src/med/utf.d
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

module utf;

/* This version of microEmacs is based on the public domain C
* version written by Dave G. Conroy.
Expand Down
10 changes: 10 additions & 0 deletions src/med/xterm.d
Original file line number Diff line number Diff line change
Expand Up @@ -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