- Timestamp:
- Mar 23, 2010, 5:23:43 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 0d17295
- Parents:
- 8dfb59c
- git-author:
- Nelson Elhage <nelhage@mit.edu> (03/13/10 23:54:51)
- git-committer:
- Nelson Elhage <nelhage@ksplice.com> (03/23/10 17:23:43)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
editwin.c
r8dfb59c r38cc669 64 64 #define WHITESPACE " \n\t" 65 65 66 owl_editwin *owl_editwin_allocate(void)66 static owl_editwin *owl_editwin_allocate(void) 67 67 { 68 68 owl_editwin *e; … … 80 80 oe_release_excursion(e, e->excursions); 81 81 } 82 oe_destroy_cbdata(e); 82 83 83 84 owl_free(e); … … 116 117 } 117 118 118 /* initialize the editwin e. 119 * 'win' is an already initialzed curses window that will be used by editwin 120 */ 121 void owl_editwin_init(owl_editwin *e, WINDOW *win, int winlines, int wincols, int style, owl_history *hist) 119 static void _owl_editwin_init(owl_editwin *e, 120 WINDOW *win, 121 int winlines, 122 int wincols, 123 int style, 124 owl_history *hist) 122 125 { 123 126 e->buff=owl_malloc(INCR); … … 148 151 } 149 152 153 owl_editwin *owl_editwin_new(WINDOW *win, int winlines, int wincols, int style, owl_history *hist) 154 { 155 owl_editwin *e = owl_editwin_allocate(); 156 157 _owl_editwin_init(e, win, winlines, wincols, style, hist); 158 return e; 159 } 160 150 161 void owl_editwin_set_curswin(owl_editwin *e, WINDOW *w, int winlines, int wincols) 151 162 { … … 249 260 } 250 261 251 void owl_editwin_new_style(owl_editwin *e, int newstyle, owl_history *h)252 {253 e->hist = h;254 255 if (e->style==newstyle) return;256 257 if (newstyle==OWL_EDITWIN_STYLE_MULTILINE) {258 e->style=newstyle;259 } else if (newstyle==OWL_EDITWIN_STYLE_ONELINE) {260 e->style=newstyle;261 262 /* nuke everything after the first line */263 owl_editwin_move_to_top(e);264 owl_editwin_move_to_end_of_line(e);265 owl_editwin_replace(e, oe_count_glyphs(e->buff + e->index), "");266 }267 }268 269 /* completly reinitialize the buffer */270 void owl_editwin_fullclear(owl_editwin *e)271 {272 owl_free(e->buff);273 owl_editwin_init(e, e->curswin, e->winlines, e->wincols, e->style, e->hist);274 e->callback = NULL;275 oe_destroy_cbdata(e);276 }277 278 262 /* clear all text except for locktext and put the cursor at the 279 263 * beginning … … 294 278 295 279 owl_free(e->buff); 296 owl_editwin_init(e, e->curswin, e->winlines, e->wincols, e->style, e->hist);280 _owl_editwin_init(e, e->curswin, e->winlines, e->wincols, e->style, e->hist); 297 281 298 282 if (lock > 0) {
Note: See TracChangeset
for help on using the changeset viewer.