⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 del_line.cc

📁 initial working phase of the design of said editor, featuring multicasting, advanced linux keyboard
💻 CC
字号:
#include "term.h"#include <stdio.h>#define debug_flag#ifdef debug_flag#define del_line_top printf( "\r\ntop " ); debug();#define del_line_mid printf( "mid " ); debug();#define del_line_entry printf( "entry " ); debug();#define del_line_t printf( "t %d %d %d\r\n", b, _row, x ); fflush( stdout );#define del_line_ft printf( "ft %d %d %d\r\n", b, _row, x ); fflush( stdout );#define del_line_dl \   printf( "dl %d %d %d rows %d\r\n", b, _row, x, rows ); fflush( stdout );#define del_line_tst printf( "tst %d %d %d\r\n", b, _row, x );fflush( stdout );#define del_line_end printf( "end " ); debug(); \{printf( "%d %d %d %08X\r\n", b, _row, x, _here ); fflush( stdout ); debug();}#else#define del_line_top#define del_line_mid#define del_line_entry#define del_line_t#define del_line_ft#define del_line_dl#define del_line_tst#define del_line_end#endif // debugvoid term::del_line( u_int cursor ){   if( _row == rows - 1 ) return;   del_line_top//   if( __here -> length + __here -> next -> length > cols ) return;   // && !flag - where flag is for (ctrl)   //__here -> merge( _pcol = _col );   int b = 1; // lines to delete   bool exp_check = false;// perhaps too hasty in changing line_s to line if deleting from a line_s   if( __here -> id_mask == ID_LINE_S // complex replacement procedure   && ( ( line_s* )__here ) -> scr -> top == __here -> next ) // is expanded   {   exp_check = true;   if( __here -> next == ( ( line_s* )__here ) -> scr -> bot // one line   || ( __here -> next -> id_mask == ID_LINE_S      && ( ( line_s* )( __here -> next ) ) -> scr -> bot	 == ( ( line_s* )__here ) -> scr -> bot ) )   {      line* here = new line( __here ); // here is no longer here, has moved      if( __here -> last != NULL )      {	 __here -> last -> next = here;	 if( __here -> last -> id_mask == ID_LINE_S	 && ( ( line_s* )( __here -> last ) ) -> scr -> top == __here )	   ( ( line_s* )( __here -> last ) ) -> scr -> top = here;      }      if( _row > 0 ) //&& top != NULL	 update_to_top( cursor, here, __here, here	 , __here -> last, _row - 1 );//      update_to_top( cursor, here -> next // taken from below//      , here, here -> next, __here, _row );      if( here -> next != NULL )      {	 here -> next -> last = here;      }      if( _row == 0 ) s -> top = here;//      bot = ( ( line_s* )__here ) -> scr -> bot;      delete ( line_s* )__here;      _here = ( u_int )here;   }   }   line* here = __here -> next; // the bottom line to delete   if( here -> id_mask == ID_LINE_S )   {//      return; // update to use (ctrl)      if( ( ( line_s* )here ) -> scr -> top -> last != NULL )      {	 line* bot = ( ( line_s* )here ) -> scr -> bot;	 here = here -> next;	 for( ++b; here != bot; ++b )	 {	    here = here -> next;	 }      }   //for_each_cursor_here( _row + 1, _col, &term::cursor_lbs );   // be inclusive of other cursors, to _row + b   }   else // ordinary line   {      for_each_cursor_here( _row + 1, _col, &term::cursor_lbs );      if( !exp_check ) // expanded	 __here -> merge( _pcol = _col );/*   _pcol = _col;   int i = __here -> length + __here -> next -> length;   while( __here -> length + 1 > __here -> size )      __here -> resize( __here -> size += 20 );   __here -> length = i; // resize() uses length//   for( ; i >= _col; i-- )		// this gives segfaults due to sizing?//      __here -> text[ i ] = __here -> next -> text[ i - _col ];	    printf( "i %d col %d\r\n", i, _col );   if( rows == 3 ) // __here -> next = ?   {   printf( "mid " );	    debug(); // row 2 (?)	    printf( "%d @", b );	    fflush( stdout );      __here -> text[ 0 ] = __here -> next -> text[ 0 ];	    _s();	    printf( "@" );	    fflush( stdout );//	    segv( 0 );   }*/   }   if( __here -> id_mask == ID_LINE_S // complex replacement procedure   && ( ( line_s* )__here ) -> scr -> top == __here -> next ) // is expanded   {      ( ( line_s* )__here ) -> scr -> top = here -> next;   }// suppose here -> next was null   del_line_mid//   if( here -> next == NULL ) printf( "caught\r\n" );//   fflush( stdout );//   printf( "here %08X\r\n", ( u_int )( here ) );//   fflush( stdout );   if( _row > 0 ) // what is brand if no line_s ? NULL   {      line* x = __here;      _here = ( u_int )here; // replaced with here -> next or NULL      if( here -> next == NULL )	 update_to_top( cursor, NULL	 , here, x, x, _row );      else	 update_to_top( cursor, here -> next	 , here, here -> next, x, _row );      _here = ( u_int )x;   }// printf( "%08X x ", ( u_int )( ( ( line_s* )( s -> top ) ) -> scr -> bot ) );// debug();   if( here -> next != NULL )   {// was done, but should be pretty much automatic//      here -> next -> last = __here;//      if( here -> next -> id_mask == ID_LINE_S//      && ( ( line_s* )( here -> next ) ) -> scr -> top -> last != NULL )//	 ( ( line_s* )( here -> next ) ) -> scr -> top -> last = __here;   }   line* temp = __here;   _row += b;   u_int x = _row;   _here = ( u_int )here;   del_line_entry   int level = _row < note::rows - 1 ? note::rows - 1 : _row; // max   for(;;) // here not initialized within loop   {      del_line_t // b _row x : 2 1 1      if( b == 0 )      {//	 if( _row > 0 ) --_row;	 break;      }      if( b > 1 && x > _row - b )      {	 line* top = find_top( cursor, x );	 del_line_ft // 2 1 1	 if( top == NULL ) x = _row - b;	 else if( x < _row && x > _row - b )	 {//	    line* cap = here -> next;	    _here = ( u_int )top;	    _row = x;	    if( __here -> last -> id_mask == ID_LINE_S // expanded	    && ( ( line_s* )( __here -> last ) ) -> scr -> top == __here )	    {	       ( ( line_s* )( __here -> last ) ) -> scr -> top = NULL;	    }//	    if( __here -> id_mask == ID_LINE_S ) // which is so	    b -= del_line_s( ( line_s* )__here );//	    printf( "r: %d\r\n", r );	    del_line_dl // 2 1 1//	 segv( 0 );//	    b -= _row - x + 1;	    x = _row = x - 1; // move away from this top row	    _here = ( u_int )( __here -> last ); // suppose, on row 4	    continue;	 }      }//	 printf( "b %d r %d x %d\r\n", b, _row, x ); // 3 1 1//	 fflush( stdout );//      if( __here -> next == s -> bot )      if( __here == s -> bot )	  s -> bot = temp; // the line above the deletion      here = __here -> last;      delete __here -> text;      s -> del( __here );      --rows; --_row; // 1      del_line_tst // b _row x : 2 1 1      level = _row < note::rows - 1 ? note::rows - 1 : _row; // max      for_each_cursor_below( level, &term::dec_orig );      for_each_cursor_below( _row, &term::dec_row );      if( --b == 0 ) break;//      --_row;      _here = ( u_int )here;   }   _here = ( u_int )temp;//   if( cursor == 0 ) repos( xcol, xrow - xorig ); // (?) already done in bs   // if _row == xorig, visible text was merged//   else if( _row >= xorig + note::rows   || ( xrow > level && _row < xorig ) ) return;#ifndef debug_flag   redraw();#endif   del_line_end}/*void term::del_line( u_int cursor ){   if( __here -> id_mask == ID_LINE_S ) return; // update to use (ctrl)   if( _row == rows - 1 ) return;//   if( __here -> next == NULL ) return;   if( __here -> length + __here -> next -> length > cols ) return;   __here -> merge( _pcol = _col );   for_each_cursor_here( _row + 1, _col, &term::cursor_lbs );   int level = _row < note::rows - 1 ? note::rows - 1 : _row; // max   for_each_cursor_below( level, &term::dec_orig ); // fix: adapt to vary   for_each_cursor_below( _row, &term::dec_row );   s -> del( __here -> next );   rows--;//   if( cursor == 0 ) repos( xcol, xrow - xorig ); // (?) already done in bs   // if _row == xorig, visible text was merged//   else if( _row >= xorig + note::rows   || ( xrow > level && _row < xorig ) ) return;   redraw();}*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -