Skip to content

Commit

Permalink
M#2965: При вставке вертикального блока усекаются последние символы в…
Browse files Browse the repository at this point in the history
… каждой строке.
  • Loading branch information
shmuz committed Mar 8, 2015
1 parent 983ccdb commit 6fd027b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
6 changes: 5 additions & 1 deletion far/changelog
@@ -1,4 +1,8 @@
drkns 08.03.2015 19:08:46 +0200 - build 4294
shmuel 09.03.2015 00:15:32 +0200 - build 4295

1. M#2965: При вставке вертикального блока усекаются последние символы в каждой строке.

drkns 08.03.2015 19:08:46 +0200 - build 4294

1. Рефакторинг.

Expand Down
15 changes: 9 additions & 6 deletions far/editor.cpp
Expand Up @@ -5438,9 +5438,12 @@ void Editor::VPaste(const wchar_t *ClipText)
VBlockSizeY=0;
auto SavedTopScreen = TopScreen;

for (int I=0; ClipText[I]; I++)
if (ClipText[I]!=L'\r' && ClipText[I+1]!=L'\n')
ProcessKey(Manager::Key(ClipText[I]));
for (int I=0; ClipText[I]; )
{
int NewLineLen = ClipText[I]==L'\n' ? 1 : ClipText[I]==L'\r' ? ClipText[I+1]==L'\n' ? 2 : 1 : 0;

if (!NewLineLen)
ProcessKey(Manager::Key(ClipText[I++]));
else
{
int CurWidth=CurLine->GetTabCurPos()-StartPos;
Expand All @@ -5452,7 +5455,7 @@ void Editor::VPaste(const wchar_t *ClipText)

if (CurLine == LastLine)
{
if (ClipText[I+2])
if (ClipText[I+NewLineLen])
{
ProcessKey(Manager::Key(KEY_END));
ProcessKey(Manager::Key(KEY_ENTER));
Expand All @@ -5473,9 +5476,9 @@ void Editor::VPaste(const wchar_t *ClipText)
CurLine->SetOvertypeMode(false);
}

I++;
continue;
I += NewLineLen;
}
}

int CurWidth=CurLine->GetTabCurPos()-StartPos;

Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
@@ -1 +1 @@
m4_define(BUILD,4294)m4_dnl
m4_define(BUILD,4295)m4_dnl

0 comments on commit 6fd027b

Please sign in to comment.