JSON转代码内容文本时,自动分行
This commit is contained in:
parent
5fac179faa
commit
2fd3dc61eb
|
@ -7054,8 +7054,22 @@ void ChgjsonDlg::OnBnClickedButton2()
|
||||||
pos = txt.find("\\u", pos + 3);
|
pos = txt.find("\\u", pos + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// divide into multi-lines with 16KB per line ...
|
||||||
|
int lines = 1;
|
||||||
|
pos = txt.length();
|
||||||
|
while (pos > 16 * 1024)
|
||||||
|
{
|
||||||
|
pos -= 12 * 1024;
|
||||||
|
while (txt[pos - 1] == '\\')
|
||||||
|
pos++;
|
||||||
|
txt.insert(pos, "\r\n");
|
||||||
|
lines++;
|
||||||
|
}
|
||||||
file_util::set_clipboard(txt.c_str(), txt.length());
|
file_util::set_clipboard(txt.c_str(), txt.length());
|
||||||
MessageBox(TEXT("JSON text has set to clipboard already"));
|
|
||||||
|
TCHAR msg[128] = { 0 };
|
||||||
|
_stprintf(msg, TEXT("%d lines"), lines);
|
||||||
|
MessageBox(TEXT("JSON text has set to clipboard already"), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue