File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Learn/Simple Libraries/TextDevices/libsimpletext Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 55 *
66 * Copyright (c) 2013, Parallax Inc.
77 * Written by Steve Denson
8+ *
9+ * Modified by Andy Lindsay to correct bug in terminal cursor control
10+ * with 2, 14, and 15.
811 */
12+
13+ /*
914#include "simpletext.h"
1015
1116void putChar(char c)
@@ -15,6 +20,33 @@ void putChar(char c)
1520 dport_ptr->txChar(dport_ptr, '\r');
1621 dport_ptr->txChar(dport_ptr, c);
1722}
23+ */
24+
25+ #include "simpletext.h"
26+
27+ volatile char st_cursorPosition = 0 ;
28+
29+ void putChar (char c )
30+ {
31+ extern text_t * dport_ptr ;
32+ if ((c == '\n' ) && (st_cursorPosition == 0 ))
33+ {
34+ dport_ptr -> txChar (dport_ptr , '\r' );
35+ }
36+ else
37+ {
38+ st_cursorPosition -- ;
39+ }
40+ dport_ptr -> txChar (dport_ptr , c );
41+
42+ if (c == 2 || c == 14 || c == 15 )
43+ {
44+ if (c > 2 )
45+ st_cursorPosition = 1 ;
46+ else
47+ st_cursorPosition = 2 ;
48+ }
49+ }
1850
1951/*
2052+--------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments