@@ -243,12 +243,9 @@ void Editor::ShowEditor()
243243 Color = colors::PaletteColorToFarColor (COL_EDITORTEXT );
244244 SelColor = colors::PaletteColorToFarColor (COL_EDITORSELECTEDTEXT );
245245
246- // Calculate line number column width if needed
247- // Minimum width of 3 for "1", "10", "100", etc. plus 1 for spacing
248- const auto LineNumWidth = EdOpt.ShowLineNumbers ?
249- (std::max (3 , static_cast <int >(std::log10 (static_cast <double >(Lines.size ()))) + 1 ) + 1 ) : 0 ;
246+ const auto LineNumWidth = LineNumbersWidth ();
250247
251- XX2 = m_Where.right - (EdOpt. ShowScrollBar && ScrollBarRequired ( ObjHeight (), Lines. size ())? 1 : 0 );
248+ XX2 = m_Where.right - ScrollbalWidth ( );
252249 /* 17.04.2002 skv
253250 Что б курсор не бегал при Alt-F9 в конце длинного файла.
254251 Если на экране есть свободное место, и есть текст сверху,
@@ -5578,9 +5575,10 @@ int Editor::EditorControl(int Command, intptr_t Param1, void *Param2)
55785575
55795576 case ECTL_GETINFO :
55805577 {
5581- const auto Info = static_cast <EditorInfo *>(Param2);
5582- if (!CheckStructSize (Info ))
5578+ const auto InfoV1 = static_cast <EditorInfoV1 *>(Param2);
5579+ if (!CheckStructSize (InfoV1 ))
55835580 return false ;
5581+ const auto Info = static_cast <EditorInfo*>(Param2);
55845582
55855583 Info->EditorID = EditorID;
55865584 Info->WindowSizeX =ObjWidth ();
@@ -5646,6 +5644,12 @@ int Editor::EditorControl(int Command, intptr_t Param1, void *Param2)
56465644 Info->CurState |= m_Flags.Check (FEDITOR_MODIFIED )? 0 : ECSTATE_SAVED ;
56475645 Info->CodePage = GetCodePage ();
56485646
5647+ if (Info->StructSize > offsetof (EditorInfo, ClientArea))
5648+ {
5649+ Info->ClientArea = GetPosition ().as <RECT >();
5650+ Info->ClientArea .left += LineNumbersWidth ();
5651+ Info->ClientArea .right -= ScrollbalWidth ();
5652+ }
56495653 return true ;
56505654 }
56515655
@@ -7144,6 +7148,18 @@ void Editor::AutoDeleteColors()
71447148 m_AutoDeletedColors.clear ();
71457149}
71467150
7151+ int Editor::LineNumbersWidth () const
7152+ {
7153+ // Calculate line number column width if needed
7154+ // Minimum width of 3 for "1", "10", "100", etc. plus 1 for spacing
7155+ return EdOpt.ShowLineNumbers ? (std::max (3 , static_cast <int >(std::log10 (static_cast <double >(Lines.size ()))) + 1 ) + 1 ) : 0 ;
7156+ }
7157+
7158+ int Editor::ScrollbalWidth () const
7159+ {
7160+ return EdOpt.ShowScrollBar && ScrollBarRequired (ObjHeight (), Lines.size ())? 1 : 0 ;
7161+ }
7162+
71477163#ifdef ENABLE_TESTS
71487164
71497165#include " testing.hpp"
0 commit comments