mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-11-03 21:24:30 +03:00
Enable line wrapping
Merge pull request #709 from jensenr30/line-wrapping
This commit is contained in:
commit
dac06473c0
@ -6,6 +6,7 @@ Description
|
||||
|
||||
* UI(Commit List): Added a right-click menu entry to rename branches.
|
||||
* UI(Main Menu): Added a menu-entry to rename the current branch.
|
||||
* UI(Diff View): Added line wrapping option in Tools - Options - Diff
|
||||
|
||||
#### Changed
|
||||
|
||||
|
@ -79,6 +79,11 @@ See blame of the current version with an integrated timeline to see who changed
|
||||
|
||||
![Blame View](https://raw.githubusercontent.com/Murmele/Gittyup/master/rsrc/screenshots/BlameView.png)
|
||||
|
||||
### Dynamic Line Wrapping
|
||||
Courtesy of Scintilla.
|
||||
|
||||
![Line Wrapping](/rsrc/screenshots/line-wrap-demo-2.gif)
|
||||
|
||||
### Single line staging
|
||||
by eighter clicking on the checkboxes next to each line or by selecting the relevant code and pressing "S". For unstaging you can uncheck the checkboxes or press "U". To revert changes, select the text and press "R".
|
||||
|
||||
|
BIN
rsrc/screenshots/line-wrap-demo-2.gif
Normal file
BIN
rsrc/screenshots/line-wrap-demo-2.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 MiB |
@ -25,6 +25,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
const QString kWrapLines("diff/lines/wrap");
|
||||
const QString kIgnoreWsKey("diff/whitespace/ignore");
|
||||
const QString kLastPathKey("lastpath");
|
||||
const QString kTranslation("translation");
|
||||
@ -191,6 +192,14 @@ QString Settings::hotkey(const QString &action) const {
|
||||
return value("hotkeys/" + action, "").toString();
|
||||
}
|
||||
|
||||
bool Settings::isTextEditorWrapLines() const {
|
||||
return value(kWrapLines).toBool();
|
||||
}
|
||||
|
||||
void Settings::setTextEditorWrapLines(bool wrap) {
|
||||
setValue(kWrapLines, wrap, true);
|
||||
}
|
||||
|
||||
bool Settings::isWhitespaceIgnored() const {
|
||||
return value(kIgnoreWsKey).toBool();
|
||||
}
|
||||
|
@ -36,6 +36,10 @@ public:
|
||||
void setHotkey(const QString &action, const QString &hotkey);
|
||||
QString hotkey(const QString &action) const;
|
||||
|
||||
// wrap lines in TextEditor in DiffView
|
||||
bool isTextEditorWrapLines() const;
|
||||
void setTextEditorWrapLines(bool wrapLines);
|
||||
|
||||
// ignore whitespace
|
||||
bool isWhitespaceIgnored() const;
|
||||
void setWhitespaceIgnored(bool ignored);
|
||||
|
@ -69,8 +69,16 @@ DiffPanel::DiffPanel(const git::Repository &repo, QWidget *parent)
|
||||
}
|
||||
});
|
||||
|
||||
// Wrap lines
|
||||
QCheckBox *wrapLines = new QCheckBox(tr("Wrap lines"), this);
|
||||
wrapLines->setChecked(Settings::instance()->isTextEditorWrapLines());
|
||||
connect(wrapLines, &QCheckBox::toggled, [](bool wrap) {
|
||||
Settings::instance()->setTextEditorWrapLines(wrap);
|
||||
});
|
||||
|
||||
QFormLayout *layout = new QFormLayout(this);
|
||||
layout->addRow(tr("Context lines:"), contextLayout);
|
||||
layout->addRow(tr("Wrap lines:"), wrapLines);
|
||||
layout->addRow(tr("Character Encoding:"), encoding);
|
||||
|
||||
// Remaining settings are strictly global.
|
||||
|
@ -76,6 +76,8 @@ TextEditor::TextEditor(QWidget *parent) : ScintillaIFace(parent) {
|
||||
setScrollWidthTracking(true);
|
||||
setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
|
||||
|
||||
setWrapMode(SC_WRAP_NONE);
|
||||
|
||||
setMarginLeft(4);
|
||||
setMarginTypeN(Staged, SC_MARGIN_SYMBOL);
|
||||
setMarginTypeN(LineNumber, SC_MARGIN_NUMBER);
|
||||
@ -181,6 +183,12 @@ void TextEditor::applySettings() {
|
||||
setIndent(settings->value(Setting::Id::IndentWidth).toInt());
|
||||
setTabWidth(settings->value(Setting::Id::TabWidth).toInt());
|
||||
|
||||
if (Settings::instance()->isTextEditorWrapLines()) {
|
||||
setWrapMode(SC_WRAP_WORD);
|
||||
} else {
|
||||
setWrapMode(SC_WRAP_NONE);
|
||||
}
|
||||
|
||||
// Initialize markers.
|
||||
QColor background = palette().color(QPalette::Base);
|
||||
int fontHeight;
|
||||
|
Loading…
Reference in New Issue
Block a user