Skip to content

Commit

Permalink
more 4309
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Mar 20, 2015
1 parent 87d84e2 commit b90c884
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 40 deletions.
6 changes: 5 additions & 1 deletion far/changelog
@@ -1,4 +1,8 @@
drkns 19.03.2015 22:55:49 +0200 - build 4319
drkns 20.03.2015 09:36:40 +0200 - build 4320

1. Продолжение 4309.

drkns 19.03.2015 22:55:49 +0200 - build 4319

1. Уточнение 4280.

Expand Down
66 changes: 29 additions & 37 deletions far/editor.cpp
Expand Up @@ -966,9 +966,7 @@ int Editor::ProcessKey(const Manager::Key& Key)
if (!m_Flags.Check(FEDITOR_MARKINGBLOCK))
{
UnmarkBlock();
m_Flags.Set(FEDITOR_MARKINGBLOCK);
m_BlockType = BTYPE_STREAM;
m_it_AnyBlockStart=m_it_CurLine;
BeginStreamMarking(m_it_CurLine);
SelFirst=TRUE;
SelStart=SelEnd=CurPos;
}
Expand Down Expand Up @@ -1507,7 +1505,7 @@ int Editor::ProcessKey(const Manager::Key& Key)
{
if (/*!EdOpt.PersistentBlocks && */ !IsAnySelection())
{
m_it_AnyBlockStart = m_it_CurLine;
BeginStreamMarking(m_it_CurLine);
m_it_CurLine->AddSelect(0,-1);
Show();
}
Expand Down Expand Up @@ -2572,9 +2570,7 @@ int Editor::ProcessKey(const Manager::Key& Key)

if (m_it_CurLine->IsSelection())
{
m_Flags.Set(FEDITOR_MARKINGBLOCK);
m_BlockType = BTYPE_STREAM;
m_it_AnyBlockStart=m_it_CurLine;
BeginStreamMarking(m_it_CurLine);
//SelFirst=TRUE;
//BUGBUG, never used
SelStart=SStart;
Expand Down Expand Up @@ -2942,9 +2938,7 @@ int Editor::ProcessMouse(const MOUSE_EVENT_RECORD *MouseEvent)

if (m_it_CurLine->IsSelection())
{
m_Flags.Set(FEDITOR_MARKINGBLOCK);
m_BlockType = BTYPE_STREAM;
m_it_AnyBlockStart = m_it_CurLine;
BeginStreamMarking(m_it_CurLine);
}

EditorPrevDoubleClick=0;
Expand Down Expand Up @@ -3671,10 +3665,8 @@ BOOL Editor::Search(int Next)
Pasting++;
Lock();
UnmarkBlock();
m_Flags.Set(FEDITOR_MARKINGBLOCK);
m_BlockType = BTYPE_STREAM;
BeginStreamMarking(CurPtr);
CurPtr->Select(iFoundPos, iFoundPos+SearchLength);
m_it_AnyBlockStart = CurPtr;
Unlock();
Pasting--;
}
Expand Down Expand Up @@ -3834,10 +3826,8 @@ BOOL Editor::Search(int Next)
if (EdOpt.SearchSelFound && !ReplaceMode)
{
UnmarkBlock();
m_Flags.Set(FEDITOR_MARKINGBLOCK);
m_BlockType = BTYPE_STREAM;
BeginStreamMarking(CurPtr);
CurPtr->Select(LocalCurPos, LocalCurPos + static_cast<int>(strReplaceStrCurrent.size()));
m_it_AnyBlockStart = CurPtr;
}

if (at_end)
Expand Down Expand Up @@ -3927,10 +3917,8 @@ BOOL Editor::Search(int Next)
Lock();
// if (!EdOpt.PersistentBlocks)
UnmarkBlock();
m_Flags.Set(FEDITOR_MARKINGBLOCK);
m_BlockType = BTYPE_STREAM;
BeginStreamMarking(m_it_CurLine);
m_it_CurLine->Select(coord->Pos, coord->Pos+coord->SearchLen);
m_it_AnyBlockStart = m_it_CurLine;
Unlock();
Pasting--;
}
Expand Down Expand Up @@ -3983,10 +3971,8 @@ BOOL Editor::Search(int Next)
Lock();
// if (!EdOpt.PersistentBlocks)
UnmarkBlock();
m_Flags.Set(FEDITOR_MARKINGBLOCK);
m_BlockType = BTYPE_STREAM;
BeginStreamMarking(m_it_CurLine);
m_it_CurLine->Select(coord->Pos, coord->Pos+coord->SearchLen);
m_it_AnyBlockStart = m_it_CurLine;
Unlock();
Pasting--;
}
Expand Down Expand Up @@ -4051,7 +4037,8 @@ void Editor::Paste(const wchar_t *Src)
m_it_CurLine->SetOvertypeMode(false);
}

m_it_AnyBlockStart=m_it_CurLine;
BeginStreamMarking(m_it_CurLine);

/* $ 19.05.2001 IS
Ðåøåíèå ïðîáëåìû íåïðîøåíîé êîíâåðòàöèè òàáóëÿöèè (êîòîðàÿ äîëæíà áûòü
äîáàâëåíà â íà÷àëî ñòðîêè ïðè àâòîîòñòóïå) â ïðîáåëû.
Expand Down Expand Up @@ -4912,8 +4899,7 @@ void Editor::Undo(int redo)

void Editor::SelectAll()
{
m_it_AnyBlockStart = FirstLine();
m_BlockType = BTYPE_STREAM;
BeginStreamMarking(FirstLine());

FOR(auto& i, Lines)
{
Expand Down Expand Up @@ -5284,10 +5270,8 @@ void Editor::VPaste(const wchar_t *ClipText)
m_it_CurLine->SetOvertypeMode(false);
}

m_it_AnyBlockStart = m_it_CurLine;
BeginVBlockMarking();
int StartPos=m_it_CurLine->GetTabCurPos();
VBlockX=StartPos;
VBlockSizeX=0;
VBlockSizeY=0;
auto SavedTopScreen = m_it_TopScreen;

Expand Down Expand Up @@ -5793,9 +5777,7 @@ int Editor::EditorControl(int Command, intptr_t Param1, void *Param2)

if (Sel->BlockType==BTYPE_STREAM)
{
m_Flags.Set(FEDITOR_MARKINGBLOCK);
m_BlockType = BTYPE_STREAM;
m_it_AnyBlockStart = CurPtr;
BeginStreamMarking(CurPtr);

for (int i=0; i < Sel->BlockHeight; i++)
{
Expand All @@ -5810,9 +5792,7 @@ int Editor::EditorControl(int Command, intptr_t Param1, void *Param2)
}
else if (Sel->BlockType==BTYPE_COLUMN)
{
m_Flags.Set(FEDITOR_MARKINGVBLOCK);
m_BlockType = BTYPE_COLUMN;
m_it_AnyBlockStart = CurPtr;
BeginVBlockMarking(CurPtr);

VBlockX=Sel->BlockStartPos;

Expand Down Expand Up @@ -6613,17 +6593,29 @@ void Editor::ProcessVBlockMarking()
BeginVBlockMarking();
}

void Editor::BeginVBlockMarking()
void Editor::BeginVBlockMarking(const numbered_iterator& Where)
{
UnmarkBlock();
m_it_AnyBlockStart = m_it_CurLine;
VBlockX=m_it_CurLine->GetTabCurPos();
m_it_AnyBlockStart = Where;
VBlockX = Where->GetTabCurPos();
VBlockSizeX=0;
VBlockSizeY=1;
m_Flags.Set(FEDITOR_MARKINGVBLOCK);
m_BlockType = BTYPE_COLUMN;
}

void Editor::BeginVBlockMarking()
{
return BeginVBlockMarking(m_it_CurLine);
}

void Editor::BeginStreamMarking(const numbered_iterator& Where)
{
m_it_AnyBlockStart = Where;
m_BlockType = BTYPE_STREAM;
m_Flags.Set(FEDITOR_MARKINGBLOCK);
}

void Editor::AdjustVBlock(int PrevX)
{
int x=GetLineCurPos();
Expand Down
5 changes: 4 additions & 1 deletion far/editor.hpp
Expand Up @@ -315,7 +315,10 @@ class Editor: public SimpleScreenObject
bool IsStreamSelection() const { return IsAnySelection() && m_BlockType == BTYPE_STREAM; }
bool IsVerticalSelection() const { return IsAnySelection() && m_BlockType == BTYPE_COLUMN; }

void Unselect() { m_it_AnyBlockStart = EndIterator(); m_BlockType = BTYPE_NONE; }
void Unselect() { m_it_AnyBlockStart = EndIterator(); m_BlockType = BTYPE_NONE; TurnOffMarkingBlock(); }

void BeginStreamMarking(const numbered_iterator& Where);
void BeginVBlockMarking(const numbered_iterator& Where);

// Ìëàäøèé áàéò (ìàñêà 0xFF) þçàåòñÿ êëàññîì ScreenObject!!!
enum editor_flags
Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
@@ -1 +1 @@
m4_define(BUILD,4319)m4_dnl
m4_define(BUILD,4320)m4_dnl

0 comments on commit b90c884

Please sign in to comment.