more editor changes

This commit is contained in:
minjaesong
2021-10-05 10:52:48 +09:00
parent fa953a682b
commit 8d3dceb576
2 changed files with 29 additions and 54 deletions

View File

@@ -5,7 +5,7 @@ let logo = gzip.decomp(base64.atob("H4sICJoBTGECA3Rzdm1sb2dvLnJhdwDtneu2nCoQhPf7
// display logo in kickin' ass-style of panasonic
// hide entire framebuffer with black text to hide the slow image drawing
/*
con.color_pair(0,0);
for(let i=0;i<2560;i++)graphics.putSymbolAt(1+(i/80)|0,1+(i%80),239);
// draw logo
@@ -24,9 +24,10 @@ for(let y=0;y<164;y++){o[y]-=Math.sign(o[y]);graphics.setLineOffset(95+y,o[y]*m)
// wait for timer
tmr=sys.nanoTime();while(sys.nanoTime()-tmr<300000*m)Math.sqrt(tmr) // waste some cpu time
n-=m;}
*/
/*
// display logo in mundane, true-to-msx way
graphics.setFramebufferScroll(0,-164);
// hide entire framebuffer with black text to hide the slow image drawing
@@ -44,7 +45,7 @@ let tmr=sys.nanoTime();
let tlen=1073741824;
while(1){let tdiff=sys.nanoTime()-tmr;if(tdiff>=tlen)break;
graphics.setFramebufferScroll(0,-((1.0-tdiff/tlen)*164)|0);}
*/
// show how much ram is there
con.color_pair(239,4);

View File

@@ -84,9 +84,14 @@ function drawLineNumbers() {
function drawLnCol() {
con.curs_set(0);
con.color_pair(COL_BACK, COL_TEXT);
let lctxt = ` ${String.fromCharCode(25)}${cursorRow+1}:${cursorCol+1}`;
drawMenubarBase();
let lctxt = `${String.fromCharCode(25)}${cursorRow+1}:${cursorCol+1}`;
con.move(1, windowWidth - lctxt.length - 2); con.addch(222);
con.curs_right(); con.addch(221);
for (let i = 0; i < lctxt.length + (cursorCol < 9); i++) {
con.mvaddch(1, windowWidth - lctxt.length + (cursorCol >= 9) + i, lctxt.charCodeAt(i));
con.curs_right(); con.addch(lctxt.charCodeAt(i));
}
con.color_pair(COL_TEXT, COL_BACK);
}
@@ -96,7 +101,20 @@ function drawMain() {
drawInit();
con.clear();
// printMenubarBase();
// print line number
drawLineNumbers();
// print status line
drawLnCol();
con.move(PAINT_START_Y, PAINT_START_X); con.color_pair(COL_TEXT, COL_BACK);
}
function drawMenubarBase() {
// print menubar
con.move(1,1);
con.color_pair(COL_BACK, COL_TEXT);
menubarItems.forEach(v=>{
print(String.fromCharCode(222));
@@ -111,60 +129,16 @@ function drawMain() {
}
// print(" ");
});
// fill rest of the space on the line
// fill rest of the space on the line with filename
con.color_pair(COL_BACK, COL_TEXT);
con.addch(222);con.curs_right();
con.addch(221);con.curs_right();
let cursPos = con.getyx();
con.addch(179)
for (let i = cursPos[1]+1; i <= windowWidth; i++) {
con.mvaddch(1, i, filename.codePointAt(i-cursPos[1]-1));
for (let i = cursPos[1]; i < windowWidth; i++) {
con.mvaddch(1, i, filename.codePointAt(i-cursPos[1]));
}
// print line number
drawLineNumbers();
// print status line
drawLnCol();
con.move(PAINT_START_Y, PAINT_START_X); con.color_pair(COL_TEXT, COL_BACK);
}
/*function drawMenubarBase(index) {
con.curs_set(0);
drawInit();
con.clear();
// print menubar
con.color_pair(COL_BACK, COL_TEXT);
menubarItems.forEach((v,i)=>{
if (index == i) {
con.color_pair(COL_TEXT, COL_BACK);
print(String.fromCharCode(221));
print(v);
print(String.fromCharCode(222));
}
else {
con.color_pair(COL_BACK, COL_TEXT);
print(` ${v} `);
}
});
// fill rest of the space on the line
con.color_pair(COL_BACK, COL_TEXT);
let cursPos = con.getyx();
for (let i = cursPos[1]; i <= windowWidth; i++) {
con.mvaddch(1, i, 0);
}
// print menu items
let menuHeight = paintHeight - 1;
menubarContents[index].forEach((v,i) => {
con.color_pair(COL_TEXT, COL_BACK);
con.move(3 + (i % menuHeight), 2 + 12 * ((i / menuHeight)|0));
print(v);
});
}*/
function drawTextLineAbsolute(rowNumber, paintOffsetX) {
let paintRow = rowNumber - scroll;