D22276: Add an action to insert a non-indented newline

Ahmad Samir noreply at phabricator.kde.org
Fri Jul 5 22:42:00 BST 2019

ahmadsamir added inline comments.


> dhaumann wrote in katedocument.h:827
> I dislike the double negation: noIndentation = false. Later even !noIndentation. This is bad API design.
> Please change to bool indent = true.

Noted. Although I'll use an enum per cullmann's recommendation (but I'll choose a better name, hopefully).

(Believe it or not, I had it as "const bool indent" first, but then bike-shed it to an over-engineered death).

> cullmann wrote in kateview.cpp:2881
> I assume this is just copied from the normal
> void KTextEditor::ViewPrivate::keyReturn()
> {
>   doc()->newLine(this);
>   m_viewInternal->iconBorder()->updateForCursorLineChange();
>   m_viewInternal->updateView();
> }
> ;=) In doubt I would just keep this as is and one can think separately if that is needed in both places.

Correct. My reasoning was, it's exactly like keyReturn(), but with a different newLine() call, (i.e. someone else invented the wheel I just pushed in a different direction, so to speak).

As for updateForCursorLineChange(), digging around in git history I found this[1], so I guess it's needed.

Setting the cursor position and begin/endEdit are handled by DocumentPrivate::newLine().


  R39 KTextEditor


To: ahmadsamir, #ktexteditor, cullmann, dhaumann
Cc: bruns, mickaelbo, kde-frameworks-devel, kwrite-devel, LeGast00n, domson, michaelh, ngraham, demsking, cullmann, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20190705/4fc6b78f/attachment.html>

More information about the KWrite-Devel mailing list