Skip to content

Commit

Permalink
Fix toggle block comment broken for MATLAB and LaTeX.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Nov 21, 2018
1 parent e98680d commit 4079395
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
38 changes: 30 additions & 8 deletions src/Edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -2222,34 +2222,55 @@ void EditMoveDown(HWND hwnd) {
}
}

// only convert CR+LF
static void ConvertWinEditLineEndingsEx(char *s, int iEOLMode, int *linesCount) {
int count = 0;
if (iEOLMode != SC_EOL_CRLF) {
char *p = s;
const char chaEOL = (iEOLMode == SC_EOL_LF) ? '\n' : '\r';
while (*s) {
if (*s == '\r') {
switch (*s) {
case '\r':
++count;
if (iEOLMode == SC_EOL_LF) {
if (s[1] == '\n') {
++s;
*p++ = *s++;
*p++ = chaEOL;
} else {
*p++ = *s++;
++s;
*p++ = '\r';
}
} else {
++s;
break;

case '\n':
++count;
*p++ = '\n';
++s;
break;

default:
*p++ = *s++;
break;
}
}

*p = '\0';
if (linesCount != NULL) {
*linesCount = count;
}
} else if (linesCount != NULL) {
while (*s) {
if (*s == '\r') {
switch (*s++) {
case '\r':
++count;
if (*s == '\n') {
++s;
}
break;

case '\n':
++count;
break;
}
++s;
}
*linesCount = count;
}
Expand Down Expand Up @@ -5840,6 +5861,7 @@ static INT_PTR CALLBACK EditInsertTagDlgProc(HWND hwnd, UINT umsg, WPARAM wParam
*pwCur != L' ' &&
*pwCur != L'\t' &&
*pwCur != L'\r' &&
*pwCur != L'\n' &&
(StrChr(L":_-.", *pwCur) || isalnum(*pwCur))) {
wchIns[cchIns++] = *pwCur++;
}
Expand Down
2 changes: 1 addition & 1 deletion src/EditAutoC.c
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ void EditEncloseSelectionNewLine(HWND hwnd, LPCWSTR pwszOpen, LPCWSTR pwszClose)
WCHAR start[64] = L"";
WCHAR end[64] = L"";
const int iEOLMode = (int)SendMessage(hwnd, SCI_GETEOLMODE, 0, 0);
LPCWSTR lineEnd = (iEOLMode == SC_EOL_LF) ? L"LF" : ((iEOLMode == SC_EOL_CR) ? L"CR" : L"CR+LF");
LPCWSTR lineEnd = (iEOLMode == SC_EOL_LF) ? L"\n" : ((iEOLMode == SC_EOL_CR) ? L"\r" : L"\r\n");

Sci_Position pos = SciCall_GetSelectionStart();
int line = SciCall_LineFromPosition(pos);
Expand Down
4 changes: 2 additions & 2 deletions version.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ git clone https://github.com/XhmikosR/notepad2-mod.git
Scintilla
hg clone http://hg.code.sf.net/p/scintilla/code scintilla
4.1.2
2018-11-20 7172:05e2d46ae4c0
2018-11-21 7174:caa5c5b342a1

SciTE
hg clone http://hg.code.sf.net/p/scintilla/scite
4.1.2
2018-11-20 5101:2b22af2a7fbb
2018-11-21 5103:5db121386d1d

Notepad++
https://github.com/notepad-plus-plus/notepad-plus-plus.git
Expand Down

0 comments on commit 4079395

Please sign in to comment.