Changeset 38cc669
- Timestamp:
- Mar 23, 2010, 5:23:43 PM (15 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)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
commands.c
r8dfb59c r38cc669 2566 2566 /* if we get two arguments, ask for the password */ 2567 2567 if (argc==2) { 2568 owl_function_start_password("AIM Password: "); 2568 2569 owl_editwin_set_cbdata(owl_global_get_typwin(&g), 2569 2570 owl_strdup(argv[1]), owl_free); 2570 2571 owl_editwin_set_callback(owl_global_get_typwin(&g), 2571 2572 owl_callback_aimlogin); 2572 owl_function_start_password("AIM Password: ");2573 2573 return(NULL); 2574 2574 } else { … … 2699 2699 } 2700 2700 2701 owl_editwin_fullclear(e);2702 2701 owl_global_set_needrefresh(&g); 2702 owl_global_pop_context(&g); 2703 2703 2704 owl_global_set_typwin_inactive(&g); 2704 owl_editwin_new_style(e, OWL_EDITWIN_STYLE_ONELINE, NULL);2705 2706 owl_global_pop_context(&g);2707 2705 } 2708 2706 … … 2761 2759 owl_history_store(hist, owl_editwin_get_text(e)); 2762 2760 owl_history_reset(hist); 2761 cmd = owl_strdup(owl_editwin_get_text(e)); 2762 2763 2763 owl_global_set_typwin_inactive(&g); 2764 2764 owl_global_pop_context(&g); 2765 cmd = owl_strdup(owl_editwin_get_text(e)); 2766 owl_editwin_fullclear(e); 2765 2767 2766 rv = owl_function_command(cmd); 2768 2767 owl_free(cmd); … … 2783 2782 owl_global_set_typwin_inactive(&g); 2784 2783 owl_global_pop_context(&g); 2785 owl_editwin_fullclear(e); 2784 2786 2785 owl_global_set_needrefresh(&g); 2787 2786 } … … 2796 2795 2797 2796 owl_function_run_buffercommand(); 2798 owl_editwin_new_style(e, OWL_EDITWIN_STYLE_ONELINE, NULL); 2799 owl_editwin_fullclear(e); 2797 2800 2798 owl_global_set_typwin_inactive(&g); 2801 2799 owl_global_pop_context(&g); -
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) { -
functions.c
r8dfb59c r38cc669 283 283 284 284 /* create and setup the editwin */ 285 owl_global_set_typwin_active(&g, OWL_EDITWIN_STYLE_MULTILINE, 286 owl_global_get_msg_history(&g)); 285 287 e = owl_global_get_typwin(&g); 286 owl_editwin_new_style(e, OWL_EDITWIN_STYLE_MULTILINE,287 owl_global_get_msg_history(&g));288 owl_editwin_clear(e);289 288 owl_editwin_set_dotsend(e); 290 289 s = owl_sprintf("----> %s\n", line); … … 292 291 owl_free(s); 293 292 294 /* make it active */ 295 owl_global_set_typwin_active(&g); 296 297 owl_editwin_set_cbdata(owl_global_get_typwin(&g), data, cleanup); 298 owl_editwin_set_callback(owl_global_get_typwin(&g), callback); 293 owl_editwin_set_cbdata(e, data, cleanup); 294 owl_editwin_set_callback(e, callback); 299 295 owl_global_push_context(&g, OWL_CTX_EDITMULTI, e, "editmulti"); 300 296 } … … 1913 1909 owl_editwin *tw; 1914 1910 1911 owl_global_set_typwin_active(&g, OWL_EDITWIN_STYLE_ONELINE, owl_global_get_cmd_history(&g)); 1915 1912 tw=owl_global_get_typwin(&g); 1916 owl_global_set_typwin_active(&g);1917 owl_editwin_new_style(tw, OWL_EDITWIN_STYLE_ONELINE,1918 owl_global_get_cmd_history(&g));1919 1913 1920 1914 owl_editwin_set_locktext(tw, "command: "); … … 1931 1925 owl_editwin *tw; 1932 1926 1927 owl_global_set_typwin_active(&g, OWL_EDITWIN_STYLE_ONELINE, owl_global_get_cmd_history(&g)); 1933 1928 tw=owl_global_get_typwin(&g); 1934 owl_global_set_typwin_active(&g);1935 owl_editwin_new_style(tw, OWL_EDITWIN_STYLE_ONELINE, owl_global_get_cmd_history(&g));1936 1929 1937 1930 owl_editwin_set_locktext(tw, line); … … 1947 1940 owl_editwin *tw; 1948 1941 1949 tw=owl_global_get_typwin(&g); 1950 owl_global_set_typwin_active(&g); 1951 owl_editwin_new_style(tw, OWL_EDITWIN_STYLE_ONELINE, owl_global_get_cmd_history(&g)); 1942 owl_global_set_typwin_active(&g, OWL_EDITWIN_STYLE_ONELINE, owl_global_get_cmd_history(&g)); 1943 tw = owl_global_get_typwin(&g); 1952 1944 owl_editwin_set_echochar(tw, '*'); 1953 1945 -
global.c
r8dfb59c r38cc669 45 45 g->rightshift=0; 46 46 47 g->tw = owl_editwin_allocate(); 48 owl_editwin_init(g->tw, NULL, owl_global_get_typwin_lines(g), g->cols, OWL_EDITWIN_STYLE_ONELINE, NULL); 47 g->tw = NULL; 49 48 50 49 owl_keyhandler_init(&g->kh); … … 171 170 _owl_panel_set_window(&g->typpan, newwin(typwin_lines, cols, g->recwinlines+2, 0)); 172 171 173 owl_editwin_set_curswin(g->tw, owl_global_get_curs_typwin(g), typwin_lines, g->cols); 172 if (g->tw) 173 owl_editwin_set_curswin(g->tw, owl_global_get_curs_typwin(g), typwin_lines, g->cols); 174 174 175 175 idlok(owl_global_get_curs_typwin(g), FALSE); … … 368 368 } 369 369 370 void owl_global_set_typwin_active(owl_global *g) { 371 int d = owl_global_get_typewindelta(g); 370 void owl_global_set_typwin_active(owl_global *g, int style, owl_history *hist) { 371 int d; 372 d = owl_global_get_typewindelta(g); 372 373 if (d > 0) 373 374 owl_function_resize_typwin(owl_global_get_typwin_lines(g) + d); 374 375 376 g->tw = owl_editwin_new(owl_global_get_curs_typwin(g), 377 owl_global_get_typwin_lines(g), 378 g->cols, 379 style, 380 hist); 375 381 g->typwinactive=1; 376 382 } … … 382 388 383 389 g->typwinactive=0; 390 391 owl_editwin_delete(g->tw); 392 werase(owl_global_get_curs_typwin(g)); 393 g->tw = NULL; 384 394 } 385 395 … … 513 523 owl_mainwin_redisplay(&(g->mw)); 514 524 sepbar(NULL); 515 owl_editwin_redisplay(g->tw); 525 if (g->tw) 526 owl_editwin_redisplay(g->tw); 516 527 owl_function_full_redisplay(); 517 528 -
perlglue.xs
r1b1cd2c r38cc669 549 549 int count; 550 550 const char *string; 551 CODE: 552 RETVAL = owl_editwin_replace(owl_global_get_typwin(&g), count, string); 551 PREINIT: 552 owl_editwin *e; 553 CODE: 554 e = owl_global_get_typwin(&g); 555 if (e) { 556 RETVAL = owl_editwin_replace(e, count, string); 557 } else { 558 RETVAL = 0; 559 } 553 560 OUTPUT: 554 561 RETVAL … … 557 564 point_move(delta) 558 565 int delta; 559 CODE: 560 RETVAL = owl_editwin_point_move(owl_global_get_typwin(&g), delta); 566 PREINIT: 567 owl_editwin *e; 568 CODE: 569 e = owl_global_get_typwin(&g); 570 if (e) { 571 RETVAL = owl_editwin_point_move(e, delta); 572 } else { 573 RETVAL = 0; 574 } 561 575 OUTPUT: 562 576 RETVAL … … 565 579 replace_region(string) 566 580 const char *string; 567 CODE: 568 RETVAL = owl_editwin_replace_region(owl_global_get_typwin(&g), string); 581 PREINIT: 582 owl_editwin *e; 583 CODE: 584 e = owl_global_get_typwin(&g); 585 if (e) { 586 RETVAL = owl_editwin_replace_region(e, string); 587 } else { 588 RETVAL = 0; 589 } 569 590 OUTPUT: 570 591 RETVAL … … 574 595 PREINIT: 575 596 char *region; 576 CODE: 577 region = owl_editwin_get_region(owl_global_get_typwin(&g)); 597 owl_editwin *e; 598 CODE: 599 e = owl_global_get_typwin(&g); 600 if (e) { 601 region = owl_editwin_get_region(owl_global_get_typwin(&g)); 602 } else { 603 region = NULL; 604 } 578 605 RETVAL = region; 579 606 OUTPUT: … … 588 615 PREINIT: 589 616 int count; 617 owl_editwin *e; 590 618 owl_editwin_excursion *x; 591 619 CODE: 592 620 { 621 e = owl_global_get_typwin(&g); 622 if(!e) 623 croak("The edit window is not currently active!"); 624 593 625 x = owl_editwin_begin_excursion(owl_global_get_typwin(&g)); 594 626 PUSHMARK(SP); … … 612 644 int 613 645 current_column() 614 CODE: 615 RETVAL = owl_editwin_current_column(owl_global_get_typwin(&g)); 646 PREINIT: 647 owl_editwin *e; 648 CODE: 649 e = owl_global_get_typwin(&g); 650 if (e) { 651 RETVAL = owl_editwin_current_column(e); 652 } else { 653 RETVAL = 0; 654 } 616 655 OUTPUT: 617 656 RETVAL … … 619 658 int 620 659 point() 621 CODE: 622 RETVAL = owl_editwin_get_point(owl_global_get_typwin(&g)); 660 PREINIT: 661 owl_editwin *e; 662 CODE: 663 e = owl_global_get_typwin(&g); 664 if (e) { 665 RETVAL = owl_editwin_get_point(e); 666 } else { 667 RETVAL = 0; 668 } 623 669 OUTPUT: 624 670 RETVAL … … 626 672 int 627 673 mark() 628 CODE: 629 RETVAL = owl_editwin_get_mark(owl_global_get_typwin(&g)); 630 OUTPUT: 631 RETVAL 674 PREINIT: 675 owl_editwin *e; 676 CODE: 677 e = owl_global_get_typwin(&g); 678 if (e) { 679 RETVAL = owl_editwin_get_mark(e); 680 } else { 681 RETVAL = 0; 682 } 683 OUTPUT: 684 RETVAL
Note: See TracChangeset
for help on using the changeset viewer.