Skip to content

Commit

Permalink
ted: Only redraw the screen when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ry755 committed May 26, 2024
1 parent cac6d58 commit 155bf3d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions applications/ted/TEd.okm
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ MODULE TEd;
OpenFile(arg0Ptr);
END;

RefreshScreen();
WHILE running DO
RefreshScreen();
read(1, terminalStreamPtr, PTROF(charBuffer));
IF (insertMode) & (charBuffer # 0) THEN
IF charBuffer = 27 THEN
Expand All @@ -70,6 +70,7 @@ MODULE TEd;
ELSE
InsertCharacter(charBuffer);
END;
RefreshScreen();
ELSE
IF charBuffer = 113 THEN
(* 'q' pressed, exit *)
Expand All @@ -79,13 +80,16 @@ MODULE TEd;
(charBuffer = 97) OR
(charBuffer = 100) THEN
MoveCursor(charBuffer);
RefreshScreen();
ELSIF charBuffer = 105 THEN
(* 'i' pressed,. enter insert mode *)
(* 'i' pressed, enter insert mode *)
insertMode := 1;
DrawStatusBar();
RefreshScreen();
ELSIF charBuffer = 111 THEN
(* 'o' pressed,. save the file *)
(* 'o' pressed, save the file *)
SaveFile(arg0Ptr);
RefreshScreen();
END;
END;
END;
Expand Down

0 comments on commit 155bf3d

Please sign in to comment.