about summary refs log tree commit diff stats
path: root/src/kilo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kilo.c')
-rw-r--r--src/kilo.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/kilo.c b/src/kilo.c
index 5b6a9a7..5840dba 100644
--- a/src/kilo.c
+++ b/src/kilo.c
@@ -975,7 +975,7 @@ static void editorMoveCursor(int key) {
         }
         break;
     case KEY_DOWN:
-        if (filerow < E.numrows) {
+        if (filerow < E.numrows-1) {
             if (E.startrow + E.cy == E.endrow-1) {
                 E.rowoff++;
             } else {
@@ -1272,6 +1272,8 @@ void editNonCode(char* filename) {
     }
 }
 
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+
 void editNonCode2(char* filename) {
     Quit = 0;
     Back_to_big_picture = 0;
@@ -1287,7 +1289,7 @@ void editNonCode2(char* filename) {
         int y, x;
         getyx(stdscr, y, x);
         mvaddstr(0, 0, "function file_operation_permitted(filename, mode)");
-        mvaddstr(E.startrow + E.numrows - E.rowoff, 0, "end");
+        mvaddstr(MIN(E.startrow + E.numrows, E.endrow), 0, "end");
         mvaddstr(y, x, "");
         int c = getch();
         editorProcessKeypress2(c);
@@ -1359,7 +1361,7 @@ void resumeNonCodeEdit2() {
         int y, x;
         getyx(stdscr, y, x);
         mvaddstr(0, 0, "function file_operation_permitted(filename, mode)");
-        mvaddstr(E.startrow + E.numrows - E.rowoff, 0, "end");
+        mvaddstr(MIN(E.startrow + E.numrows, E.endrow), 0, "end");
         mvaddstr(y, x, "");
         int c = getch();
         editorProcessKeypress2(c);
lt;jubalh@iodoru.org> 2020-07-07 14:18:57 +0200 Apply coding style' href='/danisanti/profani-tty/commit/tests/unittests/test_plugins_disco.c?id=a2726b6a7d16f5f846a882fbbe9127e4604bb8bb'>a2726b6a ^
9945246a ^



a2726b6a ^
9945246a ^
a2726b6a ^
9945246a ^






a2726b6a ^
9945246a ^



a2726b6a ^
9945246a ^











a2726b6a ^
9945246a ^







a2726b6a ^
9945246a ^

e3f2ca7d ^




9945246a ^





a2726b6a ^
9945246a ^




a2726b6a ^
9945246a ^






a2726b6a ^
9945246a ^





a2726b6a ^
9945246a ^












a2726b6a ^
9945246a ^





a2726b6a ^
9945246a ^










1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131