mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-22 06:12:32 -06:00
theide: Force CRLF
git-svn-id: svn://ultimatepp.org/upp/trunk@1883 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
18f546fb86
commit
0915eea605
9 changed files with 21 additions and 9 deletions
|
|
@ -114,10 +114,14 @@ void TextCtrl::Load(Stream& s, byte charset) {
|
|||
PlaceCaret(0);
|
||||
}
|
||||
|
||||
void TextCtrl::Save(Stream& s, byte charset) const {
|
||||
void TextCtrl::Save(Stream& s, byte charset, bool crlf) const {
|
||||
charset = ResolveCharset(charset);
|
||||
for(int i = 0; i < line.GetCount(); i++) {
|
||||
if(i) s.PutEol();
|
||||
if(i)
|
||||
if(crlf)
|
||||
s.PutCrLf();
|
||||
else
|
||||
s.PutEol();
|
||||
String txt = charset == CHARSET_UTF8 ? line[i].text
|
||||
: FromUnicode(line[i], charset);
|
||||
const char *e = txt.End();
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ public:
|
|||
void CachePos(int pos);
|
||||
|
||||
void Load(Stream& s, byte charset = CHARSET_DEFAULT);
|
||||
void Save(Stream& s, byte charset = CHARSET_DEFAULT) const;
|
||||
void Save(Stream& s, byte charset = CHARSET_DEFAULT, bool crlf = false) const;
|
||||
|
||||
int GetInvalidCharPos(byte charset = CHARSET_DEFAULT) const;
|
||||
bool CheckCharset(byte charset = CHARSET_DEFAULT) const { return GetInvalidCharPos(charset) < 0; }
|
||||
|
|
|
|||
|
|
@ -114,11 +114,13 @@ Unlikely to be used in the client code.&]
|
|||
[s2;%% Loads the text from the stream with defined [%-*@3 charset].&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:TextCtrl`:`:Save`(Stream`&`,byte`)const: [@(0.0.255) void]_[* Save]([_^Stream^ Stream][@(0.0.255) `&
|
||||
]_[*@3 s], [_^byte^ byte]_[*@3 charset]_`=_CHARSET`_DEFAULT)_[@(0.0.255) const]&]
|
||||
[s5;:TextCtrl`:`:Save`(Stream`&`,byte`,bool`)const: [@(0.0.255) void]_[* Save]([_^Stream^ S
|
||||
tream][@(0.0.255) `&]_[*@3 s], [_^byte^ byte]_[*@3 charset]_`=_CHARSET`_DEFAULT,
|
||||
bool [*@3 crlf])_[@(0.0.255) const]&]
|
||||
[s2;%% Saves the text to the stream with defined [%-*@3 charset]. Characters
|
||||
that cannot be represented in suggested [%-*@3 charset] are saved
|
||||
as `'?`'.&]
|
||||
as `'?`'. If [%-*@3 crlf] is true, line endings are forced to be
|
||||
`"`\r`\n`" even on POSIX platforms.&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:TextCtrl`:`:GetInvalidCharPos`(byte`)const: [@(0.0.255) int]_[* GetInvalidCharPos]([_^byte^ b
|
||||
|
|
|
|||
|
|
@ -350,6 +350,7 @@ void Ide::SetupFormat() {
|
|||
(edt.tabs_grouping, tabs_grouping)
|
||||
(edt.tabs_serialize, tabs_serialize)
|
||||
(edt.filetabs, filetabs)
|
||||
(edt.forcecrlf, force_crlf)
|
||||
(edt.numbers, line_numbers)
|
||||
(edt.bookmark_pos, bookmark_pos)
|
||||
(edt.header_guards, header_guards)
|
||||
|
|
|
|||
|
|
@ -601,6 +601,7 @@ public:
|
|||
bool show_status_bar;
|
||||
bool toolbar_in_row;
|
||||
bool show_tabs;
|
||||
bool force_crlf;
|
||||
bool tabs_icons;
|
||||
bool tabs_crosses;
|
||||
bool tabs_grouping;
|
||||
|
|
|
|||
|
|
@ -424,6 +424,7 @@ LAYOUT(SetupEditorLayout, 488, 280)
|
|||
ITEM(Option, tabs_grouping, SetLabel(t_("Grouping")).LeftPosZ(196, 64).TopPosZ(200, 18))
|
||||
ITEM(Option, tabs_serialize, SetLabel(t_("Persistent tabs")).LeftPosZ(264, 108).TopPosZ(200, 18))
|
||||
ITEM(Switch, insert_include, SetLabel(t_("No #include in new sources\n#include first\n#include previous")).LeftPosZ(316, 156).TopPosZ(24, 56))
|
||||
ITEM(Option, forcecrlf, SetLabel(t_("Force CRLF line endings")).LeftPosZ(316, 160).TopPosZ(100, 20))
|
||||
ITEM(Option, header_guards, SetLabel(t_("Insert guards to new headers")).LeftPosZ(316, 164).TopPosZ(4, 15))
|
||||
ITEM(Option, auto_enclose, SetLabel(t_("[ { ( \" / * enclose selection")).LeftPosZ(12, 168).TopPosZ(220, 15))
|
||||
ITEM(Option, mark_lines, SetLabel(t_("Mark lines with errors, warning and changes")).LeftPosZ(12, 256).TopPosZ(240, 16))
|
||||
|
|
@ -484,7 +485,7 @@ LAYOUT(SetupAstyleLayout, 544, 280)
|
|||
ITEM(Option, TabSpaceConversionMode, SetLabel(t_("Convert tabs to spaces")).HSizePosZ(12, 400).TopPosZ(256, 18))
|
||||
ITEM(Button, Test, SetLabel(t_("Test")).LeftPosZ(284, 56).TopPosZ(252, 23))
|
||||
ITEM(LabelBox, dv___30, SetLabel(t_("Test box")).LeftPosZ(344, 196).TopPosZ(4, 272))
|
||||
ITEM(LineEdit, TestBox, SetFont(ScreenFixedZ(11)).LeftPosZ(348, 188).TopPosZ(20, 252))
|
||||
ITEM(LineEdit, TestBox, SetFont(MonospaceZ(11)).LeftPosZ(348, 188).TopPosZ(20, 252))
|
||||
ITEM(Button, Defaults, SetLabel(t_("Upp defaults")).LeftPosZ(176, 72).TopPosZ(252, 23))
|
||||
END_LAYOUT
|
||||
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ void Ide::SaveFile(bool always)
|
|||
}
|
||||
}
|
||||
else
|
||||
editor.Save(out, editor.GetCharset());
|
||||
editor.Save(out, editor.GetCharset(), force_crlf);
|
||||
out.Close();
|
||||
if(out.IsError()) {
|
||||
Exclamation(NFormat("Error writing temporary file [* \1%s\1].", tmpfile));
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ void Ide::ConsolePaste()
|
|||
}
|
||||
|
||||
void Ide::Serialize(Stream& s) {
|
||||
int version = 13;
|
||||
int version = 15;
|
||||
s.Magic(0x1234);
|
||||
s / version;
|
||||
s % main;
|
||||
|
|
@ -110,6 +110,9 @@ void Ide::Serialize(Stream& s) {
|
|||
s % tabs_grouping;
|
||||
s % tabs_serialize;
|
||||
}
|
||||
if(version >= 15) {
|
||||
s % force_crlf;
|
||||
}
|
||||
s % no_parenthesis_indent;
|
||||
s % hilite_scope;
|
||||
s % hilite_if_endif;
|
||||
|
|
|
|||
0
uppsrc/upp.log
Normal file
0
uppsrc/upp.log
Normal file
Loading…
Add table
Add a link
Reference in a new issue