Enlightenment CVS committal
Author : codewarrior
Project : e17
Module : libs/esmart
Dir : e17/libs/esmart/src/lib/esmart_textarea
Modified Files:
esmart_textarea_cursor.c
Log Message:
fixes to up/down arrow movement when we have spaces on the destination positions
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/esmart/src/lib/esmart_textarea/esmart_textarea_cursor.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- esmart_textarea_cursor.c 31 Mar 2005 09:23:21 -0000 1.2
+++ esmart_textarea_cursor.c 2 Apr 2005 12:58:13 -0000 1.3
@@ -53,62 +53,68 @@
}
/* move cursor one position down: go one line down, reach current x coord */
-void _esmart_textarea_cursor_move_down(Esmart_Text_Area *ta) {
+void _esmart_textarea_cursor_move_down(Esmart_Text_Area *t) {
int cur_line, line, pos, len;
Evas_Coord cx,cy,cw,ch,i;
i = 0;
- pos = evas_object_textblock_cursor_pos_get(ta->text);
+ pos = evas_object_textblock_cursor_pos_get(t->text);
- len = evas_object_textblock_length_get(ta->text);
+ len = evas_object_textblock_length_get(t->text);
/* get coords of current cursor position */
- evas_object_textblock_char_pos_get(ta->text,pos,&cx,&cy,&cw,&ch);
+ evas_object_textblock_char_pos_get(t->text,pos,&cx,&cy,&cw,&ch);
+
+ /* if we're on the bottom line, dont do anything */
+ line = cur_line = evas_object_textblock_cursor_line_get(t->text);
+ if(evas_object_textblock_lines_get(t->text) - 1 == line) return;
/* go down one line */
- line = cur_line = evas_object_textblock_cursor_line_get(ta->text);
while(line == cur_line && pos <= len ) {
pos++;
- evas_object_textblock_cursor_pos_set(ta->text, pos);
- cur_line = evas_object_textblock_cursor_line_get(ta->text);
+ evas_object_textblock_cursor_pos_set(t->text, pos);
+ cur_line = evas_object_textblock_cursor_line_get(t->text);
}
/* keep moving until we hit the required x coord */
- evas_object_textblock_char_pos_get(ta->text,pos,&i,&cy,&cw,&ch);
- while(cx != i && pos <= len) {
+ evas_object_textblock_char_pos_get(t->text,pos,&i,&cy,&cw,&ch);
+ while(cx > i && pos <= len) {
pos++;
- evas_object_textblock_cursor_pos_set(ta->text, pos);
- evas_object_textblock_char_pos_get(ta->text,pos,&i,&cy,&cw,&ch);
+ evas_object_textblock_cursor_pos_set(t->text, pos);
+ evas_object_textblock_char_pos_get(t->text,pos,&i,&cy,&cw,&ch);
}
}
/* move cursor one position up: go one line up, reach current x coord */
-void _esmart_textarea_cursor_move_up(Esmart_Text_Area *ta) {
+void _esmart_textarea_cursor_move_up(Esmart_Text_Area *t) {
int cur_line, line, pos;
Evas_Coord cx,cy,cw,ch,i;
-
+
i = 0;
- pos = evas_object_textblock_cursor_pos_get(ta->text);
+ pos = evas_object_textblock_cursor_pos_get(t->text);
/* get coords of current cursor position */
- evas_object_textblock_char_pos_get(ta->text,pos,&cx,&cy,&cw,&ch);
+ evas_object_textblock_char_pos_get(t->text,pos,&cx,&cy,&cw,&ch);
- /* go up one line */
- line = cur_line = evas_object_textblock_cursor_line_get(ta->text);
+ /* if we're on the top line, dont do anything */
+ line = cur_line = evas_object_textblock_cursor_line_get(t->text);
+ if(line == 0) return;
+
+ /* go up one line */
while(line == cur_line && pos >= 0) {
pos--;
- evas_object_textblock_cursor_pos_set(ta->text, pos);
- cur_line = evas_object_textblock_cursor_line_get(ta->text);
+ evas_object_textblock_cursor_pos_set(t->text, pos);
+ cur_line = evas_object_textblock_cursor_line_get(t->text);
}
/* keep moving until we hit the required x coord */
- evas_object_textblock_char_pos_get(ta->text,pos,&i,&cy,&cw,&ch);
- while(cx != i && pos >= 0) {
+ evas_object_textblock_char_pos_get(t->text,pos,&i,&cy,&cw,&ch);
+ while(cx < i && pos >= 0) {
pos--;
- evas_object_textblock_cursor_pos_set(ta->text, pos);
- evas_object_textblock_char_pos_get(ta->text,pos,&i,&cy,&cw,&ch);
+ evas_object_textblock_cursor_pos_set(t->text, pos);
+ evas_object_textblock_char_pos_get(t->text,pos,&i,&cy,&cw,&ch);
}
}
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs