diff --git a/src/window.cc b/src/window.cc index 09babb8f..fa932778 100644 --- a/src/window.cc +++ b/src/window.cc @@ -170,10 +170,7 @@ const DisplayBuffer& Window::update_display_buffer(const Context& context) m_display_buffer.optimize(); m_last_setup = build_setup(context); - - m_position.line = clamp(setup.window_pos.line - m_position_offset.line, 0_line, buffer().line_count()-1); - m_position.column = std::max(0_col, setup.window_pos.column - m_position_offset.column); - m_range = setup.window_range; + set_position(setup.window_pos - m_position_offset); if (profile and not (buffer().flags() & Buffer::Flags::Debug)) { @@ -188,7 +185,7 @@ const DisplayBuffer& Window::update_display_buffer(const Context& context) void Window::set_position(DisplayCoord position) { - m_position.line = std::max(0_line, position.line); + m_position.line = clamp(position.line, 0_line, buffer().line_count()-1); m_position.column = std::max(0_col, position.column); } diff --git a/src/window.hh b/src/window.hh index 284e82bc..f63fc9a1 100644 --- a/src/window.hh +++ b/src/window.hh @@ -22,8 +22,6 @@ public: const DisplayCoord& position() const { return m_position; } void set_position(DisplayCoord position); - const DisplayCoord& range() const { return m_range; } - const DisplayCoord& dimensions() const { return m_dimensions; } void set_dimensions(DisplayCoord dimensions, bool offset_pos = false); @@ -62,7 +60,6 @@ private: DisplayCoord m_position; DisplayCoord m_position_offset; - DisplayCoord m_range; DisplayCoord m_dimensions; DisplayBuffer m_display_buffer;