Today's Interesting Links (2024-01-16)

  • I love Far Manager. My main machine these days is a Slackware X1 nano, but if I ever open my Windows laptop I use Far Manager.
  • The code of Far Manager is unsurprising gorgeous, tidy, and easy to understand. Here is the ScrollUp function for instance:
void Editor::ScrollUp()
{
	//TODO: "Свертка" - если учесть "!Flags.Check(FSCROBJ_VISIBLE)", то крутить надо до следующей видимой строки
	if (m_it_CurLine == Lines.begin())
		return;

	if (m_it_TopScreen == Lines.begin())
	{
		Up();
		return;
	}

	--m_it_TopScreen;

	UpdateIteratorAndKeepPos(m_it_CurLine, [](numbered_iterator& Iter) { --Iter; });
}

And how it is used:

When you hit control and up

		case KEY_RCTRLUP: case KEY_RCTRLNUMPAD8:
		{
			m_Flags.Set(FEDITOR_NEWUNDO);
			ScrollUp();
			Refresh = true;
			return true;
		}

when you hit Page Up


		case KEY_PGUP:     case KEY_NUMPAD9:
		{
			m_Flags.Set(FEDITOR_NEWUNDO);

			repeat(m_Where.bottom - m_Where.top, [&]{ ScrollUp(); });

			Refresh = true;
			return true;
		}