Pārlūkot izejas kodu

[Refs #25] Fix bottom line's width

isundil 9 gadi atpakaļ
vecāks
revīzija
18f5c508d1
3 mainītis faili ar 9 papildinājumiem un 3 dzēšanām
  1. 1 0
      include/curseOutput.hh
  2. 7 2
      src/curseOutput.cpp
  3. 1 1
      src/curseSplitOutput.cpp

+ 1 - 0
include/curseOutput.hh

@@ -93,6 +93,7 @@ class CurseOutput
          * get the screen size
         **/
         virtual const std::pair<unsigned int, unsigned int> getScreenSize() const;
+        const std::pair<unsigned int, unsigned int> getScreenSizeUnsafe() const;
 
         /**
          * set the select_up and select_down pointers, scroll to selection if it is above view port

+ 7 - 2
src/curseOutput.cpp

@@ -162,6 +162,11 @@ unsigned int CurseOutput::getNbLines(const size_t nbChar, unsigned int maxWidth)
 }
 
 const std::pair<unsigned int, unsigned int> CurseOutput::getScreenSize() const
+{
+    return getScreenSizeUnsafe();
+}
+
+const std::pair<unsigned int, unsigned int> CurseOutput::getScreenSizeUnsafe() const
 {
     std::pair<int, int> bs;
     std::pair<int, int> sc;
@@ -237,7 +242,7 @@ void CurseOutput::writeTopLine(const std::string &buffer, short color) const
 
 void CurseOutput::writeBottomLine(const std::string &buffer, short color) const
 {
-    const std::pair<unsigned int, unsigned int> screenSize = getScreenSize();
+    const std::pair<unsigned int, unsigned int> screenSize = getScreenSizeUnsafe();
     const size_t bufsize = buffer.size();
 
     if (params.colorEnabled())
@@ -250,7 +255,7 @@ void CurseOutput::writeBottomLine(const std::string &buffer, short color) const
 
 void CurseOutput::writeBottomLine(const std::wstring &buffer, short color) const
 {
-    const std::pair<unsigned int, unsigned int> screenSize = getScreenSize();
+    const std::pair<unsigned int, unsigned int> screenSize = getScreenSizeUnsafe();
     const size_t bufsize = buffer.size();
 
     if (params.colorEnabled())

+ 1 - 1
src/curseSplitOutput.cpp

@@ -586,7 +586,7 @@ void CurseSplitOutput::writeTopLine(const std::string &buffer, short color) cons
 
 const std::pair<unsigned int, unsigned int> CurseSplitOutput::getScreenSize() const
 {
-    std::pair<unsigned int, unsigned int> result = CurseOutput::getScreenSize();
+    std::pair<unsigned int, unsigned int> result = getScreenSizeUnsafe();
     result.first /= nbInputs;
     result.second -=2 ;
     return result;