Skip to content

Commit

Permalink
Add option to make Shift+Enter add \n instead of \N
Browse files Browse the repository at this point in the history
\n is useful in combination with a WrapStyle of 2, which plays
nicer with style overrides.
  • Loading branch information
arch1t3cht committed Jan 16, 2025
1 parent 345e453 commit 8ccac0c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/libresrc/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@
"Width" : 1280
},
"Edit Box" : {
"Soft Line Break": false,
"Font Face" : "",
"Font Size" : 10
},
Expand Down
2 changes: 1 addition & 1 deletion src/preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void Interface(wxTreebook *book, Preferences *parent) {
auto edit_box = p->PageSizer(_("Edit Box"));
p->OptionAdd(edit_box, _("Enable call tips"), "App/Call Tips");
p->OptionAdd(edit_box, _("Overwrite in time boxes"), "Subtitle/Time Edit/Insert Mode");
p->CellSkip(edit_box);
p->OptionAdd(edit_box, _("Shift+Enter adds \\n"), "Subtitle/Edit Box/Soft Line Break");
p->OptionAdd(edit_box, _("Enable syntax highlighting"), "Subtitle/Highlight/Syntax");
p->OptionBrowse(edit_box, _("Dictionaries path"), "Path/Dictionary");
p->OptionFont(edit_box, "Subtitle/Edit Box/");
Expand Down
2 changes: 1 addition & 1 deletion src/subs_edit_ctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void SubsTextEditCtrl::OnKeyDown(wxKeyEvent &event) {
auto sel_start = GetSelectionStart(), sel_end = GetSelectionEnd();
wxCharBuffer old = GetTextRaw();
std::string data(old.data(), sel_start);
data.append("\\N");
data.append(OPT_GET("Subtitle/Edit Box/Soft Line Break")->GetBool() ? "\\n" : "\\N");
data.append(old.data() + sel_end, old.length() - sel_end);
SetTextRaw(data.c_str());

Expand Down

1 comment on commit 8ccac0c

@AdventurerRussia
Copy link

@AdventurerRussia AdventurerRussia commented on 8ccac0c Jan 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arch1t3cht Can you add some shortcuts to open video? because this function is very common when working with the program and somehow there are not enough shortcuts for it.

Please sign in to comment.