Changeset a0fbdee
- Timestamp:
- Jul 11, 2009, 1:14:33 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- cedc95c
- Parents:
- d7043b4
- git-author:
- Karl Ramm <kcr@1ts.org> (06/08/09 18:58:00)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (07/11/09 13:14:33)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
editwin.c
rd7043b4 ra0fbdee 30 30 int index; 31 31 int goal_column; 32 } _owl_editwin_excursion; 32 int lock; 33 } oe_excursion; 33 34 34 35 static int owl_editwin_is_char_in(owl_editwin *e, char *set); … … 266 267 } 267 268 269 static void oe_save_excursion(owl_editwin *e, oe_excursion *x) 270 { 271 x->index = e->index; 272 x->goal_column = e->goal_column; 273 x->lock = e->lock; 274 } 275 276 static void oe_restore_excursion(owl_editwin *e, oe_excursion *x) 277 { 278 e->index = x->index; 279 e->goal_column = x->goal_column; 280 e->lock = x->lock; 281 } 282 268 283 static inline char *oe_next_point(owl_editwin *e, char *p) 269 284 { … … 297 312 char *p; 298 313 299 while(1) { 300 /* are we at the point? */ 314 /* are we at the point already? */ 301 315 if (x != NULL && index == e->index) 302 316 *x = width; 303 317 while(1) { 304 318 /* get the current character */ 305 319 c = g_utf8_get_char(e->buff + index); … … 659 673 } 660 674 661 void owl_editwin_save_excursion(owl_editwin *e, _owl_editwin_excursion *x) /*noproto*/662 {663 x->index = e->index;664 x->goal_column = e->goal_column;665 }666 667 void owl_editwin_restore_excursion(owl_editwin *e, _owl_editwin_excursion *x) /*noproto*/668 {669 e->index = x->index;670 e->goal_column = x->goal_column;671 }672 673 675 void owl_editwin_adjust_for_locktext(owl_editwin *e) 674 676 { … … 721 723 int owl_editwin_at_beginning_of_line(owl_editwin *e) /*noproto*/ 722 724 { 723 _owl_editwin_excursion x;725 oe_excursion x; 724 726 int ret; 725 727 … … 727 729 return 1; 728 730 729 o wl_editwin_save_excursion(e, &x);731 oe_save_excursion(e, &x); 730 732 owl_editwin_point_move(e, -1); 731 733 ret = (_owl_editwin_get_char_at_point(e) == '\n'); 732 o wl_editwin_restore_excursion(e, &x);734 oe_restore_excursion(e, &x); 733 735 734 736 return ret; … … 864 866 void owl_editwin_move_to_previousword(owl_editwin *e) 865 867 { 866 _owl_editwin_excursion x;868 oe_excursion x; 867 869 int beginning; 868 870 /* if in middle of word, beginning of word */ … … 874 876 owl_editwin_move_if_in(e, -1, WHITESPACE); /* leaves us on the last 875 877 character of the word */ 876 o wl_editwin_save_excursion(e, &x);878 oe_save_excursion(e, &x); 877 879 /* are we at the beginning of a word? */ 878 880 owl_editwin_point_move(e, -1); 879 881 beginning = owl_editwin_is_char_in(e, WHITESPACE); 880 o wl_editwin_restore_excursion(e, &x);882 oe_restore_excursion(e, &x); 881 883 if (beginning) 882 884 return; 883 885 } else { 884 886 /* in the middle of the word; */ 885 o wl_editwin_save_excursion(e, &x);887 oe_save_excursion(e, &x); 886 888 owl_editwin_point_move(e, -1); 887 889 if (owl_editwin_is_char_in(e, WHITESPACE)) { /* we were at the beginning */ … … 889 891 return; 890 892 } else { 891 o wl_editwin_restore_excursion(e, &x);893 oe_restore_excursion(e, &x); 892 894 } 893 895 } … … 900 902 void owl_editwin_delete_nextword(owl_editwin *e) 901 903 { 902 _owl_editwin_excursion x;904 oe_excursion x; 903 905 int end; 904 906 905 o wl_editwin_save_excursion(e, &x);907 oe_save_excursion(e, &x); 906 908 owl_editwin_move_to_nextword(e); 907 909 end = e->index; 908 o wl_editwin_restore_excursion(e, &x);910 oe_restore_excursion(e, &x); 909 911 _owl_editwin_remove_bytes(e, end - e->index); 910 912 } … … 928 930 void owl_editwin_delete_to_endofline(owl_editwin *e) 929 931 { 930 _owl_editwin_excursion x;932 oe_excursion x; 931 933 int end; 932 934 933 o wl_editwin_save_excursion(e, &x);935 oe_save_excursion(e, &x); 934 936 owl_editwin_move_to_line_end(e); 935 937 end = e->index; 936 o wl_editwin_restore_excursion(e, &x);938 oe_restore_excursion(e, &x); 937 939 _owl_editwin_remove_bytes(e, end - e->index); 938 940 } … … 956 958 { 957 959 #if 0 /* XXX */ 958 _owl_editwin_excursion x;960 oe_excursion x; 959 961 int i, save; 960 962 961 963 /* save our starting point */ 962 o wl_editwin_save_excursion(e, &x);964 oe_save_excursion(e, &x); 963 965 964 966 save = e->index; … … 1025 1027 1026 1028 /* put cursor back at starting point */ 1027 o wl_editwin_restore_excursion(e, &x);1029 oe_restore_excursion(e, &x); 1028 1030 #endif 1029 1031 }
Note: See TracChangeset
for help on using the changeset viewer.