Procházet zdrojové kódy

[quickfix] when top item is selected and above top of screen, this one is invisible

B Thibault před 9 roky
rodič
revize
a33823bca0
2 změnil soubory, kde provedl 4 přidání a 4 odebrání
  1. 2 2
      src/curseSimpleOutput.cpp
  2. 2 2
      src/curseSplitOutput.cpp

+ 2 - 2
src/curseSimpleOutput.cpp

@@ -506,8 +506,8 @@ void CurseSimpleOutput::checkSelection(const JSonElement *item, const t_Cursor &
     {
         if (selection == item)
         {
-            if (cursor.second < scrollTop) //Selection is above vp, move scroll pos to selection and start drawing
-                scrollTop = cursor.second;
+            if (cursor.second <= scrollTop) //Selection is above vp, move scroll pos to selection and start drawing
+                scrollTop = cursor.second == 0 ? 0 : cursor.second -1;
             selectFound = true;
         }
         else if (!item->getParent() || !dynamic_cast<const JSonObjectEntry*>(item->getParent()))

+ 2 - 2
src/curseSplitOutput.cpp

@@ -266,8 +266,8 @@ void CurseSplitOutput::checkSelection(const JSonElement *item)
     {
         if (w.lastSelection == item)
         {
-            if (w.cursor.second < w.scrollTop) //Selection is above vp, move scroll pos to selection and start drawing
-                w.scrollTop = w.cursor.second;
+            if (w.cursor.second <= w.scrollTop) //Selection is above vp, move scroll pos to selection and start drawing
+                w.scrollTop = w.cursor.second == 0 ? 0 : w.cursor.second -1;
             w.selectFound = true;
         }
         else if (!item->getParent() || !dynamic_cast<const JSonObjectEntry*>(item->getParent()))