2525void repos_x (struct Window * w , struct Cursor * c )
2626/*When the cursor's x-position is greater than the
2727 *length of the given line, move the cursor back
28- *to the end of the given line*/
28+ *to the end of the given line
29+ */
2930{
3031 int max , pos = get_line_number_pos (c -> y , w -> contents );
3132 max = get_end_of_line (pos , w -> contents );
@@ -40,7 +41,8 @@ void repos_x(struct Window *w, struct Cursor *c)
4041
4142void key_up (struct Window * w , struct Cursor * c )
4243/*When in edit-mode and the up arrow key is pressed,
43- *do this*/
44+ *do this
45+ */
4446{
4547 if (c -> y > 0 )
4648 {
@@ -55,7 +57,8 @@ void key_up(struct Window *w, struct Cursor *c)
5557
5658void key_down (struct Window * w , struct Cursor * c )
5759/*When in edit-mode and the down arrow key is pressed,
58- *do this*/
60+ *do this
61+ */
5962{
6063 if (get_line_number_pos (c -> y + 1 , w -> contents )!= EOF )
6164 {
@@ -70,7 +73,8 @@ void key_down(struct Window *w, struct Cursor *c)
7073
7174void key_right (struct Window * w , struct Cursor * c )
7275/*When in edit-mode and the right arrow key is pressed,
73- *do this*/
76+ *do this
77+ */
7478{
7579 if (w -> contents [c -> abs ]!= '\n' && w -> contents [c -> abs ]!= '\0' )
7680 {
@@ -86,7 +90,8 @@ void key_right(struct Window *w, struct Cursor *c)
8690
8791void key_left (struct Window * w , struct Cursor * c )
8892/*When in edit-mode and the left arrow key is pressed,
89- *do this*/
93+ *do this
94+ */
9095{
9196 int i = get_line_number_pos (c -> y , w -> contents );
9297 i += c -> x ;
@@ -108,7 +113,8 @@ void key_left(struct Window *w, struct Cursor *c)
108113
109114void get_input (struct Window * w , struct Cursor * c , struct File * f )
110115/*When in edit-mode and getting user input,
111- *do this*/
116+ *do this
117+ */
112118{
113119 int k ;
114120 switch (k = getch ())
@@ -183,7 +189,7 @@ int dialog_input(struct Window *w, char *str)
183189 printw (str );
184190 switch (k = getch ())
185191 {
186- case 10 :
192+ case '\n' :
187193 str [i ]= '\0' ;
188194 return 0 ;
189195 break ;
0 commit comments