X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftty%2Flib_mvcur.c;h=4c0ef4a27e3ee90ff84b5956efff31c697f68aab;hp=bdc4b5655cb78beacae2fa52e99f22b8ffbf37f1;hb=f70db18a0c3c6a828d8a5999be37239f01c9d98a;hpb=55ccd2b959766810cf7db8d1c4462f338ce0afc8 diff --git a/ncurses/tty/lib_mvcur.c b/ncurses/tty/lib_mvcur.c index bdc4b565..4c0ef4a2 100644 --- a/ncurses/tty/lib_mvcur.c +++ b/ncurses/tty/lib_mvcur.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * + * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -155,7 +155,7 @@ #include #include -MODULE_ID("$Id: lib_mvcur.c,v 1.103 2005/06/11 19:30:15 tom Exp $") +MODULE_ID("$Id: lib_mvcur.c,v 1.107 2006/11/25 22:31:59 tom Exp $") #define WANT_CHAR(y, x) SP->_newscr->_line[y].text[x] /* desired state */ #define BAUDRATE cur_term->_baudrate /* bits per second */ @@ -257,7 +257,7 @@ reset_scroll_region(void) { if (change_scroll_region) { TPUTS_TRACE("change_scroll_region"); - putp(tparm(change_scroll_region, 0, screen_lines - 1)); + putp(TPARM_2(change_scroll_region, 0, screen_lines - 1)); } } @@ -309,8 +309,13 @@ _nc_mvcur_init(void) SP->_home_cost = CostOf(cursor_home, 0); SP->_ll_cost = CostOf(cursor_to_ll, 0); #if USE_HARD_TABS - SP->_ht_cost = CostOf(tab, 0); - SP->_cbt_cost = CostOf(back_tab, 0); + if (getenv("NCURSES_NO_HARD_TABS") == 0) { + SP->_ht_cost = CostOf(tab, 0); + SP->_cbt_cost = CostOf(back_tab, 0); + } else { + SP->_ht_cost = INFINITY; + SP->_cbt_cost = INFINITY; + } #endif /* USE_HARD_TABS */ SP->_cub1_cost = CostOf(cursor_left, 0); SP->_cuf1_cost = CostOf(cursor_right, 0); @@ -356,13 +361,13 @@ _nc_mvcur_init(void) * All these averages depend on the assumption that all parameter values * are equally probable. */ - SP->_cup_cost = CostOf(tparm(SP->_address_cursor, 23, 23), 1); - SP->_cub_cost = CostOf(tparm(parm_left_cursor, 23), 1); - SP->_cuf_cost = CostOf(tparm(parm_right_cursor, 23), 1); - SP->_cud_cost = CostOf(tparm(parm_down_cursor, 23), 1); - SP->_cuu_cost = CostOf(tparm(parm_up_cursor, 23), 1); - SP->_hpa_cost = CostOf(tparm(column_address, 23), 1); - SP->_vpa_cost = CostOf(tparm(row_address, 23), 1); + SP->_cup_cost = CostOf(TPARM_2(SP->_address_cursor, 23, 23), 1); + SP->_cub_cost = CostOf(TPARM_1(parm_left_cursor, 23), 1); + SP->_cuf_cost = CostOf(TPARM_1(parm_right_cursor, 23), 1); + SP->_cud_cost = CostOf(TPARM_1(parm_down_cursor, 23), 1); + SP->_cuu_cost = CostOf(TPARM_1(parm_up_cursor, 23), 1); + SP->_hpa_cost = CostOf(TPARM_1(column_address, 23), 1); + SP->_vpa_cost = CostOf(TPARM_1(row_address, 23), 1); /* non-parameterized screen-update strings */ SP->_ed_cost = NormalizedCost(clr_eos, 1); @@ -379,14 +384,14 @@ _nc_mvcur_init(void) SP->_el_cost = 0; /* parameterized screen-update strings */ - SP->_dch_cost = NormalizedCost(tparm(parm_dch, 23), 1); - SP->_ich_cost = NormalizedCost(tparm(parm_ich, 23), 1); - SP->_ech_cost = NormalizedCost(tparm(erase_chars, 23), 1); - SP->_rep_cost = NormalizedCost(tparm(repeat_char, ' ', 23), 1); - - SP->_cup_ch_cost = NormalizedCost(tparm(SP->_address_cursor, 23, 23), 1); - SP->_hpa_ch_cost = NormalizedCost(tparm(column_address, 23), 1); - SP->_cuf_ch_cost = NormalizedCost(tparm(parm_right_cursor, 23), 1); + SP->_dch_cost = NormalizedCost(TPARM_1(parm_dch, 23), 1); + SP->_ich_cost = NormalizedCost(TPARM_1(parm_ich, 23), 1); + SP->_ech_cost = NormalizedCost(TPARM_1(erase_chars, 23), 1); + SP->_rep_cost = NormalizedCost(TPARM_2(repeat_char, ' ', 23), 1); + + SP->_cup_ch_cost = NormalizedCost(TPARM_2(SP->_address_cursor, 23, 23), 1); + SP->_hpa_ch_cost = NormalizedCost(TPARM_1(column_address, 23), 1); + SP->_cuf_ch_cost = NormalizedCost(TPARM_1(parm_right_cursor, 23), 1); SP->_inline_cost = min(SP->_cup_ch_cost, min(SP->_hpa_ch_cost, SP->_cuf_ch_cost)); @@ -448,7 +453,7 @@ _nc_mvcur_wrap(void) /* * Perform repeated-append, returning cost */ -static inline int +static NCURSES_INLINE int repeated_append(string_desc * target, int total, int num, int repeat, const char *src) { size_t need = repeat * strlen(src); @@ -491,7 +496,7 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int vcost = INFINITY; if (row_address != 0 - && _nc_safe_strcat(target, tparm(row_address, to_y))) { + && _nc_safe_strcat(target, TPARM_1(row_address, to_y))) { vcost = SP->_vpa_cost; } @@ -501,7 +506,7 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int if (parm_down_cursor && SP->_cud_cost < vcost && _nc_safe_strcat(_nc_str_copy(target, &save), - tparm(parm_down_cursor, n))) { + TPARM_1(parm_down_cursor, n))) { vcost = SP->_cud_cost; } @@ -517,7 +522,7 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int if (parm_up_cursor && SP->_cuu_cost < vcost && _nc_safe_strcat(_nc_str_copy(target, &save), - tparm(parm_up_cursor, n))) { + TPARM_1(parm_up_cursor, n))) { vcost = SP->_cuu_cost; } @@ -541,7 +546,7 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int if (column_address && _nc_safe_strcat(_nc_str_copy(target, &save), - tparm(column_address, to_x))) { + TPARM_1(column_address, to_x))) { hcost = SP->_hpa_cost; } @@ -551,7 +556,7 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int if (parm_right_cursor && SP->_cuf_cost < hcost && _nc_safe_strcat(_nc_str_copy(target, &save), - tparm(parm_right_cursor, n))) { + TPARM_1(parm_right_cursor, n))) { hcost = SP->_cuf_cost; } @@ -643,7 +648,7 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int if (parm_left_cursor && SP->_cub_cost < hcost && _nc_safe_strcat(_nc_str_copy(target, &save), - tparm(parm_left_cursor, n))) { + TPARM_1(parm_left_cursor, n))) { hcost = SP->_cub_cost; } @@ -695,7 +700,7 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int * the simpler method below. */ -static inline int +static NCURSES_INLINE int onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw) /* onscreen move from (yold, xold) to (ynew, xnew) */ { @@ -714,7 +719,7 @@ onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw) #define InitResult _nc_str_init(&result, buffer, sizeof(buffer)) /* tactic #0: use direct cursor addressing */ - if (_nc_safe_strcpy(InitResult, tparm(SP->_address_cursor, ynew, xnew))) { + if (_nc_safe_strcpy(InitResult, TPARM_2(SP->_address_cursor, ynew, xnew))) { tactic = 0; usecost = SP->_cup_cost; @@ -1014,7 +1019,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { (void) strcpy(tname, termname()); load_term(); - _nc_setupscreen(lines, columns, stdout); + _nc_setupscreen(lines, columns, stdout, FALSE, 0); baudrate(); _nc_mvcur_init();