From: Araki K. <j00...@ip...> - 2002-03-13 16:19:15
|
荒木です:-) Subject: Re: [Mlterm-dev-ja] commit log [2002/03/06] (was: mlterm マニュアル・ページ) From: Mike Fabian <mf...@su...> Message-ID: <s3t...@gr...> Date: Tue, 12 Mar 2002 18:47:41 +0100 > このパッチを当たると、もっと良くなりますが、まだ小さな問題が残って > います。scroll_region の高さが2行しかなければ、まだ screen のステータ > ス行を上書きする事ができます: > > ./mlterm -geometry 80x3 > screen > > 長い 'xxxxxxxxxxxxxxxxxxxxxxxxx ....' のコマンド・ラインを入力しました > (150 個の 'x'ぐらい)。行がラップアラウンドする時、screen のステータス > 行がまだ上書きされませんが、「return」を押す時、ステータス行が上書きさ > れます。ログを添付しました。 ありがとうございます。 CVS に、修正を commit しておきました。 修正個所は、大体添付のパッチのような感じです。 では -- kiken j00...@ip... Index: src/ml_image.c =================================================================== RCS file: /home/ken/cvsroot/mlterm/src/ml_image.c,v retrieving revision 1.225 retrieving revision 1.228 diff -u -r1.225 -r1.228 --- src/ml_image.c 2002/03/12 10:07:36 1.225 +++ src/ml_image.c 2002/03/13 14:25:25 1.228 @@ -92,7 +92,6 @@ { int bol ; /* index of the beginning of line */ u_int row ; - u_int line_len ; u_int line_cols ; int counter ; u_int scroll_size ; @@ -117,86 +116,44 @@ line_cols = 0 ; while( 1) { - if( line_cols + ml_char_cols( &chars[counter]) > image->model.num_of_cols) + if( counter > bol && + line_cols + ml_char_cols( &chars[counter]) > image->model.num_of_cols) { - /* wraparound line */ - - /* excluding this char */ - line_len = counter - bol ; - - if( line_len > image->model.num_of_cols) - { - #ifdef DEBUG - kik_warn_printf( KIK_DEBUG_TAG - " line len %d is over ml_image_t::num_of_cols %d" , - line_len , image->model.num_of_cols) ; - #endif - - line_len = image->model.num_of_cols ; - - #ifdef DEBUG - kik_msg_printf( " ... modified -> %d\n" , line_len) ; - #endif - } - - ml_line_hints_add( &image->line_hints , bol , line_len , line_cols) ; + /* + * line length is 'counter - bol' for the character at 'counter' + * position to be excluded. + */ + ml_line_hints_add( &image->line_hints , bol , counter - bol , line_cols) ; - if( row > image->scroll_region_end) + if( row ++ >= image->scroll_region_end) { scroll_size ++ ; } - - row ++ ; bol = counter ; line_cols = 0 ; } - - line_cols += ml_char_cols( &chars[counter]) ; - - if( ++ counter >= num_of_chars) + else { - if( counter > bol) - { - line_len = counter - bol ; - - if( line_len > image->model.num_of_cols) - { - #ifdef DEBUG - kik_warn_printf( KIK_DEBUG_TAG - " line len %d is over ml_image_t::num_of_chars %d" , - line_len , image->model.num_of_cols) ; - #endif - - line_len = image->model.num_of_cols ; - - #ifdef DEBUG - kik_msg_printf( "... modified -> %d\n" , line_len) ; - #endif - } - - /* last line is not completely filled */ + line_cols += ml_char_cols( &chars[counter]) ; - ml_line_hints_add( &image->line_hints , bol , line_len , line_cols) ; + if( ++ counter >= num_of_chars) + { + ml_line_hints_add( &image->line_hints , bol , counter - bol , line_cols) ; - if( row >= image->model.num_of_rows) + if( scroll_size) { - scroll_size ++ ; + if( ! ml_imgscrl_scroll_upward( image , scroll_size)) + { + #ifdef DEBUG + kik_warn_printf( KIK_DEBUG_TAG + " ml_imgscrl_scroll_upward failed.\n") ; + #endif + } } - } - if( scroll_size) - { - if( ! ml_imgscrl_scroll_upward( image , scroll_size)) - { - #ifdef DEBUG - kik_warn_printf( KIK_DEBUG_TAG - " ml_imgscrl_scroll_upward failed.\n") ; - #endif - } + return 1 ; } - - return 1 ; } } } @@ -204,6 +161,7 @@ static int overwrite_lines( ml_image_t * image , + int * cursor_index , ml_char_t * chars , u_int num_of_chars ) @@ -212,6 +170,10 @@ int current_row ; int beg_char_index ; u_int num_of_lines ; + ml_image_line_t * line ; + int beg_of_line ; + u_int len ; + u_int cols ; if( ! render_chars( image , image->cursor.row , chars , num_of_chars)) { @@ -236,30 +198,15 @@ /* all changes should happen after cursor */ beg_char_index = image->cursor.char_index ; - while( 1) + while( ml_line_hints_at( &image->line_hints , &beg_of_line , &len , &cols , counter)) { - ml_image_line_t * line ; - int beg_of_line ; - u_int len ; - u_int cols ; - - if( ! ml_line_hints_at( &image->line_hints , &beg_of_line , &len , &cols , counter)) + if( counter == 0) { - #ifdef DEBUG - kik_warn_printf( KIK_DEBUG_TAG " ml_line_hints_at(%d) failed.\n" , counter) ; - #endif - - continue ; - } - - if( beg_of_line >= num_of_chars) - { - #ifdef DEBUG - kik_warn_printf( KIK_DEBUG_TAG " beg_of_line %d is over num_of_chars %d.\n" , - beg_of_line , num_of_chars) ; - #endif - - return 0 ; + /* + * adjusting cursor_index + * excluding scrolled out characters. + */ + *cursor_index -= beg_of_line ; } line = ml_imgmdl_get_line( &image->model , current_row) ; @@ -884,7 +831,7 @@ */ /* overwriting lines with scrolling */ - overwrite_lines( image , buffer , filled_len) ; + overwrite_lines( image , &cursor_index , buffer , filled_len) ; ml_str_final( buffer , buf_len) ; Index: src/ml_image_scroll.c =================================================================== RCS file: /home/ken/cvsroot/mlterm/src/ml_image_scroll.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -r1.53 -r1.54 --- src/ml_image_scroll.c 2002/03/12 10:07:36 1.53 +++ src/ml_image_scroll.c 2002/03/13 14:25:25 1.54 @@ -134,6 +134,10 @@ } } + image->cursor.row = boundary_beg ; + image->cursor.col = 0 ; + image->cursor.char_index = 0 ; + return ml_image_clear_lines( image , boundary_beg , boundary_end - boundary_beg + 1) ; } @@ -229,6 +233,10 @@ * all lines within boundary are scrolled out. */ + image->cursor.row = boundary_end ; + image->cursor.col = 0 ; + image->cursor.char_index = 0 ; + return ml_image_clear_lines( image , boundary_beg , boundary_end - boundary_beg + 1) ; } |