LCOV - code coverage report
Current view: top level - src/terminal - terminaldisplay.h (source / functions) Hit Total Coverage
Test: mosh-1.3.2 Code Coverage Lines: 6 7 85.7 %
Date: 2022-02-06 20:19:53 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :     Mosh: the mobile shell
       3             :     Copyright 2012 Keith Winstein
       4             : 
       5             :     This program is free software: you can redistribute it and/or modify
       6             :     it under the terms of the GNU General Public License as published by
       7             :     the Free Software Foundation, either version 3 of the License, or
       8             :     (at your option) any later version.
       9             : 
      10             :     This program is distributed in the hope that it will be useful,
      11             :     but WITHOUT ANY WARRANTY; without even the implied warranty of
      12             :     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13             :     GNU General Public License for more details.
      14             : 
      15             :     You should have received a copy of the GNU General Public License
      16             :     along with this program.  If not, see <http://www.gnu.org/licenses/>.
      17             : 
      18             :     In addition, as a special exception, the copyright holders give
      19             :     permission to link the code of portions of this program with the
      20             :     OpenSSL library under certain conditions as described in each
      21             :     individual source file, and distribute linked combinations including
      22             :     the two.
      23             : 
      24             :     You must obey the GNU General Public License in all respects for all
      25             :     of the code used other than OpenSSL. If you modify file(s) with this
      26             :     exception, you may extend this exception to your version of the
      27             :     file(s), but you are not obligated to do so. If you do not wish to do
      28             :     so, delete this exception statement from your version. If you delete
      29             :     this exception statement from all source files in the program, then
      30             :     also delete it here.
      31             : */
      32             : 
      33             : #ifndef TERMINALDISPLAY_HPP
      34             : #define TERMINALDISPLAY_HPP
      35             : 
      36             : #include "terminalframebuffer.h"
      37             : 
      38             : namespace Terminal {
      39             :   /* variables used within a new_frame */
      40       48398 :   class FrameState {
      41             :   public:
      42             :     std::string str;
      43             : 
      44             :     int cursor_x, cursor_y;
      45             :     Renditions current_rendition;
      46             :     bool cursor_visible;
      47             : 
      48             :     const Framebuffer &last_frame;
      49             : 
      50             :     FrameState( const Framebuffer &s_last );
      51             : 
      52      165489 :     void append( char c ) { str.append( 1, c ); }
      53      183845 :     void append( size_t s, char c ) { str.append( s, c ); }
      54           0 :     void append( wchar_t wc ) { Cell::append_to_str( str, wc ); }
      55       57396 :     void append( const char * s ) { str.append( s ); }
      56       31886 :     void append_string( const std::string &append ) { str.append(append); }
      57             : 
      58      589125 :     void append_cell(const Cell & cell) { cell.print_grapheme( str ); }
      59             :     void append_silent_move( int y, int x );
      60             :     void append_move( int y, int x );
      61             :     void update_rendition( const Renditions &r, bool force = false );
      62             :   };
      63             : 
      64             :   class Display {
      65             :   private:
      66             :     bool has_ech; /* erase character is part of vt200 but not supported by tmux
      67             :                      (or by "screen" terminfo entry, which is what tmux advertises) */
      68             : 
      69             :     bool has_bce; /* erases result in cell filled with background color */
      70             : 
      71             :     bool has_title; /* supports window title and icon name */
      72             : 
      73             :     const char *smcup, *rmcup; /* enter and exit alternate screen mode */
      74             : 
      75             :     bool put_row( bool initialized, FrameState &frame, const Framebuffer &f, int frame_y, const Row &old_row, bool wrap ) const;
      76             : 
      77             :   public:
      78             :     std::string open() const;
      79             :     std::string close() const;
      80             : 
      81             :     std::string new_frame( bool initialized, const Framebuffer &last, const Framebuffer &f ) const;
      82             : 
      83             :     Display( bool use_environment );
      84             :   };
      85             : }
      86             : 
      87             : #endif

Generated by: LCOV version 1.14