Skip to content

Commit

Permalink
write last line from file
Browse files Browse the repository at this point in the history
  • Loading branch information
kjloveless committed Nov 12, 2024
1 parent 3cdf2e8 commit 4dad0a0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,8 @@ function getWindowSize() {

function editorOpen(filename: string) {
const data = Deno.readFileSync(filename);
const contents = decoder.decode(data);
const contents = decoder.decode(data).trimEnd();

console.log(contents);
Deno.exit();
e.row = contents;
e.numRows++;
}
Expand All @@ -189,7 +187,7 @@ function editorDrawRows() {
let y = 0;
while (y < e.screenRows) {
if (y >= e.numRows) {
if (y == Math.floor(e.screenRows / 3)) {
if (e.numRows == 0 && y == Math.floor(e.screenRows / 3)) {
const welcome = `editor -- version ${VERSION}`;
let padding = Math.floor((e.screenCols - welcome.length) / 2);
if (padding > 0 ) {
Expand Down

0 comments on commit 4dad0a0

Please sign in to comment.